https://prefect.io logo
Title
a

Alfie

07/26/2020, 10:07 AM
Hello folks, I register a flow in this way:
import prefect
from prefect import task, Flow

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

flow = Flow("hello-flow", tasks=[hello_task])

flow.register(labels=['public'])
But the label of a flow run is:
"type": "LocalEnvironment",
  "labels": [
     "public",
     "AppledeMacBook-Pro.local"
  ],
Is there a way to get rid of label “AppledeMacBook-Pro.local” for it impacts the agent to pick up the flow run? thanks
k

Klemen Strojan

07/27/2020, 5:07 AM
Try this:
from prefect.environments import LocalEnvironment
flow.environment = LocalEnvironment(labels=["public"])
flow.register()
a

Alfie

07/27/2020, 7:03 AM
thanks Klemen, it’s the same for LocalEnvironment is the default. I’m thinking of custom environemnt
k

Klemen Strojan

07/27/2020, 7:06 AM
Hm… what if you register your flow with CLI:
prefect auth login -t $prefect_user_token
prefect register flow -f $FLOW
a

Alfie

07/27/2020, 7:52 AM
Looked at the code and figured out a way:
flow.register(add_default_labels=False)
👍 1
Thanks for your help