Skip to content

Fix the garbage collection for orquesta workflow executions - #4733

Merged
arm4b merged 3 commits into
masterfrom
fix-orquesta-gc
Jul 5, 2019
Merged

arm4b merged 3 commits into
masterfrom
fix-orquesta-gc

Conversation

@m4dcoder

@m4dcoder m4dcoder commented Jul 5, 2019

Copy link
Copy Markdown
Contributor

Fix logic in identifying orphaned workflow executions which causes long running workflow executions to be canceled. Disable this garbage collection feature for orphaned workflow executions by default.

m4dcoder added 2 commits July 5, 2019 09:21
In the query to identify task executions, add id__ne filter so that the action execution for the workflow execution is not included.  This fixes the case where there is no task executions for the workflow execution. If there are task executions for the workflow execution, fix the if statement that identifies if there is any active tasks and if there are not active tasks whether the most recently completed task has passed expiry datetime.
Orphaned workflow executions are not common. Disable this gc feature by default and let users knowingly enable it.
@m4dcoder
m4dcoder requested review from Kami and arm4b July 5, 2019 09:28
@m4dcoder m4dcoder added this to the 3.1.0 milestone Jul 5, 2019
@m4dcoder

m4dcoder commented Jul 5, 2019

Copy link
Copy Markdown
Contributor Author

Please note that there are existing unit tests covering this feature @ https://github.com/StackStorm/st2/blob/master/st2common/tests/unit/services/test_workflow_identify_orphans.py. Once the logic in the if statement was changed, these tests failed. Adding the additional filter id__ne when querying for ActionExecution fixes the issue.

Comment thread conf/st2.conf.sample
retry_wait_fixed_msec = 1000
# Max seconds to allow workflow execution be idled before it is identified as orphaned and cancelled by the garbage collector.
gc_max_idle_sec = 900
# Max seconds to allow workflow execution be idled before it is identified as orphaned and cancelled by the garbage collector. A value of zero means the feature is disabled. This is disabled by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a better/safer default 👍

@Kami

Kami commented Jul 5, 2019 •

Copy link
Copy Markdown
Member

Can you please point me to an explicit test case which checks that nothing is deleted / marked as canceled when config option is set to 0?

Aka in addition to testing the default value, also having an explicit test case which tests with 0.

Besides that, the change looks good to me.

Add unit tests to test whether the garbage collection for canceling orphaned workflow executions is disabled by setting gc_max_idle_sec to zero.
@m4dcoder

m4dcoder commented Jul 5, 2019

Copy link
Copy Markdown
Contributor Author

@Kami Unit tests added to address your concerns. Note, the garbage collector service has zero unit tests for other gc routines. I only added tests to cover the issue here.

@arm4b

arm4b commented Jul 5, 2019

Copy link
Copy Markdown
Member

Merging to have it in master/packages ASAP

@arm4b
arm4b merged commit bb92c1d into master Jul 5, 2019
@arm4b
arm4b deleted the fix-orquesta-gc branch July 5, 2019 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants