prefect.cli.server

Command line interface for working with the Prefect API and server.

Functions

generate_welcome_blurb

generate_welcome_blurb(base_url: str, ui_enabled: bool) -> str

prestart_check

prestart_check(base_url: str) -> None
Check if PREFECT_API_URL is set in the current profile. If not, prompt the user to set it. Args:
  • base_url: The base URL the server will be running on

start

start(host: str = SettingsOption(PREFECT_SERVER_API_HOST), port: int = SettingsOption(PREFECT_SERVER_API_PORT), keep_alive_timeout: int = SettingsOption(PREFECT_SERVER_API_KEEPALIVE_TIMEOUT), log_level: str = SettingsOption(PREFECT_SERVER_LOGGING_LEVEL), scheduler: bool = SettingsOption(PREFECT_API_SERVICES_SCHEDULER_ENABLED), analytics: bool = SettingsOption(PREFECT_SERVER_ANALYTICS_ENABLED, '--analytics-on/--analytics-off'), late_runs: bool = SettingsOption(PREFECT_API_SERVICES_LATE_RUNS_ENABLED), ui: bool = SettingsOption(PREFECT_UI_ENABLED), no_services: bool = typer.Option(False, '--no-services', help='Only run the webserver API and UI'), background: bool = typer.Option(False, '--background', '-b', help='Run the server in the background'))
Start a Prefect server instance

stop

stop()
Stop a Prefect server instance running in the background

reset

reset(yes: bool = typer.Option(False, '--yes', '-y'))
Drop and recreate all Prefect database tables

upgrade

upgrade(yes: bool = typer.Option(False, '--yes', '-y'), revision: str = typer.Option('head', '-r', help='The revision to pass to `alembic upgrade`. If not provided, runs all migrations.'), dry_run: bool = typer.Option(False, help='Flag to show what migrations would be made without applying them. Will emit sql statements to stdout.'))
Upgrade the Prefect database

downgrade

downgrade(yes: bool = typer.Option(False, '--yes', '-y'), revision: str = typer.Option('-1', '-r', help="The revision to pass to `alembic downgrade`. If not provided, downgrades to the most recent revision. Use 'base' to run all migrations."), dry_run: bool = typer.Option(False, help='Flag to show what migrations would be made without applying them. Will emit sql statements to stdout.'))
Downgrade the Prefect database

revision

revision(message: str = typer.Option(None, '--message', '-m', help='A message to describe the migration.'), autogenerate: bool = False)
Create a new migration for the Prefect database

stamp

stamp(revision: str)
Stamp the revision table with the given revision; don’t run any migrations

run_manager_process

run_manager_process()
This is an internal entrypoint used by prefect server services start --background. Users do not call this directly. We do everything in sync so that the child won’t exit until the user kills it.

list_services

list_services()
List all available services and their status.

start_services

start_services(background: bool = typer.Option(False, '--background', '-b', help='Run the services in the background'))
Start all enabled Prefect services in one process.

stop_services

stop_services()
Stop any background Prefect services that were started.