perago.build_taskdef#
- perago.build_taskdef(task)[源代码]#
Build the Conductor TaskDef dictionary for one Perago task.
build_taskdefis the library equivalent ofperago extract. It converts a validatedperago.TaskDefinitioninto the JSON-compatible mapping registered with Conductor. The task function signature determines input and output keys, Pydantic models provide JSON Schema, andperago.TaskControlsprovide retry, timeout, response timeout, and execution limit fields.- Parameters:
- taskTaskDefinition
Validated task definition returned by
perago.load_module_task()or attached to a decorated function as__perago_task__.
- Returns:
- dict of str to Any
JSON-compatible Conductor TaskDef mapping. Workspace tasks contain
workspaceandparamsinput keys andworkspaceandresultoutput keys; workspace-free tasks contain onlyparamsandresult.
- 参数:
task (TaskDefinition)
- 返回类型:
参见
write_taskdefWrite the generated TaskDef mapping to a JSON file.
Notes
Workspace guardrails, workspace prefixes, LakeFS connection settings, and publish budget internals are not serialized into the TaskDef. A publish budget does not replace
timeout.response_seconds; writable workspace tasks warn if the configured response timeout is shorter than the derived publish budget.Examples
>>> task_def = build_taskdef(load_module_task("app.workers.features_build")) >>> task_def["name"] 'features.build'