Skip to content
Open
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
104 changes: 30 additions & 74 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@ install-runners:
@echo ""
# NOTE: We use xargs to speed things up by installing runners in parallel
echo -e "$(COMPONENTS_RUNNERS)" | tr -d "\n" | xargs -P $(XARGS_CONCURRENCY) -d " " -n1 -i bash -c "set -x; . $(VIRTUALENV_DIR)/bin/activate; cd $$(pwd)/{} ; $(PYBIN) -m pip install --editable . --no-deps"
#@for component in $(COMPONENTS_RUNNERS); do \
# echo "==========================================================="; \
# echo "Installing runner:" $$component; \
# echo "==========================================================="; \
# #(. $(VIRTUALENV_DIR)/bin/activate; cd $$component; python -m pip install --editable . --no-deps); \
#done

.PHONY: install-mock-runners
install-mock-runners:
Expand All @@ -198,12 +192,6 @@ install-mock-runners:
@echo ""
# NOTE: We use xargs to speed things up by installing runners in parallel
echo -e "$(MOCK_RUNNERS)" | tr -d "\n" | xargs -P $(XARGS_CONCURRENCY) -d " " -n1 -i sh -c ". $(VIRTUALENV_DIR)/bin/activate; cd $$(pwd)/{} ; $(PYBIN) -m pip install --editable . --no-deps"
#@for component in $(MOCK_RUNNERS); do \
# echo "==========================================================="; \
# echo "Installing mock runner:" $$component; \
# echo "==========================================================="; \
# (. $(VIRTUALENV_DIR)/bin/activate; cd $$component; python -m pip install --editable . --no-deps); \
#done

.PHONY: check-requirements
.check-requirements:
Expand Down Expand Up @@ -267,7 +255,7 @@ check-python-packages:
echo "==========================================================="; \
echo "Checking component:" $$component; \
echo "==========================================================="; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) setup.py --version) || exit 1; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) -m setuptools_scm) || exit 1; \
done

.PHONY: check-python-packages-nightly
Expand All @@ -284,8 +272,8 @@ check-python-packages-nightly:
echo "==========================================================="; \
echo "Checking component:" $$component; \
echo "==========================================================="; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) setup.py --version) || exit 1; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) setup.py sdist bdist_wheel) || exit 1; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) -m setuptools_scm) || exit 1; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) -m build) || exit 1; \
(set -e; cd $$component; ../$(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) -m pip install --editable . --no-deps) || exit 1; \
($(VIRTUALENV_COMPONENTS_DIR)/bin/$(PYBIN) -c "import $$component") || exit 1; \
(set -e; cd $$component; rm -rf dist/; rm -rf $$component.egg-info) || exit 1; \
Expand Down Expand Up @@ -662,13 +650,6 @@ distclean: clean
scripts/write-headers.sh $$component/dist_utils.py || break;\
done

# Copy over CHANGELOG.RST, CONTRIBUTING.RST and LICENSE file to each component directory
#@for component in $(COMPONENTS_TEST); do\
# test -s $$component/README.rst || cp -f README.rst $$component/; \
# cp -f CONTRIBUTING.rst $$component/; \
# cp -f LICENSE $$component/; \
#done

.PHONY: .requirements
.requirements: virtualenv
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --upgrade "pip==$(PIP_VERSION)"
Expand All @@ -681,16 +662,10 @@ distclean: clean
# Remove any *.egg-info files which polute PYTHONPATH
rm -rf *.egg-info*

# Generate finall requirements.txt file for each component
# Generate final requirements.txt file for each component
# NOTE: We use xargs to speed things up by running commands in parallel
echo -e "$(COMPONENTS_WITH_RUNNERS)" | tr -d "\n" | xargs -P $(XARGS_CONCURRENCY) -d " " -n1 -i sh -c "$(VIRTUALENV_DIR)/bin/$(PYBIN) scripts/fixate-requirements.py --skip=virtualenv,virtualenv-osx -s {}/in-requirements.txt -f fixed-requirements.txt -o {}/requirements.txt"

