本文整理匯總了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"] = []