Alex Post
12/04/2019, 6:18 PMwith Flow('Kafka Data Quality Test') as flow:
full_run = Parameter('full_run', default=False)
flow.run(parameters=dict(full_run=True))
and I keep getting this error:
Traceback (most recent call last):
File "src/app.py", line 243, in <module>
flow.run(parameters=dict(full_run=True))
File "/Users/apost/ccde/ccde-kafka-data-quality/venv/lib/python3.7/site-packages/prefect/core/flow.py", line 991, in run
fmt_params
ValueError: Flow.run received the following unexpected parameters: full_run
Has anyone seen this before?josh
12/04/2019, 6:22 PMParameter
does not actually add it to the flow and you will need to either call flow.add_task
for that parameter or use it in another task!@task
def p(param):
print(p)
with Flow('Kafka Data Quality Test') as flow:
full_run = Parameter('full_run', default=False)
p(full_run)
flow.run(parameters=dict(full_run=True))
will workAlex Post
12/04/2019, 6:23 PMjosh
12/04/2019, 6:24 PMAlex Post
12/04/2019, 6:28 PMfrom prefect import Parameter
with Flow("add-example-v3") as f:
# we will instantiate these Parameters here
# but note that does NOT add them to the flow yet
x = Parameter("x", default=1)
y = Parameter("y", default=2)
result = add_task(x=x, y=y) # <-- the moment at which x, y are added to the Flow
print(f.tasks) # {<Task: add_task>, <Parameter: y>, <Parameter: x>}
add_task in f.tasks # False
result in f.tasks # True
x in f.tasks # True
y in f.tasks # True
with Flow('Kafka Data Quality Test') as flow:
# set_envars()
end_date = datetime.utcnow() - timedelta(hours=2)
full_run = Parameter('full_run', default=False)
result = flow.add_task(full_run=full_run)
Traceback (most recent call last):
File "src/app.py", line 231, in <module>
result = flow.add_task(full_run=full_run)
TypeError: add_task() got an unexpected keyword argument 'full_run'
josh
12/04/2019, 6:30 PMadd_task(full_run)
, full_run
isn’t a kwarg of add_task
as it accepts any task to add to the FlowAlex Post
12/04/2019, 6:32 PMjosh
12/04/2019, 6:32 PMadd_task
which takes in two values and adds them together. Which is different than flow.add_task
which adds a task to a flow 😄Alex Post
12/04/2019, 6:37 PM