MCPcopy
hub / github.com/PrefectHQ/prefect / deploy

Method deploy

src/prefect/flows.py:1628–1777  ·  view source on GitHub ↗

Deploys a flow to run on dynamic infrastructure via a work pool. By default, calling this method will build a Docker image for the flow, push it to a registry, and create a deployment via the Prefect API that will run the flow on the given schedule. If you want to

(
        self,
        name: str,
        work_pool_name: Optional[str] = None,
        image: Optional[Union[str, "DockerImage"]] = None,
        build: bool = True,
        push: bool = True,
        work_queue_name: Optional[str] = None,
        job_variables: Optional[dict[str, Any]] = None,
        interval: Optional[Union[int, float, datetime.timedelta]] = None,
        cron: Optional[str] = None,
        rrule: Optional[str] = None,
        paused: Optional[bool] = None,
        schedule: Optional[Schedule] = None,
        schedules: Optional[list[Schedule]] = None,
        concurrency_limit: Optional[Union[int, ConcurrencyLimitConfig, None]] = None,
        triggers: Optional[list[Union[DeploymentTriggerTypes, TriggerTypes]]] = None,
        parameters: Optional[dict[str, Any]] = None,
        description: Optional[str] = None,
        tags: Optional[list[str]] = None,
        version: Optional[str] = None,
        version_type: Optional[VersionType] = None,
        enforce_parameter_schema: bool = True,
        entrypoint_type: EntrypointType = EntrypointType.FILE_PATH,
        print_next_steps: bool = True,
        ignore_warnings: bool = False,
        _sla: Optional[Union[SlaTypes, list[SlaTypes]]] = None,
    )

Source from the content-addressed store, hash-verified

1626
1627 @async_dispatch(adeploy)
1628 def deploy(
1629 self,
1630 name: str,
1631 work_pool_name: Optional[str] = None,
1632 image: Optional[Union[str, "DockerImage"]] = None,
1633 build: bool = True,
1634 push: bool = True,
1635 work_queue_name: Optional[str] = None,
1636 job_variables: Optional[dict[str, Any]] = None,
1637 interval: Optional[Union[int, float, datetime.timedelta]] = None,
1638 cron: Optional[str] = None,
1639 rrule: Optional[str] = None,
1640 paused: Optional[bool] = None,
1641 schedule: Optional[Schedule] = None,
1642 schedules: Optional[list[Schedule]] = None,
1643 concurrency_limit: Optional[Union[int, ConcurrencyLimitConfig, None]] = None,
1644 triggers: Optional[list[Union[DeploymentTriggerTypes, TriggerTypes]]] = None,
1645 parameters: Optional[dict[str, Any]] = None,
1646 description: Optional[str] = None,
1647 tags: Optional[list[str]] = None,
1648 version: Optional[str] = None,
1649 version_type: Optional[VersionType] = None,
1650 enforce_parameter_schema: bool = True,
1651 entrypoint_type: EntrypointType = EntrypointType.FILE_PATH,
1652 print_next_steps: bool = True,
1653 ignore_warnings: bool = False,
1654 _sla: Optional[Union[SlaTypes, list[SlaTypes]]] = None,
1655 ) -> UUID:
1656 """
1657 Deploys a flow to run on dynamic infrastructure via a work pool.
1658
1659 By default, calling this method will build a Docker image for the flow, push it to a registry,
1660 and create a deployment via the Prefect API that will run the flow on the given schedule.
1661
1662 If you want to use an existing image, you can pass `build=False` to skip building and pushing
1663 an image.
1664
1665 Args:
1666 name: The name to give the created deployment.
1667 work_pool_name: The name of the work pool to use for this deployment. Defaults to
1668 the value of `PREFECT_DEFAULT_WORK_POOL_NAME`.
1669 image: The name of the Docker image to build, including the registry and
1670 repository. Pass a DockerImage instance to customize the Dockerfile used
1671 and build arguments.
1672 build: Whether or not to build a new image for the flow. If False, the provided
1673 image will be used as-is and pulled at runtime.
1674 push: Whether or not to skip pushing the built image to a registry.
1675 work_queue_name: The name of the work queue to use for this deployment's scheduled runs.
1676 If not provided the default work queue for the work pool will be used.
1677 job_variables: Settings used to override the values specified default base job template
1678 of the chosen work pool. Refer to the base job template of the chosen work pool for
1679 available settings.
1680 interval: An interval on which to execute the deployment. Accepts a number or a
1681 timedelta object to create a single schedule. If a number is given, it will be
1682 interpreted as seconds. Also accepts an iterable of numbers or timedelta to create
1683 multiple schedules.
1684 cron: A cron schedule string of when to execute runs of this deployment.
1685 Also accepts an iterable of cron schedule strings to create multiple schedules.

Calls 3

create_callFunction · 0.90
resultMethod · 0.45