<span id="创建调度与结果恢复"></span>

# Creation, scheduling, and result recovery

Save a queryable job first, then start it and read terminal state. One successful HTTP response does not replace subsequent state checks.

<span id="创建与重放"></span>

## Creation and replay

request_id is in the body and workspace-scoped. The same ID returns the original job if base model, normalized train/validation sets, recipe, and compute instance digest match; changed inputs may cause409. Retain the original recipe and identifier. Arbitrary semantically equivalent JSON reorderings are not guaranteed the same digest.

launch is excluded from the creation digest. launch=true calls launch after saving. If launch fails, the job may already be persisted or failed. For recovery, retain request_id/training parameters and replay creation with launch=false to obtain the existing job_id, then GET it. Do not repeatedly schedule with launch=true or switch identifiers to create duplicates.

<span id="启动与工作流关联"></span>

## Launch and workflow association

Launch first reads/completes training inputs and conditionally writes a claim identifier. Claiming may write running/started_at, which do not prove Worker receipt. It then prepares, binds, and wakes the workflow. Only afterward do mowl_task_id/case_id become actual associations.

With a real existing binding, the service returns or advances the existing job rather than creating another training. Concurrent claims may return the current record. launching:-prefixed claim values are internal placeholders, not callable workflow task/case IDs. Preparation/binding/wake failures attempt to mark failed; read the job after an error.

The creator actor is used for Catalog trace reads. Runtime WorkItems restore formal continuation identity and validate the task workspace. Workspace create privileges, original task identity, and actual data access are not interchangeable.

<span id="终态和取消"></span>

## Terminal states and cancellation

The training WorkItem must complete with a nonempty adapter URI. When storage is enabled, the URI prefix is validated before saving succeeded. Log/metric persistence can fail independently. Training success does not guarantee complete diagnostics or successful model publication.

Cancellation targets nonterminal jobs. With a real workflow binding, it requests workflow cancellation before saving cancelled. Claim placeholders are never passed to workflow cancellation. Repeated cancellation of terminal jobs returns 409, not unlimited idempotent success. Training handles cancellation at checkpoints; the response does not guarantee all child processes have stopped.

Background training rechecks cancellation before returning success. Cancellation/completion races and multi-transaction failures still require live-environment retesting. These APIs provide no retry, deletion, list, or publication endpoint for failed jobs. Internal model fields do not justify inventing endpoints.

<span id="errors"></span>

<span id="错误与结果"></span>

## Errors and results

| HTTP/string code | Selected contract |
| --- | --- |
| 400 / ErrParamInvalid | Invalid required fields, dataset split, JSON, or training target. |
| 400 / ErrWorkspaceRequired | Input error such as workspace header/path mismatch. |
| 401 / ErrUnauthenticated | User identity required by the handler is missing. Middleware rejection follows the formal authentication contract separately. |
| 403 / ErrPermissionDenied | Business authorization denied. |
| 404 / ErrNotFound | Job unreadable in the current scope. |
| 409 / ErrConflict | request_id input conflict, job cannot launch, or job no longer cancelable. |
| 500 / ErrServer | Other dependency/execution-preparation failure; the job may already be saved or partially scheduled. |

Interpret error text and state together with reads. No generic503 table is automatically applied to these APIs. Complete runtime/deployment errors and authentication envelopes still require live verification.
