Hello! I am running the hello-world flow and tryin...
# prefect-community
a
Hello! I am running the hello-world flow and trying to get it running in the cloud. However when I do I get the following error
{'type': ['Unsupported value: UniversalRun']}.
It works locally. Here is my code:
Copy code
import prefect
from prefect import task, Flow

@task
def say_hello():
    logger = prefect.context.get("logger")
    <http://logger.info|logger.info>("Hello, Cloud!")

with Flow("hello-flow") as flow:
    say_hello()

flow.register(project_name="tutorial")
z
Hi @Alex Welch, can you give the output of
prefect diagnostics
?
a
do i run that locally or somewhere in the cloud ui
z
On the machine where your agent is running / the machine where you are writing your flow if they're different
a
z
Great thanks, that looks normal. What kind of agent are you running? Where are you seeing this error?
j
I am running the hello-world flow and trying to get it running in the cloud. However when I do I get the following error
{'type': ['Unsupported value: UniversalRun']}.
In the future when presenting errors, please try to provide some context around where the error message appears and what action(s) led to it. An error message with no context or traceback is hard for us to interpret. From the above discussion, I'm guessing you're seeing that message on the flow run page in the UI? This likely indicates that the agent you're running is on an old version of prefect and should be updated.
a
i am seeing it on the flow run
sorry, i am brand new to prefect so I dont have a lot of knowledge in terms of what information needs to be shared
in the UI
j
no worries, just general feedback to make the process smoother next time. As stated above, this likely means your agent is on an old version of prefect. Not sure what agent you're running or where, but that'd be the first thing I'd check.
a
how do i check the agent version
i installed via
pip install prefect
so i didnt do anything specific
j
Are you running a local agent then?
a
i am
j
In the same environment/terminal that you started the agent, what does
prefect version
output?
a
0.14.8
j
Hmmm, interesting.
Are you the only user of your tenant in prefect cloud?
a
oh really interesting
i ran it in another terminal just to check and i got0.13.14
j
Ah, so you have an old version around somewhere.
An agent running prefect < 0.14.0 would get the error you have, so this is likely the issue.
a
makesd sense
ill run in it in the terminal with that version and see what happens
z
The
which prefect
command might help you track down where the other version is coming from
👍 1
a
it worked
awesome
thank you
for my edification, the cloud UI is using my local agent to manage all the scheduling and the like correct?
so I would need to set up an other agent which would be responsible for our production runs
z
The backend schedules the runs, the local agent just picks them up when they are ready to run.
You'll have to clarify what you mean 🙂
a
fair enough
z
Prefect Agents are lightweight processes for orchestrating flow runs. Agents run inside a user's architecture, and are responsible for starting and monitoring flow runs. During operation the agent process queries the Prefect API for any scheduled flow runs, and allocates resources for them on their respective deployment platforms.
Note that both Prefect Agents (and flow runs) only send requests out to the Prefect API, and never receive requests themselves. This is part of our Hybrid Execution Model, and helps keep your code and data safe.
A single agent can manage many concurrent flow runs - the only reason to have multiple active agents is if you need to support flow runs on different deployment platforms.
a
ok gotcha
so I need to deploy an Agent to our architecture some where
z
To pair development runs with an agent and production runs with another you can use labels
Yep
a
ok, yeah i think tha tmakes sense. Are there any documents (i looked but may have missed) that detail what a production system might look like?
other than hosting then, what is the benefit of the cloud over teh locally ran server
z
Server doesn't scale nearly as well as Cloud and doesn't provide authentication (there is no concept of a user) or "overview" features such as checking on flow runtimes.
a
ok, final question. I’m looking at the docker agent. I was having an issue earlier when trying to use prefect locally via the docker image 
docker run -it prefecthq/prefect:latest
 , when i then run 
prefect server start
 I get a FileNotFoundError looking for a docker-compose file. I am running the command in the docker container.
is this because the official docker container is the agent and not the server?
z
The official docker image is a base image for running flows (as noted in the little blurb it displays)
prefect server start
uses docker-compose to spin up many containers which is tricky to do from within a docker container (I would not recommend trying to run it that way)
a
right, so you need prefect locally as well if you want to execute in the docker container
locally meaning not containerized
z
Ah you need Prefect somewhere if you want to run your own Prefect API
If you want to execute the flow in a docker container you can also do so with a
DockerRun
and Prefect Cloud / Server without necessarily having prefect installed on your development machine
a
but i still need an agent somewhere
z
Yes, you'll need to run a docker/ecs/k8s agent in your infrastructure.
a
thanks
z
This is because all communication with Prefect is one-directional (you -> backend) as a part of the hybrid model so we can't execute anything in your infrastructure.
a
right and that makes sense
and you dont have an option to use agents you’ve provided (something similar to how GitLab does shared runners)
z
Sorry I'm not familiar with their shared runners. By "agent's we've provided" you mean the option of executing flows in our infrastructure or some shared/hosted infrastructure?
a
correct
z
Ah yeah there's nothing like that right now.
a
ok, good to know
thank you for all your help