Greg Roche
03/26/2021, 3:18 PMflow.register()
on such a flow fails with error 'list' object has no attribute 'update'.
A reproducible example is in the thread. Has anybody come across this before or knows how to resolve it?Greg Roche
03/26/2021, 3:19 PMfrom 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.nicholas
flow.register(labels=["foo", "bar"])
)nicholas
Marvin
03/26/2021, 3:21 PMGreg Roche
03/26/2021, 3:21 PMnicholas
Greg Roche
03/26/2021, 3:23 PMnicholas
Jim Crist-Harif
03/26/2021, 3:29 PMrun_config.labels
is a set, not a list. When you manually assign things like this (rather than passing the labels to the run-config construtor) you're using the wrong type and breaking the internals.
Try:
flow.run_config = UniversalRun(labels=["foo", "bar"])
Greg Roche
03/26/2021, 3:40 PM