Robert Hales
07/30/2021, 4:17 PMtest_reduce
gets skipped but I would like for it to receive [1, 2, 4, 5]
Robert Hales
07/30/2021, 4:18 PM@task(trigger=not_all_skipped)
def test_reduce(test):
return test
@task
def to_map():
return [1, 2, 3, 4, 5]
@task
def test_map(x):
print(x)
if x == 3:
raise SKIP
with prefect.Flow("Test") as flow:
l = to_map()
m = test_map.map(l)
test_reduce(m)
Kevin Kho
test_map
using a FilterTask
to remove the SKIPRobert Hales
07/30/2021, 4:23 PMKevin Kho
@task
def to_map():
return [1, 2, 3, 4, 5]
@task
def test_map(x):
print(x)
if x == 3:
raise SKIP
return x
@task()
def test_reduce(test):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(test)
return test
fil = FilterTask(lambda x: not isinstance(x, BaseException))
with prefect.Flow("Test") as flow:
l = to_map()
m = test_map.map(l)
n = fil(m)
test_reduce(n)
flow.run()
Kevin Kho
Robert Hales
07/30/2021, 4:32 PM