New fields added to action execution context

* with_items_index describes the current index of action,
if there is no with-items tasks it should be 0.
* task_rerun_no describes the current rerun index,
if it is first run it should be 0.
* task_rerun_id specifies id task has within
each rerun. This id should be refreshed after each rerun.

All these fields will be helpful for writing custom actions

Change-Id: I2b76f5cedcac942e3b6a6e9488ae89024c4f1b34
Signed-off-by: Oleg Ovcharuk <vgvoleg@gmail.com>
This commit is contained in:
Oleg Ovcharuk 2023-10-08 20:04:37 +03:00
parent cdb47f994b
commit 5d7fd30ba3
2 changed files with 9 additions and 2 deletions

View File

@ -69,12 +69,16 @@ class SecurityContext(object):
class ExecutionContext(object):
def __init__(self, workflow_execution_id=None, task_execution_id=None,
action_execution_id=None, workflow_name=None,
callback_url=None, task_id=None):
callback_url=None, task_id=None, with_items_index=0,
task_rerun_no=0, task_rerun_id=None):
self.workflow_execution_id = workflow_execution_id
self.task_execution_id = task_execution_id
self.action_execution_id = action_execution_id
self.workflow_name = workflow_name
self.callback_url = callback_url
self.with_items_index = with_items_index
self.task_rerun_no = task_rerun_no
self.task_rerun_id = task_rerun_id
if task_id is not None:
self.task_execution_id = task_id

View File

@ -33,7 +33,10 @@ def _fake_context():
task_execution_id='task_execution_id',
action_execution_id='action_execution_id',
workflow_name='workflow_name',
callback_url='callback_url')
callback_url='callback_url',
with_items_index=0,
task_rerun_no=0,
task_rerun_id='task_rerun_id')
return context.ActionContext(security_ctx, execution_ctx)