本文整理汇总了Python中spreads.workflow.Workflow.find_all方法的典型用法代码示例。如果您正苦于以下问题:Python Workflow.find_all方法的具体用法?Python Workflow.find_all怎么用?Python Workflow.find_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spreads.workflow.Workflow
的用法示例。
在下文中一共展示了Workflow.find_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_workflows
# 需要导入模块: from spreads.workflow import Workflow [as 别名]
# 或者: from spreads.workflow.Workflow import find_all [as 别名]
def list_workflows():
""" Return a list of all workflows.
:resheader Content-Type: :mimetype:`application/json`
"""
workflows = Workflow.find_all(app.config['base_path'])
return make_response(json.dumps(workflows.values()),
200, {'Content-Type': 'application/json'})
示例2: prepare_capture
# 需要导入模块: from spreads.workflow import Workflow [as 别名]
# 或者: from spreads.workflow.Workflow import find_all [as 别名]
def prepare_capture(workflow):
""" Prepare capture for the requested workflow. """
# Check if any other workflow is active and finish, if neccessary
logger.debug("Finishing previous workflows")
wfitems = Workflow.find_all(app.config['base_path'], key='id').iteritems()
for wfid, wf in wfitems:
if wf.status['step'] == 'capture' and wf.status['prepared']:
if wf is workflow and not request.args.get('reset'):
return 'OK'
wf.finish_capture()
try:
workflow.prepare_capture()
except DeviceException as e:
logger.error(e)
raise ApiException("Could not prepare capture: {0}".format(e.message),
500, error_type='device')
return 'OK'
示例3: prepare_capture
# 需要导入模块: from spreads.workflow import Workflow [as 别名]
# 或者: from spreads.workflow.Workflow import find_all [as 别名]
def prepare_capture(workflow):
""" Prepare capture for the requested workflow.
"""
if app.config['mode'] not in ('scanner', 'full'):
raise ApiException("Only possible when running in 'scanner' or 'full'"
" mode.", 503)
# Check if any other workflow is active and finish, if neccessary
logger.debug("Finishing previous workflows")
wfitems = Workflow.find_all(app.config['base_path'], key='id').iteritems()
for wfid, wf in wfitems:
if wf.status['step'] == 'capture' and wf.status['prepared']:
if wf is workflow and not request.args.get('reset'):
return 'OK'
wf.finish_capture()
workflow.prepare_capture()
return 'OK'