feat(relay): add box timer and box swarm CLI commands for container agents
This commit is contained in:
+59
-1
@@ -262,8 +262,66 @@ case "$cmd" in
|
|||||||
args=$(python3 -c "import json, sys; print(json.dumps({'job': sys.argv[1]}))" "$name")
|
args=$(python3 -c "import json, sys; print(json.dumps({'job': sys.argv[1]}))" "$name")
|
||||||
call_exec "cron.run" "$args"
|
call_exec "cron.run" "$args"
|
||||||
;;
|
;;
|
||||||
|
timer-create)
|
||||||
|
name="${1:?usage: box cron timer-create <name>}"
|
||||||
|
args=$(python3 -c "import json, sys; print(json.dumps({'name': sys.argv[1]}))" "$name")
|
||||||
|
call_exec "cron.timer_create" "$args"
|
||||||
|
;;
|
||||||
|
timer-start)
|
||||||
|
name="${1:?usage: box cron timer-start <name>}"
|
||||||
|
args=$(python3 -c "import json, sys; print(json.dumps({'name': sys.argv[1]}))" "$name")
|
||||||
|
call_exec "cron.timer_start" "$args"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: box cron runs|status|view|run ..."
|
echo "Usage: box cron runs|status|view|run|timer-create|timer-start ..."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
timer)
|
||||||
|
sub="${1:-list}"
|
||||||
|
shift || true
|
||||||
|
case "$sub" in
|
||||||
|
create|set)
|
||||||
|
name="${1:?usage: box timer create <name>}"
|
||||||
|
args=$(python3 -c "import json, sys; print(json.dumps({'name': sys.argv[1]}))" "$name")
|
||||||
|
call_exec "cron.timer_create" "$args"
|
||||||
|
;;
|
||||||
|
start|enable)
|
||||||
|
name="${1:?usage: box timer start <name>}"
|
||||||
|
args=$(python3 -c "import json, sys; print(json.dumps({'name': sys.argv[1]}))" "$name")
|
||||||
|
call_exec "cron.timer_start" "$args"
|
||||||
|
;;
|
||||||
|
status|view|list)
|
||||||
|
name="${1:-heartbeat}"
|
||||||
|
args=$(python3 -c "import json, sys; print(json.dumps({'name': sys.argv[1]}))" "$name")
|
||||||
|
call_exec "cron.status" "$args"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: box timer create|start|status <name>"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
swarm)
|
||||||
|
sub="${1:-list}"
|
||||||
|
shift || true
|
||||||
|
case "$sub" in
|
||||||
|
spawn)
|
||||||
|
count="${1:?usage: box swarm spawn <count> <task...>}"
|
||||||
|
shift
|
||||||
|
task="$*"
|
||||||
|
args=$(python3 -c "import json, sys; print(json.dumps({'count': int(sys.argv[1]), 'task': sys.argv[2]}))" "$count" "$task")
|
||||||
|
call_exec "swarm.spawn" "$args"
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
sid="${1:?usage: box swarm status <swarm_id>}"
|
||||||
|
args=$(python3 -c "import json, sys; print(json.dumps({'swarm_id': sys.argv[1]}))" "$sid")
|
||||||
|
call_exec "swarm.status" "$args"
|
||||||
|
;;
|
||||||
|
list)
|
||||||
|
call_exec "swarm.list" "{}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: box swarm spawn|status|list ..."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user