本文整理汇总了Python中invenio.modules.workflows.models.BibWorkflowObject.create_object_revision方法的典型用法代码示例。如果您正苦于以下问题:Python BibWorkflowObject.create_object_revision方法的具体用法?Python BibWorkflowObject.create_object_revision怎么用?Python BibWorkflowObject.create_object_revision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio.modules.workflows.models.BibWorkflowObject
的用法示例。
在下文中一共展示了BibWorkflowObject.create_object_revision方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _start_workflow
# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import create_object_revision [as 别名]
def _start_workflow(obj, eng):
myobject = BibWorkflowObject.create_object_revision(obj,
version=ObjectVersion.INITIAL,
data_type="record")
workflow_id = start_delayed(workflow_to_run,
data=[myobject],
stop_on_error=True,
**kwargs)
eng.log.info("Workflow launched")
try:
eng.extra_data["_workflow_ids"].append(workflow_id)
except KeyError:
eng.extra_data["_workflow_ids"] = [workflow_id]
try:
eng.extra_data["_nb_workflow"] += 1
except KeyError:
eng.extra_data["_nb_workflow"] = 1
if "_nb_workflow_failed" not in eng.extra_data:
eng.extra_data["_nb_workflow_failed"] = 0
if "_nb_workflow_finish" not in eng.extra_data:
eng.extra_data["_nb_workflow_finish"] = 0
if "_uuid_workflow_crashed" not in eng.extra_data:
eng.extra_data["_uuid_workflow_crashed"] = []