fix: bound task failures and release stalled workers
This commit is contained in:
1 parent
606ed94160
commit
1fdf7c0d1d
32 files changed
+1121
-93
No files matched your search
@@ -12,6 +12,7 @@ from apps.admin_console.services.automation_store import identifier, store
|
||||
from apps.admin_console.services import automation_service as service
|
||||
from apps.admin_console.services import batch_archive as archive_service
|
||||
from apps.admin_console.services import report_export, task_import
|
||||
from artemis.config.settings import settings
|
||||
|
||||
router = APIRouter(prefix="/api/automation", tags=["automation"])
|
||||
|
||||
@@ -30,7 +31,7 @@ class BatchRequest(ReportPreferences):
|
||||
profile: Literal["flash", "pro"] = "flash"
|
||||
stop_on_failure: bool = False
|
||||
timeout_seconds: int = Field(
|
||||
default_factory=lambda: int(os.getenv("ARTEMIS_BATCH_TASK_TIMEOUT", "1800")),
|
||||
default_factory=lambda: settings.ARTEMIS_TASK_TIMEOUT_SECONDS,
|
||||
ge=30,
|
||||
le=86400,
|
||||
)
|
||||
@@ -50,7 +51,7 @@ def require(kind, key):
|
||||
def preferences():
|
||||
return {
|
||||
**store.preferences(),
|
||||
"batch_timeout_seconds": int(os.getenv("ARTEMIS_BATCH_TASK_TIMEOUT", "1800")),
|
||||
"batch_timeout_seconds": settings.ARTEMIS_TASK_TIMEOUT_SECONDS,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -202,7 +202,9 @@ async def run_task(request: RunRequest):
|
||||
# With no explicit serial the probe itself resolves a live target (it
|
||||
# prefers the diagnostics target preference, then any unlocked ready
|
||||
# device); the verified serial is bound below.
|
||||
target_serial = request.device_serial
|
||||
target_serial = (
|
||||
request.runtime_overrides.device_serial if request.runtime_overrides else None
|
||||
) or request.device_serial
|
||||
device_probe = await readiness_engine.run_device_submission_probe(target_serial=target_serial)
|
||||
if device_probe and device_probe.summary in {"Device Locked", "Lock State Unknown"}:
|
||||
locked_serial = (
|
||||
@@ -224,7 +226,7 @@ async def run_task(request: RunRequest):
|
||||
# Only auto-selected targets may be re-bound to the probed device. An
|
||||
# explicitly requested serial is never silently replaced -- if it is
|
||||
# invalid, enqueue_tasks rejects the submission with a clear error.
|
||||
if verified_serial and not request.device_serial:
|
||||
if verified_serial and not target_serial:
|
||||
target_serial = verified_serial
|
||||
|
||||
response = await task_queue_service.enqueue_tasks(
|
||||
@@ -240,6 +242,9 @@ async def run_task(request: RunRequest):
|
||||
ingress=request.ingress or "frontend",
|
||||
session_id=request.session_id,
|
||||
conversation_id=request.conversation_id,
|
||||
runtime_overrides=request.runtime_overrides.model_dump(exclude_none=True)
|
||||
if request.runtime_overrides
|
||||
else None,
|
||||
)
|
||||
|
||||
from apps.admin_console.services.automation_service import register_submission
|
||||
|
||||
Reference in new issue
Block a user