Task Manager CLI¶
Command line tools for TaskManager applications.
This module requires the cli extra to be installed:
Setup¶
Wrap your FastAPI app with TaskManagerCLI and call it as the entry point:
from fluid.scheduler.cli import TaskManagerCLI
task_manager_cli = TaskManagerCLI("examples.tasks:task_app")
if __name__ == "__main__":
task_manager_cli()
task_manager_app can be a FastAPI instance, a callable that returns one, or a dotted-import string (resolved at call time so the CLI stays importable without loading the full app).
Commands¶
ls — list registered tasks¶
Prints a table of all registered tasks with their schedule, priority, timeout, and CPU-bound flag.
serve — start the HTTP server¶
Delegates to uvicorn. Pass --reload for development auto-reload.
enable — enable or disable a task¶
exec — execute a task¶
Runs a registered task synchronously and prints the result table.
Each task exposes its params model fields as CLI options (via pydanclick):
Passing parameters as JSON¶
All task parameters can also be supplied together as a JSON string with --params.
Values in --params always take priority over individual CLI option defaults:
This is useful when parameters are complex types or when scripting task execution.
If both --params and individual options are provided, the JSON values win for any
overlapping keys.
# error=true from --params overrides the model default error=false
python -m myapp exec fast --params '{"error": true}'
--run-id¶
Pass a custom run ID to correlate the task run with external systems:
--log¶
Enable structured logging output during execution:
API reference¶
fluid.scheduler.cli.TaskManagerCLI
¶
Bases: LazyGroup
CLI for TaskManager
This class provides a CLI for a TaskManager Application.
It requires to install the cli extra dependencies.
| PARAMETER | DESCRIPTION |
|---|---|
task_manager_app
|
Task manager application. This can be a FastAPI app, a callable that returns a FastAPI app, or a string import path to a FastAPI app.
TYPE:
|
log_config
|
Log configuration parameters. These parameters are passed to the log.config function when configuring logging.
TYPE:
|