From 0c6ff2172f3c48f4a6a41d95fd2da5ced183599a Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 24 Nov 2025 15:48:17 -0500 Subject: Allow worker to take a specific task to work on --- Omni/Agent.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Omni/Agent.hs') diff --git a/Omni/Agent.hs b/Omni/Agent.hs index 070e3fb..b7381b8 100644 --- a/Omni/Agent.hs +++ b/Omni/Agent.hs @@ -43,7 +43,7 @@ help = agent Usage: - agent start + agent start [] agent harvest [--path=] agent merge-driver agent test @@ -72,7 +72,9 @@ move args Core.workerPath = path } - Worker.start worker + let taskId = fmap Text.pack (Cli.getArg args (Cli.argument "task-id")) + + Worker.start worker taskId | args `Cli.has` Cli.command "harvest" = harvest args | args `Cli.has` Cli.command "merge-driver" = mergeDriver args | otherwise = putStrLn (Cli.usage help) @@ -156,6 +158,13 @@ unitTests = case result of Left err -> Test.assertFailure <| "Failed to parse 'start': " <> show err Right args -> args `Cli.has` Cli.command "start" Test.@?= True, + Test.unit "can parse start command with task id" <| do + let result = Docopt.parseArgs help ["start", "t-123"] + case result of + Left err -> Test.assertFailure <| "Failed to parse 'start t-123': " <> show err + Right args -> do + args `Cli.has` Cli.command "start" Test.@?= True + Cli.getArg args (Cli.argument "task-id") Test.@?= Just "t-123", Test.unit "can parse harvest command" <| do let result = Docopt.parseArgs help ["harvest"] case result of -- cgit v1.2.3