Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ Added

Contributed by @khushboobhatia01

* Added cancel/pause/resume requester information to execution context. #5459

Contributed by @khushboobhatia01

Fixed
~~~~~

Expand Down
1 change: 0 additions & 1 deletion contrib/runners/orquesta_runner/tests/unit/test_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def test_cancel(self):
lv_ac_db, ac_ex_db = ac_svc.request_cancellation(lv_ac_db, requester)
lv_ac_db = lv_db_access.LiveAction.get_by_id(str(lv_ac_db.id))
self.assertEqual(lv_ac_db.status, ac_const.LIVEACTION_STATUS_CANCELING)
self.assertEqual(lv_ac_db.context["cancelled_by"], requester)

def test_cancel_workflow_cascade_down_to_subworkflow(self):
wf_meta = base.get_wf_fixture_meta_data(TEST_PACK_PATH, "subworkflow.yaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def test_pause(self):
lv_ac_db, ac_ex_db = ac_svc.request_pause(lv_ac_db, cfg.CONF.system_user.user)
lv_ac_db = lv_db_access.LiveAction.get_by_id(str(lv_ac_db.id))
self.assertEqual(lv_ac_db.status, ac_const.LIVEACTION_STATUS_PAUSING)
self.assertEqual(lv_ac_db.context["paused_by"], cfg.CONF.system_user.user)

@mock.patch.object(ac_svc, "is_children_active", mock.MagicMock(return_value=True))
def test_pause_with_active_children(self):
Expand Down Expand Up @@ -526,7 +525,6 @@ def test_resume(self):
workflow_execution=str(wf_ex_dbs[0].id)
)
self.assertEqual(len(tk_ex_dbs), 2)
self.assertEqual(lv_ac_db.context["resumed_by"], cfg.CONF.system_user.user)

def test_resume_cascade_to_subworkflow(self):
wf_meta = base.get_wf_fixture_meta_data(TEST_PACK_PATH, "subworkflow.yaml")
Expand Down
27 changes: 4 additions & 23 deletions st2common/st2common/services/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,7 @@ def request(liveaction):


def update_status(
liveaction,
new_status,
result=None,
publish=True,
set_result_size=False,
context=None,
liveaction, new_status, result=None, publish=True, set_result_size=False
):
if liveaction.status == new_status:
return liveaction
Expand All @@ -231,7 +226,6 @@ def update_status(
"status": new_status,
"result": result,
"publish": False,
"context": context,
}

if new_status in action_constants.LIVEACTION_COMPLETED_STATES:
Expand Down Expand Up @@ -310,10 +304,7 @@ def request_cancellation(liveaction, requester):
else:
status = action_constants.LIVEACTION_STATUS_CANCELED

liveaction.context["cancelled_by"] = requester
liveaction = update_status(
liveaction, status, result=result, context=liveaction.context
)
liveaction = update_status(liveaction, status, result=result)

execution = ActionExecution.get(liveaction__id=str(liveaction.id))

Expand Down Expand Up @@ -355,12 +346,7 @@ def request_pause(liveaction, requester):
% liveaction.id
)

liveaction.context["paused_by"] = requester
liveaction = update_status(
liveaction,
action_constants.LIVEACTION_STATUS_PAUSING,
context=liveaction.context,
)
liveaction = update_status(liveaction, action_constants.LIVEACTION_STATUS_PAUSING)

execution = ActionExecution.get(liveaction__id=str(liveaction.id))

Expand Down Expand Up @@ -404,12 +390,7 @@ def request_resume(liveaction, requester):
'not in "paused" state.' % (liveaction.id, liveaction.status)
)

liveaction.context["resumed_by"] = requester
liveaction = update_status(
liveaction,
action_constants.LIVEACTION_STATUS_RESUMING,
context=liveaction.context,
)
liveaction = update_status(liveaction, action_constants.LIVEACTION_STATUS_RESUMING)

execution = ActionExecution.get(liveaction__id=str(liveaction.id))

Expand Down