Hi <@ULVA73B9P>, we're currently using self hosted...
# ask-marvin
s
Hi @Marvin, we're currently using self hosted prefect, and we're looking at the versioned deployments. Is there a way to execute a specific version of a deployment, other than the live version?
m
thought for 1158.9 seconds
Short answer: not directly. In Prefect 3.x, a manual run always targets the deployment’s current/live version. There isn’t a CLI/API flag like --version/--revision to run an older revision in place. Your options: - Use the UI to roll back temporarily: - Deployment -> Versions -> pick the version -> Set live (or Roll back), run it, then switch the original version back to live. - Create a one-off/duplicate deployment pinned to the desired code (Git SHA or image tag), run it, then delete it. For example, if your code lives in Git:
Copy code
from prefect.flows import Flow

  flow = Flow.from_source(
      source="<https://github.com/org/repo@<commit-sha>>",
      entrypoint="path/to/flow.py:my_flow",
  )
  flow.deploy(name="my-flow-adhoc-<sha>", work_pool_name="my-pool")
Then run it:
Copy code
prefect deployment run "my_flow/my-flow-adhoc-<sha>"
Note: there’s no version flag on run; confirmed by:
Copy code
prefect deployment run --help
References: - Versioned deployments overview and rollback: https://www.prefect.io/blog/how-to-roll-back-deployments-in-prefect-with-deployment-versioning - Prefect 3 how-to on deployments: https://docs-3.prefect.io/v3/how-to-guides/deployments/prefect-yaml - Release notes introducing the feature in OSS: https://docs-3.prefect.io/v3/release-notes/oss/version-3-2 If you tell me whether you want a one-off ad-hoc run or something scheduled/repeatable, I can suggest the cleanest workflow. And yes, I also wish there were a “Run this version” button.