Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
workflow-orchestration【部署与运维】Use FedML workflow DAGs, Job subclasses, WorkflowMLOpsApi, and train/deploy/inference job wrappers to orchestrate dependent jobs.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill for fedml.workflow DAGs, custom Job subclasses, Workflow.add_job, workflow status/output inspection, and customized job wrappers such as TrainJob, ModelDeployJob, and ModelInferenceJob.
fedml launch job.yaml without dependencies: use ../launch-and-packaging/SKILL.md.../model-serving/SKILL.md.../distributed-training/SKILL.md.For offline structural validation, use custom Job subclasses and run the bundled helper from the root skill directory:
python sub-skills/workflow-orchestration/scripts/local_workflow_smoke.py
The helper avoids backend workflow creation and remote launch side effects. It validates job dependencies, inputs/outputs, and status transitions.
from fedml.workflow import Job, JobStatus, Workflow
class LocalJob(Job):
def run(self):
self.output_data_dict = {"ok": True, "inputs": self.input_data_dict}
def status(self):
return JobStatus.FINISHED
def kill(self):
pass
workflow = Workflow("demo")
a = LocalJob("prepare")
b = LocalJob("consume")
workflow.add_job(a)
workflow.add_job(b, dependencies=[a])
For fully offline tests, avoid Workflow.run() unless backend update calls are mocked. The bundled smoke manually computes metadata and executes a dependency-safe local path.
Real workflow runs and customized jobs may call backend APIs, upload/download inputs/outputs, and launch jobs. Before using them, confirm:
TrainJob or deploy/inference wrappers.Relevant classes:
Workflow(name, loop=False, api_key=None, workflow_type=...)Workflow.add_job(job, dependencies=None)Workflow.run()WorkflowMLOpsApiJob and JobStatusTrainJob, ModelDeployJob, ModelInferenceJobpython/fedml/workflow/workflow.py — workflow graph and execution order.python/fedml/workflow/jobs.py — Job/JobStatus contracts.python/fedml/workflow/workflow_mlops_api.py — backend workflow APIs.python/fedml/workflow/customized_jobs/ — train/deploy/inference wrappers.python/fedml/workflow/driver_example/ — remote workflow example.Workflow.add_job rejects non-Job objects and duplicate names.Workflow.run() updates backend workflow status, so it is not purely offline.A workflow-orchestration task is complete when the DAG shape, job dependencies, local-vs-remote execution path, credentials, and output handoff are explicit, and local smoke or remote workflow status is recorded.