Skip to content

run

fastagency.cli.cli.run #

run(
    path: Optional[Path] = None,
    *,
    app: Optional[str] = None,
    workflow: Optional[str] = None,
    single_run: bool = False,
    ctx: Context
) -> None
Source code in fastagency/cli/cli.py
@app.command(
    context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
    **_get_help_messages(False),  # type: ignore[arg-type]
)
def run(
    path: Annotated[
        Optional[Path],
        typer.Argument(
            help="A path to a Python file or package directory (with [blue]__init__.py[/blue] files) containing a [bold]FastAgency[/bold] app. If not provided, a default set of paths will be tried."
        ),
    ] = None,
    *,
    app: Annotated[
        Optional[str],
        typer.Option(
            help="The name of the variable that contains the [bold][/bold] app in the imported module or package. If not provided, it is detected automatically."
        ),
    ] = None,
    workflow: Annotated[
        Optional[str],
        typer.Option(
            "--workflow",
            "-w",
            help="The name of the workflow to run. If not provided, the default workflow will be run.",
        ),
    ] = None,
    single_run: Annotated[
        bool,
        typer.Option(
            "--single-run", help="If set, only a single workflow will be executed."
        ),
    ] = False,
    ctx: typer.Context,
) -> None:
    if len(ctx.args) > 0:
        raise NotImplementedError("Extra arguments are not supported in this command.")
    else:
        params: dict[str, Any] = {}

    dev_mode = False
    _run_app(
        path=path,
        app=app,
        workflow=workflow,
        params=params,
        dev_mode=dev_mode,
        single_run=single_run,
    )