Simplify python-tools task configuration
Build custom container images / build (map[base_image:php:8-fpm-alpine build_args:PHP_VERSION=8
context:php8-pgsql fingerprint_command:{ apk info -v | LC_ALL=C sort; find /usr/local/lib/php/extensions /usr/local/etc/php/conf.d -type f -exec sha256sum {} + | LC_ALL=C sort; }
name:ph… (push) Successful in 42s
Build custom container images / build (map[base_image:postgres:18 build_args:PG_VERSION=18
POSTGIS_VERSION=3
VCHORD_VERSION=0.5.3
context:postgres fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; find /usr/lib/postgresql -type f -exec sha256su… (push) Successful in 53s
Build custom container images / build (map[base_image:python:3 build_args:PYTHON_VERSION=3
context:python-tools fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:python-tools oci_labels:org.opencontainers.ima… (push) Successful in 1m18s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:linkki-tiedotus fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:linkki-tiedotus oci_labels:… (push) Successful in 26s
Build custom container images / build (map[base_image:php:8-fpm-alpine build_args:PHP_VERSION=8
context:php8-pgsql fingerprint_command:{ apk info -v | LC_ALL=C sort; find /usr/local/lib/php/extensions /usr/local/etc/php/conf.d -type f -exec sha256sum {} + | LC_ALL=C sort; }
name:ph… (push) Successful in 42s
Build custom container images / build (map[base_image:postgres:18 build_args:PG_VERSION=18
POSTGIS_VERSION=3
VCHORD_VERSION=0.5.3
context:postgres fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; find /usr/lib/postgresql -type f -exec sha256su… (push) Successful in 53s
Build custom container images / build (map[base_image:python:3 build_args:PYTHON_VERSION=3
context:python-tools fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:python-tools oci_labels:org.opencontainers.ima… (push) Successful in 1m18s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:linkki-tiedotus fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:linkki-tiedotus oci_labels:… (push) Successful in 26s
This commit is contained in:
@@ -77,6 +77,19 @@ def test_tasks_in_one_group_are_serialized_and_groups_overlap(manager: RunManage
|
||||
]
|
||||
|
||||
|
||||
def test_cleanup_removes_state_for_a_removed_group_after_a_grace_period(manager: RunManager) -> None:
|
||||
write_task(manager.settings.task_root, "active", "task.py", 'print("active")\n')
|
||||
removed = manager.settings.state_root / "tasks" / "removed"
|
||||
removed.mkdir(parents=True)
|
||||
(removed / "state.json").write_text("{}\n", encoding="utf-8")
|
||||
|
||||
manager.cleanup_transient_files(orphaned_task_state_retention_seconds=60)
|
||||
assert removed.is_dir()
|
||||
|
||||
manager.cleanup_transient_files(orphaned_task_state_retention_seconds=0)
|
||||
assert not removed.exists()
|
||||
|
||||
|
||||
def test_group_stops_after_failed_task(manager: RunManager) -> None:
|
||||
root = manager.settings.task_root
|
||||
write_task(root, "workflow", "01_ok.py", '"""Works."""\nprint("ok")\n')
|
||||
@@ -170,11 +183,10 @@ data = json.loads(Path(os.environ["SERVER_MAINTENANCE_INPUT"]).read_text())
|
||||
assert stored.input_json == '{"attempts":2,"identifier":"AB123"}'
|
||||
|
||||
|
||||
def test_task_receives_only_explicitly_forwarded_environment(
|
||||
def test_task_does_not_receive_parent_environment(
|
||||
manager: RunManager,
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
monkeypatch.setenv("SERVER_MAINTENANCE_TASK_ENV", "TASK_SETTING")
|
||||
monkeypatch.setenv("TASK_SETTING", "available")
|
||||
monkeypatch.setenv("UNRELATED_SETTING", "hidden")
|
||||
root = manager.settings.task_root
|
||||
@@ -182,7 +194,7 @@ def test_task_receives_only_explicitly_forwarded_environment(
|
||||
root,
|
||||
"environment",
|
||||
"read_environment.py",
|
||||
'''"""Reads forwarded configuration."""
|
||||
'''"""Reads the task environment."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
@@ -198,7 +210,32 @@ state = Path(os.environ["SERVER_MAINTENANCE_STATE"])
|
||||
|
||||
assert wait_for(manager, run.id, {"succeeded"}) == "succeeded"
|
||||
assert (manager.settings.state_root / "tasks" / "environment" / "environment.txt").read_text() == (
|
||||
"available:"
|
||||
":"
|
||||
)
|
||||
|
||||
|
||||
def test_task_receives_application_state_root(manager: RunManager) -> None:
|
||||
root = manager.settings.task_root
|
||||
write_task(
|
||||
root,
|
||||
"environment",
|
||||
"read_state_root.py",
|
||||
'''"""Reads the application state root."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
Path(os.environ["SERVER_MAINTENANCE_STATE"]).joinpath("state-root.txt").write_text(
|
||||
os.environ["SERVER_MAINTENANCE_STATE_ROOT"])
|
||||
''',
|
||||
)
|
||||
task = TaskCatalog(root).task("environment/read_state_root.py")
|
||||
assert task is not None
|
||||
|
||||
run, _ = manager.run_task(task)
|
||||
|
||||
assert wait_for(manager, run.id, {"succeeded"}) == "succeeded"
|
||||
assert (manager.settings.state_root / "tasks" / "environment" / "state-root.txt").read_text() == str(
|
||||
manager.settings.state_root
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user