Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

Commit f538ba7

Browse files
author
Oleiade
committed
Update: restore workflow_type WorkflowExecution's attribute
+ In order to enhance and boost metrics collection, WorkflowExecutionQuerySet will return WorkflowExecutions which workflow_type attribute is set. New http request has been avoided.
1 parent 87de1fc commit f538ba7

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

swf/models/workflow.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ class WorkflowExecution(BaseModel):
313313
'workflow_id',
314314
'run_id',
315315
'status',
316+
'workflow_type',
316317
'task_list',
317318
'child_policy',
318319
'close_status',
@@ -322,17 +323,18 @@ class WorkflowExecution(BaseModel):
322323
'decision_tasks_timeout',
323324
]
324325

325-
def __init__(self, domain,
326-
workflow_id, run_id=None,
327-
status=STATUS_OPEN, task_list=None,
328-
child_policy=None, close_status=None,
329-
execution_timeout=None, input=None,
330-
tag_list=None, decision_tasks_timeout=None,
326+
def __init__(self, domain, workflow_id, run_id=None,
327+
status=STATUS_OPEN, workflow_type=None,
328+
task_list=None, child_policy=None,
329+
close_status=None, execution_timeout=None,
330+
input=None, tag_list=None,
331+
decision_tasks_timeout=None,
331332
*args, **kwargs):
332333
self.domain = domain
333334
self.workflow_id = workflow_id
334335
self.run_id = run_id
335336
self.status = status
337+
self.workflow_type = workflow_type
336338
self.task_list = task_list
337339
self.child_policy = child_policy
338340
self.close_status = close_status

swf/querysets/workflow.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,17 @@ def get_workflow_type(self, execution_info):
430430
)
431431

432432
def to_WorkflowExecution(self, domain, execution_info, **kwargs):
433+
workflow_type = WorkflowType(
434+
self.domain,
435+
execution_info['workflowType']['name'],
436+
execution_info['workflowType']['version']
437+
)
438+
433439
return WorkflowExecution(
434440
domain,
435441
get_subkey(execution_info, ['execution', 'workflowId']), # workflow_id
436442
run_id=get_subkey(execution_info, ['execution', 'runId']),
443+
workflow_type=workflow_type,
437444
status=execution_info.get('executionStatus'),
438445
close_status=execution_info.get('closeStatus'),
439446
tag_list=execution_info.get('tagList'),

0 commit comments

Comments
 (0)