#@for component in $(COMPONENTS_WITH_RUNNERS); do\
# echo "==========================================================="; \
# echo "Generating requirements.txt for" $$component; \
# $(VIRTUALENV_DIR)/bin/python scripts/fixate-requirements.py --skip=virtualenv,virtualenv-osx -s $$component/in-requirements.txt -f fixed-requirements.txt -o $$component/requirements.txt; \
#done

@echo "==========================================================="

.PHONY: requirements
Expand Down Expand Up @@ -781,21 +756,6 @@ endif
echo 'export PYTHONPATH' >> $(VIRTUALENV_DIR)/bin/activate
touch $(VIRTUALENV_DIR)/bin/activate

# Setup PYTHONPATH in fish activate script...
#echo '' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo 'set -gx _OLD_PYTHONPATH $$PYTHONPATH' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo 'set -gx PYTHONPATH $$_OLD_PYTHONPATH $(COMPONENT_PYTHONPATH)' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo 'functions -c deactivate old_deactivate' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo 'function deactivate' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo ' if test -n $$_OLD_PYTHONPATH' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo ' set -gx PYTHONPATH $$_OLD_PYTHONPATH' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo ' set -e _OLD_PYTHONPATH' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo ' end' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo ' old_deactivate' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo ' functions -e old_deactivate' >> $(VIRTUALENV_DIR)/bin/activate.fish
#echo 'end' >> $(VIRTUALENV_DIR)/bin/activate.fish
#touch $(VIRTUALENV_DIR)/bin/activate.fish

# debug pip installed packages
$(VIRTUALENV_DIR)/bin/pip list

