Add list_open_workflow_executions endpoint
This commit is contained in:
parent
129b4faff8
commit
93120927f7
5 changed files with 158 additions and 1 deletions
|
|
@ -61,6 +61,21 @@ class SWFBackend(BaseBackend):
|
|||
domains = reversed(domains)
|
||||
return domains
|
||||
|
||||
def list_open_workflow_executions(self, domain_name, start_time_filter,
|
||||
maximum_page_size, reverse_order,
|
||||
**kwargs):
|
||||
self._process_timeouts()
|
||||
domain = self._get_domain(domain_name)
|
||||
if domain.status == "DEPRECATED":
|
||||
raise SWFDomainDeprecatedFault(domain_name)
|
||||
open_wfes = [
|
||||
wfe for wfe in domain.workflow_executions
|
||||
if wfe.execution_status == 'OPEN'
|
||||
]
|
||||
if reverse_order:
|
||||
open_wfes = reversed(open_wfes)
|
||||
return open_wfes[0:maximum_page_size]
|
||||
|
||||
def register_domain(self, name, workflow_execution_retention_period_in_days,
|
||||
description=None):
|
||||
if self._get_domain(name, ignore_empty=True):
|
||||
|
|
|
|||
|
|
@ -146,6 +146,27 @@ class WorkflowExecution(object):
|
|||
hsh["latestActivityTaskTimestamp"] = self.latest_activity_task_timestamp
|
||||
return hsh
|
||||
|
||||
def to_list_dict(self):
|
||||
hsh = {
|
||||
'execution': {
|
||||
'workflowId': self.workflow_id,
|
||||
'runId': self.run_id,
|
||||
},
|
||||
'workflowType': self.workflow_type.to_short_dict(),
|
||||
'startTimestamp': self.start_timestamp,
|
||||
'executionStatus': self.execution_status,
|
||||
'cancelRequested': self.cancel_requested,
|
||||
}
|
||||
if self.tag_list:
|
||||
hsh['tagList'] = self.tag_list
|
||||
if self.parent:
|
||||
hsh['parent'] = self.parent
|
||||
if self.close_status:
|
||||
hsh['closeStatus'] = self.close_status
|
||||
if self.close_timestamp:
|
||||
hsh['closeTimestamp'] = self.close_timestamp
|
||||
return hsh
|
||||
|
||||
def _process_timeouts(self):
|
||||
"""
|
||||
SWF timeouts can happen on different objects (workflow executions,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue