Python client SDK for the Funmill task
API. Distributed on PyPI as funmill and imported as funmill.client, sharing the
funmill namespace with the funmill-api package (funmill.api).
TaskSubmit accepts resources={"gpu": 1} for a Dagu named resource pool.
The Dagu server must configure the gpu queue capacity, and every GPU task
must submit through that same Dagu instance. Resource requests in workflows,
multiple resource units, and resource tasks with depends_on are currently
rejected with HTTP 400. Windmill does not support resource pools. Task queries
expose a pool waiting reason and worker ID; physical resource allocations are
not yet available. Dependency waits default to no time limit unless
dependency_timeout_seconds is set explicitly.
pip install funmillfrom funmill.client import FunmillClient, TaskSubmit
with FunmillClient(base_url="http://127.0.0.1:8812", api_key="replace-me") as client:
client.health() # {"status": "ok", "backend": "dagu"}
accepted = client.submit_task(
TaskSubmit(language="python", source="def main(): return 21 * 2")
)
task = client.get_task(accepted.task_id)
result = client.get_result(accepted.task_id)FunmillClient.from_env() builds a client from FUNMILL_URL, FUNMILL_API_KEY, and
FUNMILL_TIMEOUT environment variables.
| Method | Route |
|---|---|
health() |
GET /health |
submit_task(TaskSubmit) |
POST /v1/tasks |
submit_workflow(WorkflowSubmit) |
POST /v1/workflows |
get_task(task_id) |
GET /v1/tasks/{task_id} |
get_progress(task_id) |
GET /v1/tasks/{task_id}/progress |
get_logs(task_id) |
GET /v1/tasks/{task_id}/logs |
get_result(task_id) |
GET /v1/tasks/{task_id}/result |
cancel(task_id, reason=...) |
POST /v1/tasks/{task_id}/cancel |
rerun(task_id) |
POST /v1/tasks/{task_id}/rerun |
create_workflow(WorkflowCreate) |
POST /v1/workflow-definitions |
list_workflows(name=..., label=..., page=..., per_page=...) |
GET /v1/workflow-definitions |
get_workflow(workflow_id) |
GET /v1/workflow-definitions/{workflow_id} |
update_workflow(workflow_id, WorkflowUpdate) |
PUT /v1/workflow-definitions/{workflow_id} |
delete_workflow(workflow_id) |
DELETE /v1/workflow-definitions/{workflow_id} |
run_workflow(workflow_id, request=...) |
POST /v1/workflow-definitions/{workflow_id}/run |
batch_create_workflows(workflows) |
POST /v1/workflow-definitions/batch |
batch_get_workflows(workflow_ids) |
POST /v1/workflow-definitions/batch/get |
batch_update_workflows(items) |
PUT /v1/workflow-definitions/batch |
batch_delete_workflows(workflow_ids) |
POST /v1/workflow-definitions/batch/delete |
batch_run_workflows(items) |
POST /v1/workflow-definitions/batch/run |
All request/response failures raise FunmillAPIError(message, status_code).
funmill-api— the backend service this client talks to.funmill-dev— the orchestration repo that aggregates bothfunmill-apiandfunmill-sdk.
farfarfun 是一个专注于实用工具库的开源组织, 涵盖云存储、数据处理、AI、多媒体与开发工具链等方向。
- 🏠 组织主页:https://github.com/farfarfun
- 📦 PyPI:https://pypi.org/user/niuliangtao/
- 📧 联系:farfarfun@qq.com
本项目基于 MIT 协议开源。