Here's the code:
from prefect import Flow, task
from prefect.run_configs import UniversalRun
@task()
def hello_world():
print("hello world")
with Flow("hello_world") as flow:
hello = hello_world()
flow.run_config = UniversalRun()
flow.run_config.labels = ["foo", "bar"]
flow.register(project_name="test-project")
The stacktrace states that the problem occurs in the
obj.labels.update(self.storage.labels)
line of this section of `prefect.core.flow`:
# add auto-labels for various types of storage
for obj in [self.environment, self.run_config]:
if obj is not None:
obj.labels.update(self.storage.labels)
obj.labels.update(labels or ())
If I remove the
flow.run_config.labels = ["foo", "bar"]
line in my example code, the flow registers successfully.