Expand Down Expand Up @@ -867,7 +827,7 @@ endif
@echo
@echo "----- Dropping st2-test db -----"
@mongosh st2-test --eval "db.dropDatabase();"
failed=0; \
failed=(); \
for component in $(COMPONENTS_TEST); do\
echo "==========================================================="; \
echo "Running tests in" $$component; \
Expand All @@ -878,13 +838,13 @@ endif
ST2TESTS_REDIS_PORT=$(ST2TESTS_REDIS_PORT) \
COVERAGE_FILE=.coverage.unit.$$(echo $$component | tr '/' '.') \
pytest --verbose $(PYTEST_OPTS) --cov=$$component --cov-branch \
$$component/tests/unit || ((failed+=1)); \
$$component/tests/unit || failed+=($$component); \
echo "-----------------------------------------------------------"; \
echo "Done running tests in" $$component; \
echo "==========================================================="; \
done; \
echo pytest runs failed=$$failed; \
if [ $$failed -gt 0 ]; then exit 1; fi
echo "pytest runs failed=$${failed[@]}"; \
if [ $${#failed[@]} -gt 0 ]; then exit 1; fi

.PHONY: .combine-unit-tests-coverage
.combine-unit-tests-coverage: .run-unit-tests-coverage
Expand Down Expand Up @@ -929,21 +889,21 @@ itests: requirements .itests
@echo
@echo "----- Dropping st2-test db -----"
@mongosh st2-test --eval "db.dropDatabase();"
@failed=0; \
@failed=(); \
for component in $(COMPONENTS_TEST); do\
echo "==========================================================="; \
echo "Running integration tests in" $$component; \
echo "-----------------------------------------------------------"; \
. $(VIRTUALENV_DIR)/bin/activate; \
EVENTLET_TESTS=1 \
pytest --capture=no --verbose $(PYTEST_OPTS) \
$$component/tests/integration || ((failed+=1)); \
$$component/tests/integration || failed+=($$component); \
echo "-----------------------------------------------------------"; \
echo "Done running integration tests in" $$component; \
echo "==========================================================="; \
done; \
echo pytest runs failed=$$failed; \
if [ $$failed -gt 0 ]; then exit 1; fi
echo "pytest runs failed=$${failed[@]}"; \
if [ $${#failed[@]} -gt 0 ]; then exit 1; fi

.PHONY: .run-integration-tests-coverage
ifdef INCLUDE_TESTS_IN_COVERAGE
Expand All @@ -955,7 +915,7 @@ endif
@echo
@echo "----- Dropping st2-test db -----"
@mongosh st2-test --eval "db.dropDatabase();"
@failed=0; \
@failed=(); \
for component in $(COMPONENTS_TEST); do\
echo "==========================================================="; \
echo "Running integration tests in" $$component; \
Expand All @@ -964,13 +924,13 @@ endif
EVENTLET_TESTS=1 \
COVERAGE_FILE=.coverage.integration.$$(echo $$component | tr '/' '.') \
pytest --capture=no --verbose $(PYTEST_OPTS) --cov=$$component --cov-branch \
$$component/tests/integration || ((failed+=1)); \
$$component/tests/integration || failed+=($$component); \
echo "-----------------------------------------------------------"; \
echo "Done integration running tests in" $$component; \
echo "==========================================================="; \
done; \
echo pytest runs failed=$$failed; \
if [ $$failed -gt 0 ]; then exit 1; fi
echo "pytest runs failed=$${failed[@]}"; \
if [ $${#failed[@]} -gt 0 ]; then exit 1; fi
# NOTE: If you also want to run orquesta tests which seem to have a bunch of race conditions, use
# ci-integration-full target
# @echo
Expand Down Expand Up @@ -1039,13 +999,6 @@ endif
make .coverage-combine; \
fi

# @for coverage_result in $(COVERAGE_GLOBS); do \
# [ -e $${coverage_result} ] || echo "$${coverage_result} does not exist." && continue; \
# echo "Combining data from $${coverage_result}"; \
# . $(VIRTUALENV_DIR)/bin/activate; coverage combine $${coverage_result}; \
# done || \
# (echo "Running .coverage-combine"; make .coverage-combine)

.PHONY: .coverage-report
.coverage-report: .coverage
. $(VIRTUALENV_DIR)/bin/activate; coverage report
Expand Down Expand Up @@ -1096,14 +1049,16 @@ runners-tests: requirements .runners-tests
@echo
@echo "----- Dropping st2-test db -----"
@mongosh st2-test --eval "db.dropDatabase();"
@failed=0; \
@failed=(); \
for component in $(COMPONENTS_RUNNERS); do\
echo "==========================================================="; \
echo "Running tests in" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) $$component/tests/unit || ((failed+=1)); \
. $(VIRTUALENV_DIR)/bin/activate; \
pytest --capture=no --verbose $(PYTEST_OPTS) $$component/tests/unit || failed+=($$component); \
done; \
if [ $$failed -gt 0 ]; then exit 1; fi
echo "pytest runs failed=$${failed[@]}"; \
if [ $${#failed[@]} -gt 0 ]; then exit 1; fi

.PHONY: runners-itests
runners-itests: requirements .runners-itests
Expand All @@ -1114,32 +1069,33 @@ runners-itests: requirements .runners-itests
@echo "==================== runners-itests ===================="
@echo
@echo "----- Dropping st2-test db -----"
@failed=0; \
@failed=(); \
for component in $(COMPONENTS_RUNNERS); do\
echo "==========================================================="; \
echo "Running integration tests in" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) $$component/tests/integration || ((failed+=1)); \
. $(VIRTUALENV_DIR)/bin/activate; \
pytest --capture=no --verbose $(PYTEST_OPTS) $$component/tests/integration || failed+=($$component); \
done; \
echo pytest runs failed=$$failed; \
if [ $$failed -gt 0 ]; then exit 1; fi
echo "pytest runs failed=$${failed[@]}"; \
if [ $${#failed[@]} -gt 0 ]; then exit 1; fi

.PHONY: .runners-itests-coverage-html
.runners-itests-coverage-html:
@echo
@echo "============== runners-itests-coverage-html =============="
@echo
@echo "The tests assume st2 is running on 127.0.0.1."
@failed=0; \
@failed=(); \
for component in $(COMPONENTS_RUNNERS); do\
echo "==========================================================="; \
echo "Running integration tests in" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) \
--cov=$$component --cov-report=html $$component/tests/integration || ((failed+=1)); \
--cov=$$component --cov-report=html $$component/tests/integration || failed+=($$component); \
done; \
echo pytest runs failed=$$failed; \
if [ $$failed -gt 0 ]; then exit 1; fi
echo "pytest runs failed=$${failed[@]}"; \
if [ $${#failed[@]} -gt 0 ]; then exit 1; fi

.PHONY: cli
cli:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from __future__ import absolute_import

import eventlet
import traceback
import uuid
import datetime
Expand All @@ -24,6 +23,7 @@
from jsonschema import exceptions as json_schema_exc
from oslo_config import cfg

from st2common.util import concurrency
from st2common.runners.base import ActionRunner
from st2common.runners.base import get_metadata as get_runner_metadata
from st2common import log as logging
Expand Down Expand Up @@ -879,7 +879,7 @@ def _run_action(self, liveaction, wait_for_completion=True, sleep_delay=1.0):
action_constants.LIVEACTION_STATUS_PENDING,
]
):
eventlet.sleep(sleep_delay)
concurrency.sleep(sleep_delay)
liveaction = action_db_util.get_liveaction_by_id(liveaction.id)

return liveaction
Expand All @@ -901,7 +901,7 @@ def _resume_action(self, liveaction, wait_for_completion=True, sleep_delay=1.0):
action_constants.LIVEACTION_COMPLETED_STATES
+ [action_constants.LIVEACTION_STATUS_PAUSED]
):
eventlet.sleep(sleep_delay)
concurrency.sleep(sleep_delay)
liveaction = action_db_util.get_liveaction_by_id(liveaction.id)

return liveaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# limitations under the License.

from __future__ import absolute_import
import eventlet
import mock

from st2common.util import concurrency
import os
import tempfile

Expand Down Expand Up @@ -98,7 +99,7 @@ def _wait_for_children(self, execution, interval=0.1, retries=100):
for i in range(0, retries):
execution = ActionExecution.get_by_id(str(execution.id))
if len(getattr(execution, "children", [])) <= 0:
eventlet.sleep(interval)
concurrency.sleep(interval)
continue

return execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
# limitations under the License.

from __future__ import absolute_import
import eventlet
import mock

from st2common.util import concurrency

from st2common.bootstrap import actionsregistrar
from st2common.bootstrap import runnersregistrar
from st2common.constants import action as action_constants
Expand Down Expand Up @@ -221,7 +222,7 @@ def _wait_for_children(
% (expected_children, found_children)
)

eventlet.sleep(interval)
concurrency.sleep(interval)

found_children = len(getattr(execution, "children", []))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# limitations under the License.

from __future__ import absolute_import
import eventlet
import mock

from st2common.util import concurrency
import os
import tempfile

Expand Down Expand Up @@ -120,7 +121,7 @@ def _wait_for_status(self, liveaction, status, interval=0.1, retries=100):
for i in range(0, retries):
liveaction = LiveAction.get_by_id(str(liveaction.id))
if liveaction.status != status:
eventlet.sleep(interval)
concurrency.sleep(interval)
continue
else:
break
Expand All @@ -132,7 +133,7 @@ def _wait_for_children(self, execution, interval=0.1, retries=100):
for i in range(0, retries):
execution = ActionExecution.get_by_id(str(execution.id))
if len(getattr(execution, "children", [])) <= 0:
eventlet.sleep(interval)
concurrency.sleep(interval)
continue

return execution
Expand Down
11 changes: 5 additions & 6 deletions fixed-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ apscheduler==3.11.0
chardet==5.2.0
cffi==1.17.1
cryptography==43.0.3
# Gunicorn <26 requires eventlet>=0.40.3
eventlet==0.40.3
eventlet==0.40.4
# Note: installs gitpython==3.1.37 (security fixed) under py3.8 and gitpython==3.1.18 (latest available, vulnerable) under py3.6
gitpython==3.1.45
# Needed by gitpython, old versions used to bundle it
gitdb==4.0.12
# Note: greenlet is used by eventlet
greenlet==3.1.1
# Gunicorn dropped eventlet support as of v26. https://gunicorn.org/news/#2600-2026-05-05
gunicorn<26
gevent==25.9.1
# Note: greenlet is used by eventlet & gevent (3.2.2 is the minimum common version)
greenlet==3.2.2
gunicorn==23.0.0
# importlib backport replaces setuptool's pkg_resource.
importlib_resources==6.5.2
importlib_metadata==9.0.0
Expand Down
Loading
Loading