I'm running a flow that uses two subflows via `Sta...
# ask-community
j
I'm running a flow that uses two subflows via
StartFlowRun
and the parent flow is throwing
ValueError: Failed to find current tenant None in result {'data': {'tenant'...
The subflows are triggering and running correctly, but it looks as though the parent flow can't view their status? Does the agent running the parent flow need to have a user API key or something attached to it in order to query flow status, but not to submit a flow for execution?
k
Hi @Jeff Baatz, this is weird that there is an error but the subflows still run. Are they subflows and parent flow being run on separate agents? I think you need the key to create the flow run since the
StartFlowRun
task uses the
create_flow_run
method of the
Client
under the hood.
j
They are run on different agents, yes. I do actually reuse a token from a service account across a the set of agents that I'm running on, since I didn't feel the need to make a new one. I had assumed that the service account would be enough to trigger jobs. But if it's true that the user API key is needed to start flow runs, that is a bit odd.
k
Could you try using the API key and seeing if it persists?
j
I may also be doing something wrong here. The full exception that comes out at the end is
Copy code
File "/usr/local/lib/python3.6/dist-packages/prefect/client/client.py", line 1249, in get_default_tenant_slug
    f"Failed to find current tenant {self.tenant_id!r} in result {res}"
ValueError: Failed to find current tenant None in result {'data': {'tenant': [{'id': '79a6cbe5-17f0-46b6-9958-3a7ebc21fa74', 'slug': ...}]}}
It looks like the tenant ID isn't being populated at all, which probably means the api token isn't being set. The agent definitely has an API key but I'm wondering if that API key isn't passed through to the docker image in which the parent flow is being executed.
I don't do this, for example:
Copy code
prefect agent docker start --key "<YOUR-KEY>"
I just pass a service account key with the
-t
options. When you say to use the API key, do you mean to add an argument for the
--key
?
I'm guessing this issue is triggered by my funky multi-docker agent setup that I mentioned to you the other day. I think I have a decent grasp about what might be going on so I'll see if I can work it out
k
Yes to the key.
Are you on Prefect 0.15.0 btw?
j
I am now - just upgraded when I realized the --key argument changed from -t.
I'm running into all sorts of docker issues after the upgrade that I'm trying to work through though. Getting
400 Client Error for <http+docker://localhost/v1.40/containers/create?name=uncovered-ibis>: Bad Request ("invalid IP address in add-host: "host-gateway"")
back from all runs.
Yeah... not exactly sure what's going on there, but I've had to roll back to 0.14.22 in order to be able to execute anything. If there's any debug info I can pass along let me know. This is on
Docker version 20.10.3, build 48d30b5
, python
docker==5.0.0
(also tried 4.0.2) and prefect
0.15.0
. I noticed that it seems to happen whenever the flow is registered with 0.15.0 core regardless of what version of prefect the agents are running under.
k
What OS are you on?
Yeah I would just downgrade for now
j
The agents are on
Ubuntu 18.04.5 LTS
k
I experienced the same error after upgrading to prefect 0.15.0. After upgrading docker (
Docker version 20.10.4, build d3cb89e
) the error went away.
👍 1