Allow uploaded review files to be reused for execution
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 38s
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 49s
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 1m15s
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 25s
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 33s

This commit is contained in:
ajp_anton committed 2026-10-27 04:10:10 +00:00
1 parent 55bbbe2fd7
commit 034fecbd51
4 files changed
+213 -16

No files matched your search

+21 -12
View File
@@ -5,6 +5,7 @@ from __future__ import annotations
import codecs
import ipaddress
import json
from contextlib import ExitStack
from datetime import datetime
from pathlib import Path
@@ -12,7 +13,7 @@ from flask import Flask, abort, redirect, render_template, request, send_file, u
from .config import Settings
from .discovery import TaskCatalog
from .inputs import validate_inputs, validate_uploads
from .inputs import PendingUpload, validate_inputs, validate_uploads
from .runner import RunManager
from .scheduler import BackgroundScheduler
from .store import RunStore
@@ -154,15 +155,7 @@ def create_app(settings: Settings | None = None) -> Flask:
task = catalog.task(run.target_path)
if task is None or task.execution is None:
return None
if any(field.type == "file" or field.sensitive for field in task.inputs):
return None
try:
input_data = json.loads(run.input_json)
except json.JSONDecodeError:
return None
if not isinstance(input_data, dict):
return None
if input_data.get(task.execution.field.name) != task.execution.dry_run_value:
if manager.review_upload_paths(run, task) is None:
return None
return task
@@ -177,13 +170,29 @@ def create_app(settings: Settings | None = None) -> Flask:
input_data = json.loads(run.input_json)
input_data[task.execution.field.name] = task.execution.execute_value
raw_values = {
name: [str(value) for value in value] if isinstance(value, list) else [str(value)]
name: ([str(item) for item in value] or [""]) if isinstance(value, list) else [str(value)]
for name, value in input_data.items()
}
validated, errors = validate_inputs(task.inputs, raw_values)
if errors:
abort(409)
executed, _ = manager.run_task(task, validated)
paths = manager.review_upload_paths(run, task)
if paths is None:
abort(409, description="The reviewed upload is no longer available. Upload the file and review again.")
with ExitStack() as stack:
uploads = {}
for field in task.inputs:
if field.name not in paths:
continue
path = paths[field.name]
try:
stream = stack.enter_context(path.open("rb"))
except OSError:
abort(409, description="The reviewed upload is no longer available. Upload the file and review again.")
uploads[field.name] = PendingUpload(field.name, path.suffix, field.maximum_bytes, stream)
executed, created = manager.run_task(task, validated, uploads)
if created and executed.status == "queued":
manager.discard_review_uploads(run.id)
return redirect(url_for("run_detail", run_id=executed.id))
@app.post("/runs/<int:run_id>/cancel")