Your First Program
A minimal Spark program submits a train job (dry fixtures), polls
status, then asserts with
expect — the train→status→expect
loop you can put in a PR (exit 0 pass / exit 1 fail).
train_eval.spark
Create a file named
train_eval.spark
(or use
examples/train_eval.spark):
model train dataset "examples/fixtures/train/dataset.jsonl" base "fixture-base" out "out/train/job-dry-001" backend "http" -> job
model status "job-dry-001" -> status
expect contains job fixture "examples/fixtures/train/want_accepted.txt"
expect contains status fixture "examples/fixtures/train/want_succeeded.txt"
backend "http" means Spark POSTs to
a trainer you run at
SPARK_TRAIN_URL. Dry-run never hits
the network.
Run it
./spark --dry-run examples/train_eval.spark
# exit 0 — [expect] pass …
./spark --dry-run examples/train_eval_fail.spark ; echo $?
# → 1
Dry-run returns fixture job + status so you can iterate without a trainer or API key. For a live train submit (your service):
export SPARK_TRAIN_URL=http://127.0.0.1:8090/v1
./spark --live examples/model_train.spark
Next
Add
classify
or more eval helpers in
AI in 5 Minutes, then the
Build a Model wizard. Optional
freeform
ask
still works — see
examples/hello.spark
— but the product thesis is train → status → expect
(spark_distill_cpu on the
reference trainer).
Next: AI in 5 Minutes →