Hi all, I'm struggling create and run a flow in or...
# prefect-community
v
Hi all, I'm struggling create and run a flow in orion, for some reason orion cloud says "This deployment is deprecated" and "Run" button is inactive The code I run:
Copy code
@flow
def print_hi():
    print(f'Hi, 123')  # Press ⌘F8 to toggle the breakpoint.


deployment = Deployment.build_from_flow(
    name="print_hi",
    flow=print_hi,
    skip_upload=True,
    infrastructure=KubernetesJob(
        image='my-image',
    )
)
deployment.apply()
This created a deployment, but why does it say
Copy code
This deployment is deprecated
With the General Availability release of Prefect 2.0, we modified the approach to creating deployments.
? This is the code from latest test cases, prefect 2.3.1, how can it be deprecated? And why is "Run" button inactive?
my-image
is based on
prefect-onion:latest
and has my flow code in
/opt/prefect/flows
. By the way, how does it know which flow to run if there is more that one flow in that folder?
1
j
This is the message you would see if your deployment was originally created with an earlier (2.0 version). A more recent version of prefect required that such Deployments be recreated. Check out the Docker image tags here. The tags have been updated and don’t include prefect-orion anymore. That might be part of the issue. If you create a deployment with a flow that is baked into a Docker image, the flow that will be used is the flow at the entrypoint specified when you created your deployment. See the “New Docker deployment experience” section of this guide from Anna.
v
@Jeff Hale, thank you for response. but seems this is not the case. I use latest prefect 2.3.1, I've just verified in a new clean env, with new deployment/flow name and I still see this deprecation warning. I have two files: `docker_flow.py`:
Copy code
from prefect import flow

@flow
def docker_flow():
    print(f'Hi, docker')

if __name__ == '__main__':
    docker_flow()
and `ci_cd_process.py`:
Copy code
from prefect.deployments import Deployment
from prefect.infrastructure import KubernetesJob
from docker_flow import docker_flow

deployment = Deployment.build_from_flow(
    name="orion-docker-flow",
    flow=docker_flow,
    work_queue_name="default",
    infrastructure=KubernetesJob(
        image='prefecthq/prefect:2-python3.10',
    )
)
print(deployment.apply())
still same issues, fresh clean env, python 3.10.6 any ideas what could be wrong?
j
I just created a deployment running your earlier code:
Copy code
@flow
def print_hi():
    print(f'Hi, 123')  # Press ⌘F8 to toggle the breakpoint.


deployment = Deployment.build_from_flow(
    name="print_hi",
    flow=print_hi,
    skip_upload=True,
    infrastructure=KubernetesJob(
        image='my-image',
    )
)
deployment.apply()
with 2.3.1 and with Prefect Cloud as the server. No issues. Are you using an Orion server that needs updated to a newer version of Prefect?
v
I'm also using prefect cloud. that's the workspace ur l -https://app.prefect.cloud/account/f0fffa79-1042-47a3-be9d-5ce340f7b002/workspace/2dee0bf8-a589-4fab-afe6-9acb6ea4ad1e I'll try to prepare a docker container, maybe this helps either to reproduce or to realise what's the problem
@Jeff Hale, unbelievable, but it's browser. I have this message in safari, but in chrome it works as expected! attaching screenshots
j
Oh, that’s strange. Maybe it’s a caching issue. Thank you for following up @vk!