common_hooks.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:kge-server 作者: vfrico 项目源码 文件源码
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()))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号