Stephen Lloyd05/26/2022, 2:31 PM
will be a list of the responses and I could iterate over it in a subsequent task, but I’m hoping there is a more efficient method. Can I force a task to fail if the api indicates a failed call? If i do, is there a way to count those?
@task def make_post(creds, task): ... response = requests.request('POST', ...) return response with Flow(stuff, stuff): send_tasks = make_post.map(creds=unmapped(creds), task=data)
Kevin Kho05/26/2022, 2:35 PM
inside it where
is the Prefect signal. And then you can have a reduce task
because the FAIL is an Exception so you can look for it like that.
@task def reduce(x: List): total = len(x) fail = len[1 for _ in x if isinstance(_, BaseException)] success = total - fail