prefect.cli.shell
Provides a set of tools for executing shell commands as Prefect flows.
Includes functionalities for running shell commands ad-hoc or serving them as Prefect flows,
with options for logging output, scheduling, and deployment customization.
Functions
output_stream
pipe: A file-like object for reading process output.logger_function: A logging function from the logger.
output_collect
pipe: The output pipe of the subprocess, either stdout or stderr.container: A list to store the collected output lines.
run_shell_process
command: The shell command to execute.log_output: If True, the output of the command (both stdout and stderr) is logged to Prefect.stream_stdout: If True, the stdout of the command is streamed to Prefect logs.log_stderr: If True, the stderr of the command is logged to Prefect logs.popen_kwargs: Additional keyword arguments to pass to thesubprocess.Popencall.
watch
command: The shell command to be executed.log_output: If True, logs the command’s output. Defaults to True.flow_run_name: An optional name for the flow run.flow_name: An optional name for the flow. Useful for identification in the Prefect UI.tag: An optional list of tags for categorizing and filtering flows in the Prefect UI.
serve
command: The shell command the flow will execute.name: The name assigned to the flow. This is required..deployment_tags: Optional tags for the deployment to facilitate filtering and organization.log_output: If True, streams the output of the shell command to the Prefect logs. Defaults to True.cron_schedule: A cron expression that defines when the flow will run. If not provided, the flow can be triggered manually.timezone: The timezone for the cron schedule. This is important if the schedule should align with local time.concurrency_limit: The maximum number of instances of the flow that can run simultaneously.deployment_name: The name of the deployment. This helps distinguish deployments within the Prefect platform.run_once: When True, the flow will only run once upon deployment initiation, rather than continuously.