Skip to main content

Execution Model

Training, analysis, import Tools, and tests share this model. Global is the Platform API; Local is the Client API; Orch API manages Docker containers.

Run → step → attempt​

ObjectOwns
RunOne execution: purpose, mode, location, and ordered steps.
StepOne workflow node or standalone Tool/model, inputs, parameter search, and selected attempt.
AttemptOne parameter trial or federated participant execution, with its own status, messages, and outputs.

purpose selects the feature; mode is SINGLE or FEDERATED; location is LOCAL or PLATFORM. SINGLE means one participant; its workflow may still contain several steps. A standalone Tool/model uses one step without a workflow node.

Execution · message flow
The database holds execution state

A run contains steps; each step launches attempts. Committed events hand work to the next coordinator.

Run
The workflow coordinator advances steps in execution order.
Step
The step coordinator creates a trial attempt.
Attempt
The launcher starts its container; Tool messages update its lifecycle.
Finishing an attempt stops its container and wakes its step. Finishing a step wakes its run.

Run types​

ORM and storage​

Platform (Global API) and Site (Local API) each write their own PostgreSQL database. Common mappings exist in both; extension rows name their owning database. Core Base*Entity classes supply inherited fields through @MappedSuperclass; only concrete entities have tables. See Quarkus Hibernate ORM/Panache.

Edge labels name foreign-key columns. A step selects at most one attempt. Every attempt keeps its own messages and file links.

EntityStores
ExecutionRunEntityPurpose/mode/location and owner. Platform links analysis, experiment, or hosting run; Site links cohort/import and participant ID.
ExecutionRunStepEntityRun and workflow node or standalone target; inputs, search, and selected_attempt_id.
ExecutionAttemptEntityTrial parameters, status/progress, container/exit code, runtime metadata, latest log/score references. Platform also stores uploaded result fields.
ExecutionMessageEntityAttempt-linked log, metric, or round payload as typed JSON.
ExecutionFileEntityAttempt/file link, input/output direction, and the name the Tool uses.
FileEntityFile metadata and lo_oid; content lives in PostgreSQL large objects, not in the execution link.

Run, step, and attempt inherit status, timestamps, and structured failure from BaseExecutionStatusEntity. Tool working files live in Orch-managed volumes; kept files go through the owning API.

EntityStores and links
ExecutionExperimentEntity (Platform)Project/Tool experiment; runs link through experiment_id. Federated training also stores a workflow copy, accepted project configuration, and acceptance counts.
ExecutionParticipantEntity (Platform)Run-scoped identity/role, current node/status, input paths, and model-sharing consent.
ExecutionFederationEntity (Platform, Site)One row per federated step (step_id). Platform: relay configuration/client slots and rounds. Site: its relay configuration, certificate request/retry state, aggregator flag.
ExecutionFederatedAttemptEntity (Platform)One row per attempt (attempt_id): participant link, round/communication state, and optional Platform aggregator relay configuration.
DataAnalysisFileEntity (Platform)Analysis-owned file reference and input/output name, optionally linked to an attempt.

Internal messages​

BaseWorkflowExecutionBO creates runs and steps. For SINGLE runs, coordinators advance steps and trials sequentially. FEDERATED runs use FederatedTrainingBO or TestRunBO to coordinate participants.

ExecutionEventPublisher fires CDI events. ExecutionEventForwarder observes AFTER_SUCCESS and sends events raised in a transaction after successful commit, so consumers can reload committed rows. These Quarkus Messaging channels stay inside one Learning API process; cross-service traffic uses HTTP/WebSockets. Channel names are defined in ExecutionChannels.

EventConsumer → action
RunStartedEventBaseWorkflowCoordinator → first waiting step in workflow execution order.
StepChangedEventBaseStepCoordinator → plan the next trial or select the best finished attempt.
AttemptLaunchEventBaseAttemptLauncher → claim attempt, stage inputs, start container through Orch API.
AttemptFinishedEventLauncher → revoke API key and stop container; publisher also emits StepChangedEvent.
StepFinishedEventWorkflow coordinator → next step, or end run. An unsuccessful step stops waiting steps.

RunFinishedEvent is observed directly by purpose-specific cleanup code. AttemptUpdatedEvent refreshes views. BaseExecutionRunSender groups committed changes by run/purpose and emits ExecutionRunsChangedEvent; Local also publishes run DTOs on execution-runs. Coordinator @Incoming methods run on virtual threads for blocking database/container calls.

Attempts and results​

Without a search, a step runs one fixed parameter set. Grid/random searches run trials sequentially; failed trials are skipped, without retry. The latest reported search metric ranks successful trials; missing/NaN scores rank last, ties use the lower trialIndex. Without a metric, the first successful trial wins. No successful trial means step failure. Downstream input mappings read the selected attempt's outputs. Container-launched attempts have separate volumes, preserved for later steps. TEST attempts share their engine's working storage.

Attempts move forward through PENDING → INITIALIZED → STARTED → RUNNING → FINISHED; any open state may end as ERROR or STOPPED. Coordinators use database locks and ignore repeated/terminal transitions. Container startup runs between short transactions; a late-starting container is stopped if its attempt was cancelled. Stopping a run marks open steps/attempts STOPPED; completion events clean up containers and API keys.

Tool ↔ Learning API​

ANALYSIS, TRAINING, and PROCESSING Tools connect to /execution/APP/{attemptId}/app on their owning Learning API. The Java endpoint calls this numeric attempt ID runId; APP_ID carries the same value. The path segment APP is independent of ExecutionMode. WS_URL and HTTP_URL supply the callback bases. APP_API_KEY authenticates as X-API-Key, scoped to that attempt and revoked on completion. Callback handlers use Quarkus WebSockets Next.

Transport / directionMessage → effect
WebSocket, API → ToolSTART_RUN, START_PREDICTION, or START_FEDERATED_RUN → parameters, inputs, and optional federation config in StartRunDTO.
WebSocket, Tool → APISTART_RUN, UPDATE_RUN, FINISH_RUN → BaseAttemptAppServer calls BaseAttemptLifecycle to update the attempt. Federated updates/finish use UPDATE_FEDERATED_RUN / FINISH_FEDERATED_RUN.
WebSocket, Tool → APILOG_MESSAGE, CONSOLE_MESSAGE, LOG_METRIC → persisted attempt messages; matching metrics update its search score.
HTTP POST, Tool → API/execution/APP/{attemptId}/upload/output or /upload/model → purpose-specific output/model handling.

Tools that start automatically on connection fail on early disconnect. Federated Client Tools and transformer sessions wait for an explicit start/batch and may reconnect. Test/hosting engines use /testembed/ with the Tool ID; each test still has separate attempt state/credentials.

Where to contribute​

BO = business logic; AO = database access; DTO = API/message data. Shared code is in core-learning-api under bio.cosy.feddb.core.execution; concrete entities/consumers are in each Learning API’s execution package.

ChangeStart in
Ordering / search / container lifecycleShared execution/coordinator, hyperparam, attempt
Tool messages / uploadsShared execution/server; Local/Global execution/attempt
Feature-specific inputs, outputs, streamingFeature BOs plus ExecutionAttemptLifecycle and ExecutionAttemptLauncher overrides
Federated coordinationFederated learning flow
Frontend run stateFrontends/projects/shared-lib/src/lib/modules/app-execution/dto/execution-run.ts