From e56b58f1c6b349c91d8d553f4b523202d01a963b Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 7 Mar 2023 16:32:56 -0600 Subject: [PATCH 1/5] fix copy pasta in st2common purge command descriptions And drop the pointless execute bit. The execute bit is only needed on the scripts in st2common/bin, not the underlying python files. --- st2common/st2common/cmd/purge_executions.py | 0 st2common/st2common/cmd/purge_rule_enforcements.py | 2 +- st2common/st2common/cmd/purge_tokens.py | 3 +-- st2common/st2common/cmd/purge_traces.py | 3 +-- st2common/st2common/cmd/purge_trigger_instances.py | 0 5 files changed, 3 insertions(+), 5 deletions(-) mode change 100755 => 100644 st2common/st2common/cmd/purge_executions.py mode change 100755 => 100644 st2common/st2common/cmd/purge_rule_enforcements.py mode change 100755 => 100644 st2common/st2common/cmd/purge_tokens.py mode change 100755 => 100644 st2common/st2common/cmd/purge_traces.py mode change 100755 => 100644 st2common/st2common/cmd/purge_trigger_instances.py diff --git a/st2common/st2common/cmd/purge_executions.py b/st2common/st2common/cmd/purge_executions.py old mode 100755 new mode 100644 diff --git a/st2common/st2common/cmd/purge_rule_enforcements.py b/st2common/st2common/cmd/purge_rule_enforcements.py old mode 100755 new mode 100644 index adbe0c0ab7..9e9eeabfd5 --- a/st2common/st2common/cmd/purge_rule_enforcements.py +++ b/st2common/st2common/cmd/purge_rule_enforcements.py @@ -14,7 +14,7 @@ """ -A utility script that purges trigger instances older than certain +A utility script that purges rule enforcements older than certain timestamp. *** RISK RISK RISK. You will lose data. Run at your own risk. *** diff --git a/st2common/st2common/cmd/purge_tokens.py b/st2common/st2common/cmd/purge_tokens.py old mode 100755 new mode 100644 index 6d51ad4155..4bab34c5f4 --- a/st2common/st2common/cmd/purge_tokens.py +++ b/st2common/st2common/cmd/purge_tokens.py @@ -14,8 +14,7 @@ """ -A utility script that purges trigger instances older than certain -timestamp. +A utility script that purges tokens older than certain timestamp. *** RISK RISK RISK. You will lose data. Run at your own risk. *** """ diff --git a/st2common/st2common/cmd/purge_traces.py b/st2common/st2common/cmd/purge_traces.py old mode 100755 new mode 100644 index 37b848d6f1..3de620945d --- a/st2common/st2common/cmd/purge_traces.py +++ b/st2common/st2common/cmd/purge_traces.py @@ -14,8 +14,7 @@ """ -A utility script that purges trigger instances older than certain -timestamp. +A utility script that purges traces older than certain timestamp. *** RISK RISK RISK. You will lose data. Run at your own risk. *** """ diff --git a/st2common/st2common/cmd/purge_trigger_instances.py b/st2common/st2common/cmd/purge_trigger_instances.py old mode 100755 new mode 100644 From 6298487e80926be736317f073c0841a8bcf41059 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 6 Mar 2023 16:00:18 -0600 Subject: [PATCH 2/5] avoid using meta package with re-exported symbols Make it clearer where things come from so tracking things down is easier. --- contrib/packs/actions/pack_mgmt/unload.py | 8 ++++---- st2reactor/st2reactor/rules/tester.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/contrib/packs/actions/pack_mgmt/unload.py b/contrib/packs/actions/pack_mgmt/unload.py index 46caf9cc7a..b26182329d 100644 --- a/contrib/packs/actions/pack_mgmt/unload.py +++ b/contrib/packs/actions/pack_mgmt/unload.py @@ -20,13 +20,13 @@ from st2common.persistence.pack import Pack from st2common.persistence.pack import ConfigSchema from st2common.persistence.pack import Config -from st2common.persistence.reactor import SensorType -from st2common.persistence.reactor import TriggerType -from st2common.persistence.reactor import Trigger -from st2common.persistence.reactor import Rule from st2common.persistence.action import Action from st2common.persistence.action import ActionAlias from st2common.persistence.policy import Policy +from st2common.persistence.rule import Rule +from st2common.persistence.sensor import SensorType +from st2common.persistence.trigger import Trigger +from st2common.persistence.trigger import TriggerType from st2common.constants.pack import SYSTEM_PACK_NAMES from st2common.services.triggers import cleanup_trigger_db_for_rule from st2common.exceptions.db import StackStormDBObjectNotFoundError diff --git a/st2reactor/st2reactor/rules/tester.py b/st2reactor/st2reactor/rules/tester.py index da4e3572c5..51c57322df 100644 --- a/st2reactor/st2reactor/rules/tester.py +++ b/st2reactor/st2reactor/rules/tester.py @@ -27,7 +27,8 @@ from st2common.models.db.trigger import TriggerDB from st2common.models.db.trigger import TriggerInstanceDB from st2common.models.system.common import ResourceReference -from st2common.persistence.reactor import Rule, TriggerInstance, Trigger +from st2common.persistence.rule import Rule +from st2common.persistence.trigger import Trigger, TriggerInstance from st2reactor.rules.enforcer import RuleEnforcer from st2reactor.rules.matcher import RulesMatcher From 622acd9355334ef2aed033eddce14267d9553125 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 7 Mar 2023 21:32:23 -0600 Subject: [PATCH 3/5] simplify BUILD dep with relative path --- contrib/packs/tests/BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/packs/tests/BUILD b/contrib/packs/tests/BUILD index 527afdac71..5d5a44ba64 100644 --- a/contrib/packs/tests/BUILD +++ b/contrib/packs/tests/BUILD @@ -4,7 +4,7 @@ python_tests( "test_action_download.py": { "dependencies": [ # imports tests.fixtures which is ambiguous. Tell pants which one to use. - "contrib/packs/tests/fixtures", + "./fixtures", ], } }, From 8580313e970e1b521a296bd5bc14f8abbbf6534c Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 7 Mar 2023 21:34:00 -0600 Subject: [PATCH 4/5] chore: add comments on how to regen st2 lockfile in: - lockfiles/st2-constraints.txt - requirements-pants.txt --- lockfiles/st2-constraints.txt | 1 + requirements-pants.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/lockfiles/st2-constraints.txt b/lockfiles/st2-constraints.txt index 1383a2af96..168f81f6de 100644 --- a/lockfiles/st2-constraints.txt +++ b/lockfiles/st2-constraints.txt @@ -1,5 +1,6 @@ # Add/remove version constraints for transitive dependencies in this file # (transitive dependencies are dependencies of our direct dependencies). +# Then run `./pants generate-lockfiles --resolve=st2` to regenerate the lockfile. # # Direct dependencies should be recorded in `requirements-pants.txt`, not here. diff --git a/requirements-pants.txt b/requirements-pants.txt index f712a48a10..4ae0215ce0 100644 --- a/requirements-pants.txt +++ b/requirements-pants.txt @@ -1,4 +1,5 @@ # Add/remove direct 3rd party dependencies here, with version constraints if necessary. +# Then run `./pants generate-lockfiles --resolve=st2` to regenerate the lockfile. # # Please do not add transitive dependencies in this file (ie dependencies of our dependencies). # Use `lockfiles/st2-constraints.txt` to constrain the version of these transitive dependencies. From f4babd208a8aa13f6535d8480978e78732fa9365 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 7 Mar 2023 21:49:50 -0600 Subject: [PATCH 5/5] update changelog entry --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 84005045a0..5683d412f0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,7 +16,7 @@ Added to pants' use of PEX lockfiles. This is not a user-facing addition. #5778 #5789 #5817 #5795 #5830 #5833 #5834 #5841 #5840 #5838 #5842 #5837 #5849 #5850 #5846 #5853 #5848 #5847 #5858 #5857 #5860 #5868 #5871 #5864 #5874 #5884 #5893 #5891 - #5890 #5898 #5901 #5906 #5899 #5907 #5909 + #5890 #5898 #5901 #5906 #5899 #5907 #5909 #5922 Contributed by @cognifloyd * Added a joint index to solve the problem of slow mongo queries for scheduled executions. #5805