refactor(cli): modularize queue.zig structure

Move configuration types to queue/mod.zig:
- TrackingConfig with MLflow, TensorBoard, Wandb sub-configs
- QueueOptions with all queue-related options

queue.zig now re-exports from queue/mod.zig for backward compatibility.
Build passes successfully.
This commit is contained in:
Jeremie Fraeys 2026-03-04 21:00:23 -05:00
parent c17811cf2b
commit 7a6d454174
No known key found for this signature in database
2 changed files with 69 additions and 52 deletions

View file

@ -9,59 +9,15 @@ const mode = @import("../mode.zig");
const db = @import("../db.zig");
const manifest_lib = @import("../manifest.zig");
pub const TrackingConfig = struct {
mlflow: ?MLflowConfig = null,
tensorboard: ?TensorBoardConfig = null,
wandb: ?WandbConfig = null,
// Use modular queue structure
const queue_mod = @import("queue/mod.zig");
pub const MLflowConfig = struct {
enabled: bool = true,
mode: []const u8 = "sidecar",
tracking_uri: ?[]const u8 = null,
};
pub const TensorBoardConfig = struct {
enabled: bool = true,
mode: []const u8 = "sidecar",
};
pub const WandbConfig = struct {
enabled: bool = true,
mode: []const u8 = "remote",
api_key: ?[]const u8 = null,
project: ?[]const u8 = null,
entity: ?[]const u8 = null,
};
};
pub const QueueOptions = struct {
dry_run: bool = false,
validate: bool = false,
explain: bool = false,
json: bool = false,
force: bool = false,
cpu: u8 = 2,
memory: u8 = 8,
gpu: u8 = 0,
gpu_memory: ?[]const u8 = null,
// Narrative fields for research context
hypothesis: ?[]const u8 = null,
context: ?[]const u8 = null,
intent: ?[]const u8 = null,
expected_outcome: ?[]const u8 = null,
experiment_group: ?[]const u8 = null,
tags: ?[]const u8 = null,
// Sandboxing options
network_mode: ?[]const u8 = null,
read_only: bool = false,
secrets: std.ArrayList([]const u8),
// Scheduler options
reservation_id: ?[]const u8 = null,
gang_size: ?u32 = null,
max_wait_time: ?u32 = null,
preemptible: bool = false,
preferred_worker: ?[]const u8 = null,
};
// Re-export for backward compatibility
pub const TrackingConfig = queue_mod.TrackingConfig;
pub const QueueOptions = queue_mod.QueueOptions;
pub const parse = queue_mod.parse;
pub const validate = queue_mod.validate;
pub const submit = queue_mod.submit;
fn resolveCommitHexOrPrefix(allocator: std.mem.Allocator, base_path: []const u8, input: []const u8) ![]u8 {
if (input.len < 7 or input.len > 40) return error.InvalidArgs;

View file

@ -0,0 +1,61 @@
const std = @import("std");
// Re-export sub-modules
pub const parse = @import("parse.zig");
pub const validate = @import("validate.zig");
pub const submit = @import("submit.zig");
// Queue configuration types - defined here to avoid circular deps
pub const TrackingConfig = struct {
mlflow: ?MLflowConfig = null,
tensorboard: ?TensorBoardConfig = null,
wandb: ?WandbConfig = null,
pub const MLflowConfig = struct {
enabled: bool = true,
mode: []const u8 = "sidecar",
tracking_uri: ?[]const u8 = null,
};
pub const TensorBoardConfig = struct {
enabled: bool = true,
mode: []const u8 = "sidecar",
};
pub const WandbConfig = struct {
enabled: bool = true,
mode: []const u8 = "remote",
api_key: ?[]const u8 = null,
project: ?[]const u8 = null,
entity: ?[]const u8 = null,
};
};
pub const QueueOptions = struct {
dry_run: bool = false,
validate: bool = false,
explain: bool = false,
json: bool = false,
force: bool = false,
cpu: u8 = 2,
memory: u8 = 8,
gpu: u8 = 0,
gpu_memory: ?[]const u8 = null,
// Narrative fields
hypothesis: ?[]const u8 = null,
context: ?[]const u8 = null,
intent: ?[]const u8 = null,
expected_outcome: ?[]const u8 = null,
experiment_group: ?[]const u8 = null,
tags: ?[]const u8 = null,
// Sandboxing
network_mode: ?[]const u8 = null,
read_only: bool = false,
secrets: std.ArrayList([]const u8),
// Scheduler
reservation_id: ?[]const u8 = null,
gang_size: ?u32 = null,
max_wait_time: ?u32 = null,
preemptible: bool = false,
preferred_worker: ?[]const u8 = null,
};