def dataset_untrained_status(req, resp, resource, params):
"""Raises an error if dataset is not on an untrained state
Must be executed after check_dataset_exsistence. This will not inform
about dataset existence, instead will return an undefined error.
If query param ignore_status is true, it will not raise any error
"""
status, dataset_dto = _get_dataset_status(params['dataset_id'])
ignore_status = req.get_param_as_bool("ignore_status")
# Dataset is trained if 0b0010 bit is on
if status & 0b0010 != 0 and not ignore_status:
raise falcon.HTTPConflict(
title="The dataset is not in a correct state",
description=("The dataset {id} has an status {status}, which "
"is not valid to insert triples. Required is 0 "
).format(**dataset_dto.to_dict()))
评论列表
文章目录