MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / main

Function main

scripts/workflow-orchestrator.py:280–337  ·  view source on GitHub ↗

Run the workflow orchestrator.

()

Source from the content-addressed store, hash-verified

278
279
280def main():
281 """Run the workflow orchestrator."""
282 parser = argparse.ArgumentParser(description="GraphBit Workflow Orchestrator", formatter_class=argparse.RawDescriptionHelpFormatter)
283
284 parser.add_argument("command", choices=["start", "complete", "status", "reset", "check"], help="Command to execute")
285
286 parser.add_argument("--phase", choices=[p.value for p in WorkflowPhase], help="Workflow phase to operate on")
287
288 parser.add_argument("--success", action="store_true", help="Mark phase as successful (for complete command)")
289
290 parser.add_argument("--artifacts", nargs="*", help="List of artifacts produced by the phase")
291
292 parser.add_argument("--error", help="Error message (for failed completion)")
293
294 parser.add_argument("--root", type=Path, default=Path.cwd(), help="Root directory of the project")
295
296 args = parser.parse_args()
297
298 orchestrator = WorkflowOrchestrator(args.root)
299
300 if args.command == "start":
301 if not args.phase:
302 print("Error: --phase is required for start command")
303 sys.exit(1)
304
305 phase = WorkflowPhase(args.phase)
306 success = orchestrator.start_phase(phase)
307 sys.exit(0 if success else 1)
308
309 elif args.command == "complete":
310 if not args.phase:
311 print("Error: --phase is required for complete command")
312 sys.exit(1)
313
314 phase = WorkflowPhase(args.phase)
315 success = orchestrator.complete_phase(phase, args.success, args.artifacts or [], args.error)
316 sys.exit(0 if success else 1)
317
318 elif args.command == "status":
319 orchestrator.print_status()
320
321 elif args.command == "reset":
322 orchestrator.reset_pipeline()
323
324 elif args.command == "check":
325 if not args.phase:
326 print("Error: --phase is required for check command")
327 sys.exit(1)
328
329 phase = WorkflowPhase(args.phase)
330 ready = orchestrator.is_pipeline_ready_for_phase(phase)
331
332 if ready:
333 print(f"Pipeline is ready for phase: {args.phase}")
334 sys.exit(0)
335 else:
336 print(f"Pipeline is NOT ready for phase: {args.phase}")
337 sys.exit(1)

Callers 1

Calls 7

start_phaseMethod · 0.95
complete_phaseMethod · 0.95
print_statusMethod · 0.95
reset_pipelineMethod · 0.95
WorkflowPhaseClass · 0.85

Tested by

no test coverage detected