-
-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] [Issue#4939] Changes to support new purge task executions and purge workflows #4924
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srimandaleeka01 I think overall these changes are great to see.
What i think would be a better approach though is to integrate the workflow and task purging into the already existing purge executions script. This way things like the st2garbagecollector
process will be automatically updated.
Should be just moving some code around.
Does that sound good?
Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue. |
====================================================================== 1) ERROR: test_run (test_action_unload.UnloadActionTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): tests/test_action_unload.py line 100 in test_run action.run(packs=[pack]) actions/pack_mgmt/unload.py line 68 in run self._unregister_rules(pack=pack) actions/pack_mgmt/unload.py line 99 in _unregister_rules cleanup_trigger_db_for_rule(rule_db=rule_db) /home/runner/work/st2/st2/st2common/st2common/services/triggers.py line 332 in cleanup_trigger_db_for_rule Trigger.delete_if_unreferenced(existing_trigger_db) /home/runner/work/st2/st2/st2common/st2common/persistence/trigger.py line 61 in delete_if_unreferenced cls._get_impl().delete_by_query(**delete_query) /home/runner/work/st2/st2/st2common/st2common/models/db/__init__.py line 479 in delete_by_query super(self) TypeError: super() argument 1 must be type, not MongoDBAccess
Thanks for the pointer @nmaludy . Sorry have been out of loop on this project. I made the changes to call purge workflow and task executions in the garbagecollector . Please take a look : 36c7fdf With the above change I also added 2 new attributes Thanks again!
|
We just reformatted the code with |
Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue. |
@srimandaleeka01 I'd really like to see this in v3.6.0 if possible. Do you have bandwidth to bring this up-to-date with master? Both unit and lint failures are due to missing config options. You can add those here: st2/st2reactor/st2reactor/garbage_collector/config.py Lines 81 to 99 in 2a6ec4f
Sorry for the duplicate message. I was logged into the wrong github account. I just deleted the other message. |
Also, could you edit your PR description to include |
@srimandaleeka01 Would you be willing to allow maintainers to edit your PR? If so, I can quickly merge in master and adjust the config options for you. |
the criteria defined in the config. | ||
""" | ||
utc_now = get_datetime_utc_now() | ||
timestamp = (utc_now - datetime.timedelta(days=self._action_executions_ttl)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this should be _workflow_execution_ttl instead of actions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @amanda11 I will make this change.
the criteria defined in the config. | ||
""" | ||
utc_now = get_datetime_utc_now() | ||
timestamp = (utc_now - datetime.timedelta(days=self._action_executions_ttl)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this should be _task_execution_ttl instead of actions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this should be _task_execution_ttl instead of actions
Thank you @amanda11 will make this change.
@cognifloyd Please go ahead and the maintainers can edit the PR for getting it merged. Thank you! |
@cognifloyd I can update the PR, as I have taken this code made some slight changes and got it installed on a ST2 system. So happy to do update to master and merge those changes in. |
@srimandaleeka01 Could you check if maintainers have access to this PR request, as I'm getting 403 error trying to push. Please see: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork for info on how to allow maintainers to edit a PR that has been created from a fork. |
I was following the article above to allow mainters to edit the PR, however I don't see that option. Are there any specific changes apart from the comments you have posted for the PR ? If so please post the diff for the corresponding file , I can manually apply. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this PR. It will be really great to get this into the next release of StackStorm.
Just some minor other comments I found, in addition to fix the CircleCI then:
- Need to run black on the files changed, so that it doesn't break the lint checks
- Need to add the change to st2reactor/st2reactor/garbage_collector/config.py as mentioned earlier in review comments to prevent the UT failure to add the new config options.
Can you also update CHANGELOG.rst - to update the "Added" section to include details of this PR?
If need any assistance or want us to help with doing any of the amendments then just please let us know (we'd need the fork updated with permissions for maintainers to edit as I think at moment it's blocked). But if you are happy to do the changes there would be no need.
logger.exception('Deletion of execution models failed for query with filters: %s.', | ||
exec_filters) | ||
else: | ||
logger.info('Deleted %s action execution objects' % deleted_count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to change logger to workflow execution objects not "action execution objects", and other references to action in this method.
logger.exception('Deletion of execution models failed for query with filters: %s.', | ||
exec_filters) | ||
else: | ||
logger.info('Deleted %s action execution objects' % deleted_count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to change logger to task execution objects not "action execution objects", and other references to actiosn or action executions in this method.
@@ -0,0 +1,88 @@ | |||
# Copyright 2019 Extreme Networks, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright is now StackStorm Authors, and year file first introduced, e.g. could you change to:
Copyright 2021, The StackStorm Authors.
@@ -0,0 +1,88 @@ | |||
# Copyright 2019 Extreme Networks, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2021, The StackStorm Authors.
@@ -0,0 +1,160 @@ | |||
# Copyright 2020 Extreme Networks, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2021, The StackStorm Authors.
@@ -0,0 +1,72 @@ | |||
# Copyright 2019 Extreme Networks, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2021, The StackStorm Authors.
@@ -0,0 +1,72 @@ | |||
# Copyright 2019 Extreme Networks, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright 2021, The StackStorm Authors.
from datetime import timedelta | ||
|
||
from st2common import log as logging | ||
from st2common.constants.triggers import TRIGGER_INSTANCE_PROCESSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import of TRIGGER_INSTANCE_PROCESSED isn't used, so it breaks the CI checks.
from datetime import timedelta | ||
|
||
from st2common import log as logging | ||
from st2common.constants.triggers import TRIGGER_INSTANCE_PROCESSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As TRIGGER_INSTANCE_PROCESSED is unused it will break the CI checks, so can you remove this import.
filters['status'] = {'$in': DONE_STATES} | ||
|
||
exec_filters = copy.copy(filters) | ||
# TODO: Are these parameters valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment the action_ref passed in from the standalone tool, doesn't take affect - as its not used in this class. I don't believe action_ref is valid for WorkflowExecution or TaskExecution, so I would remove the commented out lines and also the action_ref in the cmd/purge_....py classes.
Hi - I've listed in that last review I think all the changes that I was going to make - just a few minor things like copyright, black formatting etc, and then I had a look at the TODO you had left around action_ref, and checked the collection contents - so think safest to remove the action_ref that was in the TODO whether it was relevant or not. |
@srimandaleeka01 Are you ok to sign the CLA Contribution Agreement? At the moment it is blocking the PR as the contribution agreement isn't signed. Do you have time to address the review comments this month, as we'd like to get this into the 3.7.0 PR. Alternatively, if the contribution agreement is signed, then we could fork off this repo and then merge a PR that way - and ask one of the TSC to make the review comments? Whichever you prefer. Thanks once again for the contribution. |
Closes #4939