Skip to main content

build_job

Function build_job 

Source
pub fn build_job<D>(
    resource_key: &str,
    operation: &str,
    overwrite_policy: OverwritePolicy,
    items: Vec<(String, D, SizeBucket)>,
) -> BatchJob<D>
where D: Clone + Send + Sync + Serialize,
Expand description

Helper to build a BatchJob from a list of items.

Trace fields (trace_ctx, attempt_id, trial_id) are initialized to None. Callers that need trace propagation should set them after construction or use build_job_traced.

ยงExample

use ai_batch_queue::*;

let job = build_job(
    "llava:13b",
    "tag",
    OverwritePolicy::Skip,
    vec![
        ("img-1".to_string(), "path/to/1.png".to_string(), SizeBucket::Medium),
        ("img-2".to_string(), "path/to/2.png".to_string(), SizeBucket::Large),
    ],
);

assert_eq!(job.items.len(), 2);
assert_eq!(job.resource_key, "llava:13b");