`Error while deploying flow: ValidationError({'typ...
# ask-community
v
Error while deploying flow: ValidationError({'type': ['Unsupported value: UniversalRun']
with prefect version
0.14.21
hi! so we have a flow we've registered with our prefect server, but when our agent (also using prefect 0.14.21) picks it up, it throws that error. any idea where to start looking to debug? there isn't a traceback unfortunately so we don't know what's goin wrong
k
Hi @Verun Rahimtoola, so your Flow and Agent are 0.14.21. What about the server version though?
v
checking
where on the UI can i find the version? i know it used to show it before
k
There was a version where this was missing and then it got fixed. See this . I’m figuring out how to get it otherwise
v
yep exactly, that's where i went to look also and it's gone now 😕
k
You can use this query
Copy code
query Api {
  api {
    backend
    mode
    version
    core_version
    release_timestamp
  }
}
You want the core version
v
Copy code
{
  "data": {
    "api": {
      "backend": "SERVER",
      "mode": "normal",
      "version": "2021-01-05",
      "core_version": "0.14.2",
      "release_timestamp": "2021-01-05T22:33:00Z"
    }
  }
}
looks like we're quite behind 😛
ok, i'll upgrade and get back to you!
k
Server and Agent version should be higher than flow version or you get all kinds of undescriptive errors. Sounds good!
v
i see
hi @Kevin Kho so we upgrade our prefect server. now everything is on the same version -
0.14.21
- but we're still seeing that same error
without any other info (like a traceback etc) - any pointers on how we can dig into it a bit?
k
What type of Agent are you using?
v
a local agent
k
Is your flow code simple enough to share?
v
unfortunately no 😞 we also have our own custom executor we're using, although this error is happening when it tries to deploy the flow when someone triggers it from the prefect server UI
k
Did you define a RunConfig?
v
no
do we have to?
we didn't have to do it before, i remember running a local agent myself and having flows being picked up and run successfully on it
k
You shouldn’t, I’ve never seen this error but it might help to do
flow.run_config = LocalRun()
v
i see, ok let me try that now. will update shortly
ok, so it got us past that error, but the serialized flow is no longer unpicklable!
Copy code
Traceback (most recent call last):
  File "/home/aicompute/.local/lib/python3.6/site-packages/prefect/environments/storage/local.py", line 102, in get_flow
    return prefect.core.flow.Flow.load(flow_location)
  File "/home/aicompute/.local/lib/python3.6/site-packages/prefect/core/flow.py", line 1523, in load
    return cloudpickle.load(f)
_pickle.UnpicklingError: invalid load key, '{'.
i tried examining the pickled file using
pickletools
and got this, fyi:
Copy code
ValueError: at position 0, opcode b'{' unknown
has something changed in the way this version of prefect serializes flows?
k
Went through the changelog and not really. Could you use this utility to see if the flow is serializable?
v
ok, let me do that now
yes, it's serializable...
k
Is it possible to try flow without the custom executor first?
v
yeah, let me try a pure prefect flow right now and get back to you
ok i am seeing the same (earlier) error with this very basic flow:
Copy code
from prefect import task, Flow
from prefect.storage import Docker, Local


# import a non-prefect package used for scraping reddit
import praw


@task
def whoami():
        reddit = praw.Reddit(client_id='SI8pN3DSbt0zor',
                                         client_secret='xaxkj7HNh8kwg8e5t4m6KvSrbTI',
                                                                  password='1guiwevlfo00esyy',
                                                                                           user_agent='testscript by /u/fakebot3',
                                                                                                                    username='fakebot3')
        return <http://reddit.user.me|reddit.user.me>()



storage = Local()
flow = Flow("test-local-storage", storage=storage, tasks=[whoami])
when i register the flow with the server and launch a flow run using the prefect server UI, i get that
{'type': ['Unsupported value: UniversalRun']}
error again
everything is on prefect version
0.14.21
, can you pls try to reproduce and check?
by the way, i got that flow from here: https://docs.prefect.io/core/advanced_tutorials/local-debugging.html#locally-check-your-flow-s-docker-storage and simply replaced
Docker
storage with
Local
(so we can test our agent)
k
Can try yep!
v
to get past that error, i did as you said earlier - explicitly specifying a
LocalRun
for the flow's run_config, and it gets past that error, but then leads right back to the other error of:
Copy code
Traceback (most recent call last):
  File "/home/aicompute/.local/lib/python3.6/site-packages/prefect/environments/storage/local.py", line 102, in get_flow
    return prefect.core.flow.Flow.load(flow_location)
  File "/home/aicompute/.local/lib/python3.6/site-packages/prefect/core/flow.py", line 1523, in load
    return cloudpickle.load(f)
_pickle.UnpicklingError: invalid load key, '{'.
so it seems there are two things that need looking into: 1. it seems that when trying to run a flow on a local agent (using
Local
storage) that doesn't explicitly specify a run_config (say,
LocalRun
) things break, and 2. even if we explicitly set
flow.run_config = LocalRun()
it leads to the unpickling error above.
just for reference, here is the complete flow i am using:
Copy code
from prefect import task, Flow
from prefect.storage import Docker, Local
from prefect.run_configs import LocalRun

# import a non-prefect package used for scraping reddit
import praw


@task
def whoami():
        reddit = praw.Reddit(client_id='SI8pN3DSbt0zor',
                                         client_secret='xaxkj7HNh8kwg8e5t4m6KvSrbTI',
                                                                  password='1guiwevlfo00esyy',
                                                                                           user_agent='testscript by /u/fakebot3',
                                                                                                                    username='fakebot3')
        return <http://reddit.user.me|reddit.user.me>()



storage = Local()
flow = Flow("test-local-storage", storage=storage, tasks=[whoami])
flow.run_config = LocalRun()  # have to specify this explicitly, otherwise things break when trying to deploy the flow to the local agent
k
Thanks for the flow….I hope that’s not real secrets and passwords?
v
no that came from the prefect docs 😛
i mean, i have no idea if it's real secrets or not, you'll have to maybe check with the prefect docs team
k
Oh I see lol. My bad.
I spun up server, registered my flow, and spun up the agent all on my local with the same prefect version (0.14.21). I could not replicate unfortunately.
Caveat I got an error with that script cuz of the reddit request so I changed the script to this:
Copy code
from prefect import task, Flow
from prefect.storage import Docker, Local
# import a non-prefect package used for scraping reddit
import praw
@task
def abc():
    return 1

storage = Local()
flow = Flow("test-local-storage", storage=storage, tasks=[abc])
flow.register("omlds")
v
wow, so weird
k
And this is working for me. Removing the Local storage now
I mean adding the RunConfig*
v
wait, but did you try to register with the cli?
because we're using the prefect cli to register the flow.
k
Ah will go that. Could you give me how you registered? Is it just
prefect register ....
v
(just to make sure it's an apples-to-apples comparison)
prefect register flow --file ./test_local_storage.py
k
It still works (even if
prefect register flow
is deprecated)
v
ok, so you registered and triggered the run on a local agent, right?
k
Yes exactly
v
ok, i see. not sure what's goin on on our end then...
k
Testing on Python 3.6
It’s still working on my end
v
so just to update you on this - it turned out our agent was in fact using some old version of prefect after all. thanks for your help with this!
k
Nice!
🙌 1