Skip to content

Launch config files โ€‹

Three commands take a YAML file that describes a launch. They are three different formats. A file written for one is not valid for another, and the key names only partly overlap.

FileRead byWhat it holdsUnknown keys
Plugin filespawn launch --configOnly a plugins: listError
lagotto spawn-configlagotto watch --spawn-config, lagotto launch --spawn-configThe instance to launch when a watch matches or a schedule firesError (lagotto v0.65.0 and later)
Sweep parameter filespawn launch --param-filedefaults:, grid: and params: rows, one instance per rowPassed to the workload as PARAM_<key>, unless it looks like a spawn setting

If you are turning a spawn launch command line into a file, start with the flag table at the bottom: it shows where each common flag can go, and which flags have no key in any file.

spawn launch --config โ€‹

spawn launch --config reads only a plugins: list. Each entry takes ref: and an optional config: map:

yaml
# launch.yaml
plugins:
  - ref: tailscale
    config:
      tag: tag:spore
  - ref: rstudio-server
sh
spawn launch analysis --instance-type r6i.4xlarge --ttl 8h --config launch.yaml

The instance type, TTL and every other setting stay on the command line. Since spawn v0.137.0 the file is read strictly: any other key (a top-level instance_type:, or a plugin entry written as name: instead of ref:) is an error that names the line, and so is an entry with no ref:.

See Plugins for what a plugin is and how its config: is used.

lagotto --spawn-config โ€‹

lagotto watch --action spawn --spawn-config <file> and lagotto launch --spawn-config <file> read lagotto's own schema. It is not the file spawn launch --config reads. The file can be a local path, an s3://bucket/key URI, or - for stdin.

yaml
# gpu-job.yaml
name: training
instance_type: p5.48xlarge
ttl: 6h
on_complete: terminate
command: ./run-training.sh && spored complete --status success
cost_limit: 400
volume_size: 200
iam_policy: [s3:ReadWrite]
tags:
  project: fieldwork

Keys may be written in snake_case, kebab-case or CamelCase (on_complete, on-complete and OnComplete are the same key). Only top-level keys are read.

Unknown keys. From lagotto v0.65.0, a key that isn't in the table below is an error when you create the watch or the scheduled launch. The error names the key and the nearest accepted one, or, for az, s3_read, s3_write, instance_profile and completion_delay, says where that setting lives instead. lagotto v0.64.1 and earlier accepted such a key and then ignored it, so check an older file against this table. A watch stored before the upgrade still fires.

Files it references (user_data_file, user_data: "@path", iam_policy_file) are read once, when you create the watch or the scheduled launch, and stored inline with it. Whatever launches the instance later (the hosted poller, or lagotto poll) uses that stored copy, so editing the files afterwards doesn't change an existing watch.

