hi all, I'm trying to do a conditional flow, but a...
# prefect-community
z
hi all, I'm trying to do a conditional flow, but as you can see i get matches, check if the matches are valid, and then only want to continue if they are. Because i am passing matches into those tasks, they run regardless of if the condition is true or not. What am i doing wrong here?
Copy code
with flow:
    start_date, end_date = Parameter("start-date", default=None), Parameter("end-date", default=None)
    start_date, end_date = set_date_params(start_date, end_date)
    matches = get_completed_matches_by_date_range(start_date, end_date)
    there_are_matches = are_there_any_matches(matches)
    with case(there_are_matches, True):
        some_data = some_task.run(matches)
k
Why are you calling the
.run
under case?
some_task
should have two upstream with the case and matches and the case should evaluate as False causing it to not run I think
z
thats probably misleading, the module is "some_task" and the function is run
e.g. if im calling it not in flow context i'd do some_task.run.run
k
Ah I see what you mean. I think you can visualize the DAG to see the upstreams?
z
yeah thats what was misleading, but maybe the behavior isn't actually what the dag is showing
i think i understand now
yeah it is working like intended, i just misinterpreted the graph
k
ah ok