How do you get the state of a WorkflowExecution if all you have is a workflowId in Amazon SWF -
it seems swf operations getting execution state need runid
(their reference workflow execution), , don't feel storing that. want able lookup based on workflowid
(my id, not theirs). possible @ all?
i mean, guess add tags retrieve tags, seems little awkward, if passed workflowid
well.
yes, according listopenworkflowexecutions api documentation user can filter open executions workflowid.
a python example, using boto.swf
(use 1. this post setup domain):
$ ipython python 2.7.3 (default, apr 10 2013, 06:20:15) type "copyright", "credits" or "license" more information. in [1]: import boto.swf.layer2 swf in [2]: domain = swf.domain(name='stackoverflow') in [3]: domain.workflows() out[3]: [ workflowtype 'myworkflow-1.0' @ 0x32a44d0 ] in [4]: myworkflow = domain.workflows()[0] in [5]: execution = myworkflow.start(workflow_id='my_wf_id', task_list='default') in [6]: other_execution = myworkflow.start(workflow_id='some_other_wf_id', task_list='default') in [7]: domain.executions() out[7]: [ workflowexecution 'myworkflow-1.0' @ 0x32a4910 , workflowexecution 'myworkflow-1.0' @ 0x32ac090 , workflowexecution 'myworkflow-1.0' @ 0x32ac210 ] in [8]: execution.describe() out[8]: {'executionconfiguration': {'childpolicy': 'terminate', 'executionstarttoclosetimeout': '3600', 'tasklist': {'name': 'default'}, 'taskstarttoclosetimeout': '300'}, 'executioninfo': {'cancelrequested': false, 'execution': {'runid': '...', 'workflowid': 'my_wf_id'}, 'executionstatus': 'open', 'starttimestamp': 1374482188.063, 'workflowtype': {'name': 'myworkflow', 'version': '1.0'}}, 'opencounts': {'openactivitytasks': 0, 'openchildworkflowexecutions': 0, 'opendecisiontasks': 1, 'opentimers': 0}} in [9]: domain.executions(workflow_id='my_wf_id') out[9]: [ workflowexecution 'myworkflow-1.0' @ 0x344fad0 ] in [10]: domain.executions(workflow_id='my_wf_id')[0].describe() out[10]: {'executionconfiguration': {'childpolicy': 'terminate', 'executionstarttoclosetimeout': '3600', 'tasklist': {'name': 'default'}, 'taskstarttoclosetimeout': '300'}, 'executioninfo': {'cancelrequested': false, 'execution': {'runid': '...', 'workflowid': 'my_wf_id'}, 'executionstatus': 'open', 'starttimestamp': 1374482188.063, 'workflowtype': {'name': 'myworkflow', 'version': '1.0'}}, 'opencounts': {'openactivitytasks': 0, 'openchildworkflowexecutions': 0, 'opendecisiontasks': 1, 'opentimers': 0}}
Comments
Post a Comment