What the watch decides, not the file. When a watch fires, lagotto replaces instance_type, region and spot with what it matched, and picks the availability zone. To choose the types, regions, zones or Spot, use the lagotto watch arguments and flags (the type pattern, --regions, --azs, --spot). For lagotto launch, the region is --region (or your AWS config's region) and the zone is --az; instance_type and spot come from the file.

A file must set at least instance_type or ami, or lagotto rejects it as probably mis-keyed.

Keys โ€‹

"If omitted" describes what the launched instance gets when the key isn't in the file.

Core โ€‹

KeyTypeMeaningIf omittedspawn launch flag
namestringThe instance's Name tag. For lagotto launch, also the key --if-exists matches on (--name overrides it).Not set by lagotto--name
instance_typestringInstance type. Replaced by the matched type when a watch fires.A watch uses the matched type; lagotto launch has no other source for it--instance-type
regionstringRegion. Always replaced: by the matched region (watch) or by --region / your AWS config's region (lagotto launch).โ€”--region
amistringAMI ID.Detected for the instance type (architecture and GPU)--ami
spotboolLaunch as Spot. Replaced by the match when a watch fires (set it with lagotto watch --spot).false--spot

Lifecycle โ€‹

KeyTypeMeaningIf omittedspawn launch flag
ttlduration (6h, 90m, 7d)Terminate the instance this long after launch. Must be greater than zero.24h: every instance lagotto launches has a TTL--ttl
idle_timeoutdurationStop the instance after this much idleness.Not set--idle-timeout
on_completeterminate, stop or hibernateWhat spored does when the workload signals completion.Not set--on-complete
completion_filepathThe file spored watches for the completion signal./tmp/SPAWN_COMPLETE--completion-file
pre_stopstringShell command run before any lifecycle stop or terminate (for example, syncing results to S3).Not set--pre-stop
pre_stop_timeoutdurationHow long to wait for pre_stop.spored's default--pre-stop-timeout
session_timeoutdurationLog out idle shells after this long.Not set--session-timeout
cost_limitnumber (USD)Spend ceiling; spored terminates the instance when it's reached.No limit--cost-limit

Workload โ€‹

KeyTypeMeaningIf omittedspawn launch flag
commandstringCommand spored runs once the instance is ready.None--command
user_datastringCustom user-data script, inline, or "@path" to read a file.None--user-data
user_data_filepath or s3:// URICustom user-data script read from a file. Wins over user_data if both are set.None--user-data-file

IAM โ€‹

When none of these four is set, the instance gets spawn's default spored instance profile.

KeyTypeMeaningIf omittedspawn launch flag
iam_policystring or listService-level policy shorthands, for example s3:ReadWrite or [s3:ReadOnly, dynamodb:WriteOnly]. A comma-separated string also works.None--iam-policy
iam_rolestringIAM role name for the instance. Authorize it for the hosted poller with lagotto setup --instance-role <name>.None--iam-role
iam_policy_filepath or s3:// URIA custom policy JSON document. Read when the watch is created and stored as iam_policy_document.None--iam-policy-file
iam_policy_documentstring (JSON)The same custom policy, inline.NoneNo flag (the inline form of --iam-policy-file)

Storage โ€‹

KeyTypeMeaningIf omittedspawn launch flag
volume_sizeinteger (GiB)Root EBS volume size.The AMI's root volume size--volume-size
efs_idstringEFS filesystem to mount (fs-โ€ฆ).None--efs-id
fsx_idstringExisting FSx for Lustre filesystem to mount.None--fsx-id
fsx_createboolCreate an FSx for Lustre filesystem for this instance. Needs fsx_lifecycle.false--fsx-create
fsx_lifecyclestringMust be ephemeral here: the filesystem is reclaimed once the instance is gone. For a durable filesystem, create it separately and use fsx_id.Required with fsx_create--fsx-lifecycle
fsx_s3_bucketstringS3 bucket the created filesystem imports from and exports to.None--fsx-s3-bucket
fsx_import_paths3:// URIImport path.None--fsx-import-path
fsx_export_paths3:// URIExport path.s3://<fsx_s3_bucket>/--fsx-export-path
fsx_mount_pointpathWhere the filesystem is mounted./fsx--fsx-mount-point
fsx_storage_capacityinteger (GB)Size of the created filesystem.1200--fsx-storage-capacity

Capacity and pricing โ€‹

KeyTypeMeaningIf omittedspawn launch flag
reservation_idstringCapacity Reservation or Capacity Block to launch into (cr-โ€ฆ). This is what targets the launch: lagotto launch --reservation-id only times the launch to the reservation.None--reservation-id
capacity_blockboolreservation_id is a Capacity Block for ML. Can't be combined with Spot.false--capacity-block
spot_max_pricestring or number (USD/hour)Maximum Spot price.No cap--spot-max-price

Other โ€‹

KeyTypeMeaningIf omittedspawn launch flag
key_namestringEC2 key pair name.None--key-name
tagsmap, or list of key=value stringsExtra tags on the instance and its volumes. On a watch launch, lagotto adds its own lagotto:watch-id tag (and lagotto:project, if the watch has one).None--tag (repeatable)

spawn launch --param-file โ€‹

A parameter sweep file has three top-level keys: defaults: (applied to every row), grid: (lists expanded into every combination) and params: (one instance per row). A row's own key always wins. spawn launch flags passed next to --param-file apply to every row; for --ttl, --idle-timeout, --cost-limit and --volume-size, the flag also beats the same key in defaults:.

yaml
defaults:
  instance_type: g5.xlarge
  ttl: 4h
  on_complete: terminate
  command: "python train.py --lr $PARAM_learning_rate"
params:
  - learning_rate: 0.001
  - learning_rate: 0.01
    instance_type: g5.2xlarge

Inside defaults: and each row, these keys are spawn settings:

KeyMeaningspawn launch flag
instance_typeInstance type--instance-type
regionRegion--region
az, availability_zoneAvailability zone--az
amiAMI ID--ami
key_pair, key_nameEC2 key pair name--key-name
spotLaunch as Spot (true/false)--spot
spot_max_priceMaximum Spot price (a string)--spot-max-price
hibernateEnable hibernation--hibernate
ttlTerminate after this duration--ttl
idle_timeoutStop after this much idleness--idle-timeout
hibernate_on_idleHibernate instead of stop when idle--on-idle hibernate
cost_limitSpend ceiling in USD--cost-limit
session_timeoutLog out idle shells--session-timeout
on_completeAction on completion--on-complete
completion_fileCompletion signal file--completion-file
completion_delayGrace period after the completion signal--completion-delay
dns, dns_nameDNS label--dns
stepWorkflow step name (the spawn:step tag)None
command, user_commandThe row's command--command
user_dataThe row's own script, run after the bootstrap and after --user-data--user-data
iam_roleAn existing instance profile, by name--instance-profile
nameInstance name--name
volume_sizeRoot EBS volume size in GiB--volume-size

Any other key is a workload parameter: it reaches the instance as a PARAM_<key> environment variable. Because of that, spawn can't tell a misspelled setting from your own parameter, so it rejects keys that look like settings:

  • a spawn key with hyphens or capitals (on-complete, TTL);
  • a key that names a CLI-only flag, or a setting people expect but that doesn't exist (ttl_hours, max_cost, budget, instance_profile, max_concurrent and others), with a message saying what to use instead;
  • a key that can't be an environment variable name.

To pass one of the rejected names to your workload anyway, prefix it: param:budget: 50 becomes PARAM_budget. A spawn key written at the top level, outside defaults:, grid: and params:, is an error too, since it would be ignored.

Which file takes which flag โ€‹

Common spawn launch flags and where each can be written. "โ€”" means there is no key for it in that file. spawn launch --config takes none of these: it holds only plugins: (the --plugin flag's file form).

spawn launch flaglagotto --spawn-configSweep --param-file row
--instance-typeinstance_type (a watch uses the matched type)instance_type
--regionโ€” (lagotto watch --regions, lagotto launch --region)region
--azโ€” (lagotto watch --azs, lagotto launch --az)az
--spotspot (a watch uses lagotto watch --spot)spot
--spot-max-pricespot_max_pricespot_max_price
--amiamiami
--ttlttlttl
--idle-timeoutidle_timeoutidle_timeout
--on-completeon_completeon_complete
--completion-filecompletion_filecompletion_file
--completion-delayโ€”completion_delay
--pre-stoppre_stopโ€” (flag applies to every row)
--cost-limitcost_limitcost_limit
--commandcommandcommand
--user-data / --user-data-fileuser_data / user_data_fileuser_data (runs in addition to the flag's script)
--tagtagsโ€” (flag applies to every row)
--volume-sizevolume_sizevolume_size
--namenamename
--key-namekey_namekey_name
--iam-roleiam_roleโ€” (flag)
--iam-policyiam_policyโ€” (flag)
--iam-policy-fileiam_policy_fileโ€” (flag)
--instance-profileโ€” (use iam_role)iam_role
--s3-read / --s3-writeโ€” (use iam_policy: s3:ReadOnly / s3:ReadWrite, or iam_policy_document)โ€” (flag)
--efs-idefs_idโ€” (flag)
--fsx-idfsx_idโ€” (flag)
--fsx-create and the other --fsx-* flagsfsx_create, fsx_lifecycle, โ€ฆโ€” (a sweep can't create a filesystem: create it first and pass --fsx-id)
--reservation-idreservation_idโ€” (flag)
--capacity-blockcapacity_blockโ€” (flag)
--session-timeoutsession_timeoutsession_timeout
--pluginโ€”โ€” (flag); spawn launch --config holds the file form

On a sweep, a flag marked "flag" is passed on the command line next to --param-file and applies to every row. spawn refuses, before launching anything, the few flags a sweep can't honour.