Skip to main content

apply and export

apply and export are two halves of one idea. apply reads a YAML file and creates or updates what it names. export fetches a resource and writes the YAML that apply accepts back for it. Together they let a definition live in your repository, be reviewed like code, and still be the exact thing the platform runs.

This matters because the platform database is a real authoring surface too. Someone can create a job definition in the web app, and that definition is then only in the deployment. A definition edited in the dashboard and never committed disappears when the deployment is torn down; a definition edited in the repository and never applied never takes effect. The round trip is what keeps the two honest.

apply

clika-rt apply -f <file> [-f <file> ...] [flags]

Reads one or more multi-document YAML files, routes each document by its kind field, and sends the resulting requests.

FlagTypeDefaultMeaning
-f, --filestring, repeatablenoneThe YAML file to apply. Repeat it to apply several. -f - reads standard input.
--dry-runboolfalseResolve every reference and print the requests that would be sent, without sending them.

Semantics

  • Definitions are created or updated by name. JobDefinition, ServiceDefinition and Model are matched on their name, so applying a committed file twice does not create a duplicate. This is what makes apply safe to run from CI on every merge.
  • Runs always create. Job, Service, Benchmark and BenchmarkGroup are actions, not state, so each apply starts a new one.
  • References may be names. Write devices: [jetson-01] rather than a UUID; the same name resolution the rest of the CLI uses applies inside the document.
  • A spec: wrapper is accepted. If your document nests the body under spec:, it is unwrapped. Keys beside spec: win over keys inside it.
  • Documents apply in order. Several documents in one file, separated by ---, are applied top to bottom, so a document may reference something an earlier one created.

Supported kinds

KindEndpointSemanticsExportable
JobDefinition/api/job-definitionsCreate or update by nameYes
ServiceDefinition/api/service-definitionsCreate or update by nameYes
Model/api/modelsCreate or update by nameYes
JobPOST /api/jobsAlways createsYes
ServicePOST /api/devices/{id}/servicesAlways creates, once per target deviceNo
Benchmark, BenchmarkGroupPOST /api/benchmark-groupsAlways createsYes

Service is apply-only, because there is no flat collection to fetch one service back from by id. Read a running service through devices services-svc_id instead.

clika-rt apply --help prints the kinds this binary supports, which is the authoritative list for the deployment you are talking to.

Reference fields

Certain fields are resolved from a name to an id before the request goes out.

Field in your documentLooked up inSent as
job_definition/api/job-definitionsjob_definition_id
device/api/devicesdevice_id
devices (list)/api/devicesdevice_ids
model/api/modelsmodel_id
models (list)/api/modelsmodel_ids
service_definition/api/service-definitionsThe definition's fields, merged in as defaults

The canonical *_id fields accept a name too, so either spelling works.

One thing that is deliberately not implemented: device_selector, the old group-based way of picking targets. apply reports it as unknown rather than quietly forwarding it, so list the devices explicitly.

Examples

Apply a definition and a run in one file:

kind: JobDefinition
name: llm-latency
output_path: /tmp/results.json
result_type: structured
script:
command:
- python3
- run.py
timeout_sec: 3600
---
kind: Job
job_definition: llm-latency
devices:
- jetson-01
- jetson-02
$ clika-rt apply -f llm-latency.yaml
job definition "llm-latency" updated (7a31...)
job "llm-latency-jetson-01" created (c4f2...)
job "llm-latency-jetson-02" created (c4f3...)

Register a model and benchmark it in one file:

kind: Model
huggingface_url: https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct
task: text-generation
---
kind: Benchmark
name: nightly-llm-sweep
benchmark_type: performance
models:
- Qwen2.5-0.5B-Instruct
devices:
- jetson-01
- orin-02

Check what a file would do before it does it:

clika-rt apply -f defs.yaml -f run.yaml --dry-run

Generate a document and pipe it in:

cat run.yaml | clika-rt apply -f -

export

clika-rt export <kind> <name-or-id>

Fetches one resource and writes it as canonical resource YAML on standard output. Server-managed fields are stripped: ids, timestamps, audit columns, run state and derived counters, and null fields are omitted. What comes out is what apply takes back in.

Exportable kinds are Benchmark, BenchmarkGroup, Job, JobDefinition, Model and ServiceDefinition.

$ clika-rt export JobDefinition llm-latency
kind: JobDefinition
name: llm-latency
description: Single-stream latency for text generation
output_path: /tmp/results.json
result_type: structured
script:
command:
- python3
- run.py
timeout_sec: 3600
required_resources:
min_gpu_count: 1
clika-rt export ServiceDefinition vllm-server
clika-rt export Job 1f0a2b3c-4d5e-6f70-8192-a3b4c5d6e7f8

The round trip

Bringing a dashboard-authored definition into the repository:

clika-rt export JobDefinition llm-latency > job-defs/llm-latency/config.yaml
git add job-defs/llm-latency/config.yaml && git commit -m "chore: commit llm-latency definition"

Pushing a repository edit back to a deployment:

clika-rt apply -f job-defs/llm-latency/config.yaml

Verifying that the two match, which is worth doing in CI:

clika-rt export JobDefinition llm-latency | diff -u job-defs/llm-latency/config.yaml -

Because export strips exactly the fields the platform owns, that diff is empty when the definition has not drifted, and shows precisely what changed when it has.

Applying to several deployments

A file is not tied to a deployment, so the same definition can be rolled out everywhere with a profile per target:

for p in cloud onprem; do clika-rt --profile "$p" apply -f job-defs/llm-latency/config.yaml; done

See authentication and profiles for setting those up.

Full command reference

Every command below is generated from the deployment's own API description, so one subcommand is exactly one platform operation. Each entry names the method, the endpoint and the MCP tool name, so the same operation is identifiable whichever surface you drive it from. Path parameters are positional arguments, query parameters are flags, and a request body is --body or --body-file. The hand-written commands, the ones that stream, propagate an exit code, or hand your terminal to ssh, carry no operation line.

The prose above covers the commands most people reach for. This section is the complete surface, for when you need the flag you have not used before.

clika-rt apply

clika-rt apply

Applies one or more multi-document YAML files. Each document is routed by its kind: field; a spec: wrapper around the body is accepted and unwrapped. Definitions are created or updated by name, so re-applying a committed file is idempotent; runs (Job, Service, Benchmark) always create. References inside a document may be names rather than UUIDs.

clika-rt apply -f <file> [-f <file> ...] [flags]

Positional arguments: required <file>, <file>; optional [-f <file> ...].

FlagTypeDefaultMeaning
--dry-runboolfalseprint the resolved requests instead of sending them
-f, --filestringArraynoneYAML file to apply (repeatable; '-' reads stdin)

clika-rt export

clika-rt export

Fetches a resource and writes the YAML that apply accepts back for it, with server-managed fields (ids, timestamps, run state, counters) stripped. This is the download half of the job-definitions convention: what the platform emits should equal the file committed to the repo.

clika-rt export <kind> <name-or-id> [flags]

Positional arguments: required <kind>, <name-or-id>.