pub struct JobSpec {
pub schema_version: String,
pub request_key: String,
pub worker: String,
pub payload_schema: String,
pub payload: Value,
pub resources: Resources,
pub limits: Limits,
pub inputs: Vec<Input>,
pub task_count: Option<usize>,
}Expand description
A job envelope optimization.job/0.1 (the guide’s section Envelope).
Fields§
§schema_version: StringExactly SCHEMA.
request_key: StringThe caller-chosen idempotency key, 1 to 200 bytes. JobSpec::digest
excludes it.
worker: StringThe ID of the registered worker that runs the job.
payload_schema: StringThe worker profile the payload follows, such as lp-ip.solve/1.
payload: ValueThe profile’s options (model, algorithm and budget) as a JSON object. The worker rejects unknown fields.
resources: ResourcesThe CPU slots of the job.
limits: LimitsThe time limits of the job.
inputs: Vec<Input>Input files, at most 16; empty for a model without data.
task_count: Option<usize>Filled by the worker during validation, never inferred by the runner.
Implementations§
Source§impl JobSpec
impl JobSpec
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks the envelope’s rules without reading a file: the schema
version, the request key and worker name, outer_workers * inner_threads <= cpu_slots <= 1024, the time limits, at most 1,000,000
tasks and 16 inputs, and inputs with unique names, contained relative
paths and lowercase SHA-256 values.
Sourcepub fn digest(&self) -> Result<String>
pub fn digest(&self) -> Result<String>
The spec_digest that identifies the experiment: the SHA-256 of the
specification without its request key.
Sourcepub fn input_bytes(&self, base: &Path, name: &str) -> Result<Vec<u8>>
pub fn input_bytes(&self, base: &Path, name: &str) -> Result<Vec<u8>>
The bytes of the input named name, read relative to base and
checked by checked_input.