本文整理匯總了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'