perago.build_taskdef#

perago.build_taskdef(task)[源代码]#

Build the Conductor TaskDef dictionary for one Perago task.

build_taskdef is the library equivalent of perago extract. It converts a validated perago.TaskDefinition into the JSON-compatible mapping registered with Conductor. The task function signature determines input and output keys, Pydantic models provide JSON Schema, and perago.TaskControls provide 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 workspace and params input keys and workspace and result output keys; workspace-free tasks contain only params and result.

参数:

task (TaskDefinition)

返回类型:

dict[str, Any]

参见

write_taskdef

Write 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'