https://prefect.io logo
#prefect-community
Title
# prefect-community
a

Amit

08/04/2020, 1:17 PM
Hi there, I added a parameter to a flow, but it still says on the dashboard:
Copy code
@task
def task_process_data(date_to_process):
    if date_to_process is None:
        # calculate
        date_to_process = "some_value"


def flow_process_daily_data(*args, **kwargs):
    with Flow(*args, **kwargs) as flow:
        date_to_process = Parameter('date_to_process', default=None, kind=Parameter.POSITIONAL_OR_KEYWORD)
        task_process_daily_data(date_to_process)
    return flow

flow_process_daily_data(
            name="process-data",
            schedule=Schedule(clocks=[CronClock("0 14 */1 * *")]),
            storage=storage,
)
# Then I build the storage and register the flow here ..
This flow has no parameters ; Click "Run" to launch your flow!
Also, I don't understand why all the examples of Parameters have
flow.run()
called, as I don't call it, since it runs on schedule.
j

Jim Crist-Harif

08/04/2020, 1:37 PM
Hi Amit, - I don't think the prefect
Parameter
class has a
kind
keyword, where are you importing
Parameter
from? Can you add your imports to your example so that I can run it as is?
👍 1
I don't understand why all the examples of Parameters have
flow.run()
called, as I don't call it, since it runs on schedule.
Parameters (if they have defaults) work fine when run on a schedule, but for simplicity most of our examples use
flow.run()
since not every user will be running a flow on a schedule.
🙌 1
a

Amit

08/04/2020, 1:41 PM
Hey Jim, thanks a lot for the explanation. That makes sense. I did a very stupid mistake of importing Parameter from inspect module apparently🤦.
j

Jim Crist-Harif

08/04/2020, 1:42 PM
No worries, glad you figured it out.