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

Imad Youbi Idrissi

09/04/2022, 6:14 PM
Hello, I'm a newbie to dagster coming from airflow. I often used jinja templates to make sure my dags were idempotent in regards to the date of execution via
{{ds_nodash}}
. Does anyone know how to achieve the same thing with dagster ? I would love a pointer to the documentation in regards to this feature. It constitutes a crucial element that could entice my team to move from airflow. Thanks !
🤖 1
dagster bot responded by community 1
t

Tamas Foldi

09/05/2022, 5:59 PM
this is an interesting question for me, like how do I know the last successful run of a job or the last materialization of an asset?
thank you box 1
i

Imad Youbi Idrissi

09/05/2022, 7:00 PM
t

Tamas Foldi

09/05/2022, 7:08 PM
one option is to use a custom run_id or run_key. that's how some are doing this. but it will not help with last execution dates
i

Imad Youbi Idrissi

09/05/2022, 7:10 PM
It's not possible to get a list of executions via the Metadata or write to the Metadata??
j

Jon Simpson

09/05/2022, 7:10 PM
If your asset is partitioned, or time partitioned, in an Op function you can provide a ‘context: OpExecutionContext’ parameter as the first parameter that will have access to
context.partition_key
or
context.partition_time_window
https://docs.dagster.io/_apidocs/execution#dagster.OpExecutionContext
❤️ 1
1
t

Tamas Foldi

09/05/2022, 7:13 PM
you will get a few out of the box like parent job, etc but I guess you need to specify your own stuff run time, perhaps based on metadata or api stuff
you can create a new run date as tag and pass it along to all ops/assets. but maybe others know better