Hi! I need a specific task to run if a previous ta...
# prefect-community
h
Hi! I need a specific task to run if a previous task was completed + it is a certain day of the week. Is there a way to use the schedule component for filters?
👀 2
n
Hi @Hannah Amundson - yes! If for example, this should be run only on a weekday, you could do this to implement the skip logic in your task:
Copy code
from prefect.engine import signals

@task
def my_task():
  is_weekday = datetime.datetime.today().weekday() < 6
  if not is_weekday:
    raise signals.SKIP(message="Wrong day of the week!")

  # do task stuff here
👍 1
And then whichever task should be completed for this to run you could set as an upstream dependency in your flow context.