Simplify task input handling and tighten runner coordination
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 50s
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 50s
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 1m37s
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 36s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:timepoll fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:timepoll oci_labels:org.opencontai… (push) Successful in 42s
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 50s
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 50s
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 1m37s
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 36s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:timepoll fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:timepoll oci_labels:org.opencontai… (push) Successful in 42s
This commit is contained in:
1 parent
3bfd199b9c
commit
1c713ff635
7 files changed
+130
-67
No files matched your search
@@ -1,6 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
import threading
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from dataclasses import replace
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
@@ -379,3 +381,38 @@ def test_upload_is_removed_when_task_process_cannot_start(manager: RunManager) -
|
||||
assert created is True
|
||||
assert wait_for(broken_manager, run.id, {"failed"}) == "failed"
|
||||
assert not (broken_manager.settings.state_root / "runs" / f"{run.id}.uploads").exists()
|
||||
|
||||
|
||||
def test_idle_worker_cannot_start_before_uploaded_input_is_ready(manager, monkeypatch):
|
||||
write_task(manager.settings.task_root, "imports", "read.py", '''
|
||||
import json, os
|
||||
from pathlib import Path
|
||||
values = json.loads(Path(os.environ["SERVER_MAINTENANCE_INPUT"]).read_text())
|
||||
assert Path(values["document"]).read_text() == "uploaded content"
|
||||
''')
|
||||
task = manager.catalog.task("imports/read.py")
|
||||
manager._wake_worker(task.group_id)
|
||||
saving = threading.Event()
|
||||
release = threading.Event()
|
||||
save_uploads = manager._save_uploads
|
||||
|
||||
def slow_upload(run_id, uploads):
|
||||
saving.set()
|
||||
assert release.wait(5)
|
||||
return save_uploads(run_id, uploads)
|
||||
|
||||
monkeypatch.setattr(manager, '_save_uploads', slow_upload)
|
||||
upload = PendingUpload('document', '.txt', 1024, BytesIO(b'uploaded content'))
|
||||
with ThreadPoolExecutor() as pool:
|
||||
submitted = pool.submit(manager.run_task, task, uploads={'document': upload})
|
||||
try:
|
||||
assert saving.wait(5)
|
||||
run = manager.store.active_runs()[0]
|
||||
manager._wake_events[task.group_id].set()
|
||||
time.sleep(.1)
|
||||
assert manager.store.get(run.id).status == 'queued'
|
||||
finally:
|
||||
release.set()
|
||||
run, created = submitted.result(timeout=5)
|
||||
assert created
|
||||
assert wait_for(manager, run.id, {'succeeded', 'failed'}) == 'succeeded'
|
||||
Reference in new issue
Block a user