https://prefect.io logo
Title
j

Jeremy Phelps

01/11/2021, 6:38 PM
Hi, I'm having trouble with Prefect Server. It came up, I was able to register a project in it, and I was also able to register a flow. But when I try to run the flow, I get an error:
agent@prefect-agent:~/.prefect/results$ prefect run flow --name 'My first Flow' --project test
    Traceback (most recent call last):
      File "/home/agent/.pyenv/versions/3.7.3/bin/prefect", line 10, in <module>
        sys.exit(cli())
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/prefect/cli/run.py", line 186, in flow
        run_name=run_name,
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/prefect/client/client.py", line 1094, in create_flow_run
        res = self.graphql(create_mutation, variables=dict(input=inputs))
      File "/home/agent/.pyenv/versions/3.7.3/lib/python3.7/site-packages/prefect/client/client.py", line 319, in graphql
        raise ClientError(result["errors"])
    prefect.utilities.exceptions.ClientError: [{'message': "Required parameters were not supplied: {'numbers'}", 'locations': [{'line': 2, 'column': 5}], 'path': ['create_flow_run'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR', 'exception': {'message': "Required parameters were not supplied: {'numbers'}"}}}]
I checked the Docker logs and found this GraphQL error:
GraphQL request:2:3
    1 | mutation ($input: create_flow_run_input!) {
    2 |   create_flow_run(input: $input) {
      |   ^
    3 |     id
    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/graphql/execution/execute.py", line 628, in await_result
        return await result
      File "/prefect-server/src/prefect_server/graphql/extensions.py", line 52, in resolve
        result = await result
      File "/prefect-server/src/prefect_server/graphql/runs.py", line 119, in resolve_create_flow_run
        run_config=input.get("run_config"),
      File "/prefect-server/src/prefect_server/api/runs.py", line 74, in create_flow_run
        run_config=run_config,
      File "/prefect-server/src/prefect_server/api/runs.py", line 215, in _create_flow_run
        raise ValueError(f"Required parameters were not supplied: {missing}")
    ValueError: Required parameters were not supplied: {'numbers'}
a

Alex Cano

01/11/2021, 6:44 PM
It looks like your flow takes a parameter,
numbers
. It doesn’t look like there is a default value, so Server is erroring out because there isn’t a parameter value. You should be able to solve this in one of two ways: • Add a default value for the parameter so that you can create a flow run without specifying a value for
numbers
• Create your flow run with a value for
numbers
If you’re wanting to continue to use the
cli
to run your flow, specify the
--ps
option, which is a stringified JSON object that holds values for your paramters. I’d guess yours should look something like:
prefect run flow --name 'My first Flow --project test --ps '{"numbers": [1, 2, 3]}'
:upvote: 1
j

Jeremy Phelps

01/11/2021, 6:50 PM
It worked. Thanks!
But it gave me a spurious URL: http://localhost:8080/default/flow-run/2407c521-f774-4bb1-8408-8dbf6f3e9329 It should have given me a URL on 192.168.0.250, where the server is running.
a

Alex Cano

01/11/2021, 6:56 PM
Is that the same address that your UI is located at? I believe that URL that’s returned is built using the UI address, not where your API address is (since those things can be run on different machines altogether)
j

Jeremy Phelps

01/11/2021, 6:57 PM
I'm running the Docker image, which I believe has the API, UI, Postgres, and more.
There's a
docker-proxy
process listening on port 8080 on that machine.
a

Alex Cano

01/11/2021, 7:02 PM
So you started Server via the prefect cli, so those would all be on the same machine (running within docker-compose as an FYI). I’m not familiar with what a
docker-proxy
process does for you offhand, does it just forward traffic from one location to another? Like do you have this set up externally to Server so that traffic at
localhost:8080
gets forwarded to one of the services specifically?
j

Jeremy Phelps

01/11/2021, 7:04 PM
I have no idea. I just ran
prefect server start
, it started the Docker images, and I was able to connect to the API from the other machine with no additional configuration.
a

Alex Cano

01/11/2021, 7:07 PM
Ah okay, that was a piece I missed (you’re not running this all on one machine). Did you run the
prefect run flow
command on the same machine running your Server? Because if that’s the case, I’m guessing the CLI is seeing that Server is on localhost. Additionally, do you have a configuration file with the value for`server.ui.endpoint` ? Or are you using the default?
j

Jeremy Phelps

01/11/2021, 7:07 PM
No, I ran
prefect run flow
on the other machine, where the Agent is set up.
👍 1
Is the UI's address configured on the client side and not the server side?
I have another problem: The flow isn't running. It's stuck in the "Scheduled" state. Someone else had the same problem, but in their case it was caused by "labels". My task doesn't appear to have any labels (judging from the output of
prefect describe flow-runs
), and the Agent isn't using any either.
a

Alex Cano

01/11/2021, 7:15 PM
The UI’s address is specified server side, however (I believe) you also then need to update the value for the configuration on the client side as well, otherwise it’ll use the default values. If your agent isn’t running on the same machine as your Server, I’m guessing that the agent’s configuration is the one you need to look at Can you start a new thread with the flow stuck in “Scheduled” in the
#prefect-community
channel? It’ll likely be solved more quickly there!
:upvote: 1
j

Jeremy Phelps

01/11/2021, 7:15 PM
Ok.