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, CPU-bound flag, and tags.
Pass --tags/-t (repeatable) to only list tasks that have at least one of the given tags:
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 top level field of the task params model is a CLI option, named after the field with underscores turned into dashes:
Values are written as they are, not as JSON, and validated by the params model:
- strings, emails, decimals, dates, datetimes and secrets are plain strings,
--email luca@example.com,--dt 2026-01-01T10:00:00 - integers and floats are numbers,
--count 3 - booleans are flags,
--erroror--no-error - enums and literals accept one of their values,
--color green - a list of plain values is passed by repeating the option,
--tag a --tag b - structured values, such as a nested model or a dictionary, are passed as JSON
Options left out are not sent, so the model defaults apply. A required field can
be given either as an option or in --params.
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:
--params-from-broker¶
Load the parameters the task consumer stored in the broker for --run-id. This
is how a CPU bound task receives its
parameters: the consumer stores them before starting the process, or the
Kubernetes Job, and the process reads and removes them. They are kept off the
command line because any user on the host, or anyone who can read the Job, can
see it. Parameters given as options or with --params are applied on top.
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:
|