https://prefect.io logo
Title
y

Yash

01/27/2022, 11:04 AM
Hi everyone, I trying to figure out how to register the prefect flows with hosted prefect server instead local. Is there any documentation for that?
a

Anna Geller

01/27/2022, 11:08 AM
Yes, check out this page The most important part is this:
[server]
  [server.ui]
  apollo_url="<http://localhost:4200/graphql>"
y

Yash

01/27/2022, 11:12 AM
Its like my prefect register code will be a sep container and prefect server in other container. Im trying to figure out how to make communication between them.
a

Anna Geller

01/27/2022, 11:15 AM
Exactly as I described above 🙂 Replace localhost by your Server public IP and add this configuration to your ~/.prefect/config.toml on the machine from which you register your flows.
[server]
  [server.ui]
  apollo_url="<http://localhost:4200/graphql>"
y

Yash

01/27/2022, 11:17 AM
Thanks anna, I will try to do it in this way. Then what is the use of this particular class
_class_ prefect.client.client.Client
?
a

Anna Geller

01/27/2022, 11:19 AM
to talk to the API from Python e.g. if you want to query the graphQL API - the API reference will give you more info: https://docs.prefect.io/api/latest/client/client.html
y

Yash

02/01/2022, 7:58 AM
@Anna Geller My prefect registration code is one container and prefect server is in other. I tried to pass the graphql server api in this way
client = prefect.Client(api_server=os.getenv('GRAPHQL_SERVICE_HOST'))
. where below are the env when im docker composing my prefect registration code.
environment:
      GRAPHQL_SERVICE_HOST: <http://apollo:4200/graphql>
I was able to fetch all the pre-registered flow and runs, but I was not able to register a flow. Here is how I'm registring
.......
    with Flow(name=group_name) as flow:
        result = create_config(group_name)
        start_orchestration(result[0], result[1], result[2])
    _id = flow.register(project_name='Test')
......