https://dagster.io/ logo
#ask-community
Title
# ask-community
n

Nicholas Pezolano

02/16/2023, 8:42 PM
What's the best approach to handling holidays in a partitioned asset? I created an asset like the following below, should I raise an exception on a holiday? or have it pass along a bool?
Copy code
@asset(partitions_def=my_partitions_def)
def fed_holiday(context) -> bool:
    return is_fed_holiday(context.partition_key)
o

owen

02/16/2023, 9:25 PM
hi! what are you trying to accomplish here? what assets are you imagining to be downstream of this, and how will they use this information?
n

Nicholas Pezolano

02/16/2023, 9:28 PM
Essentially on a holiday I want everything downstream NOT to run
o

owen

02/16/2023, 9:30 PM
would you want those downstream assets to ever fill in partitions for those holidays (i.e. on the next non-holiday day, those partitions would get filled in), or would you want those to remain blank forever?
in general, I think I'd handle this more in the scheduling layer -- creating a custom ScheduleDefinition with a
should_execute
function that detects if it's a federal holiday
n

Nicholas Pezolano

02/16/2023, 9:37 PM
Only for the holiday I want it not to run, so the next non-holiday I want it to run
o

owen

02/16/2023, 9:54 PM
got it -- i wouldn't represent this as an asset, I'd just handle not kicking off runs for those dates in the schedule layer
n

Nicholas Pezolano

02/16/2023, 10:03 PM
Sounds good thanks
2 Views