https://dagster.io/ logo
Title
c

Chris Evans

08/23/2021, 3:46 PM
Morning guys, Been fun working with Dagster so far. Appreciate all the works y’all have put into it. Just had a quick question regarding pipeline execution timestamps. In airflow, one could use the templating feature like so
"{{ ds }}"
to get the execution timestamp of a DAG. The only way I could come up w/ to something similar was with the below code which requires run storage. I’m curious if there is a simpler way to obtain this information?
from dagster import pipeline, repository, schedule, solid
from dagster.core.storage.pipeline_run import PipelineRunsFilter


@solid
def hello(context):
    filter = PipelineRunsFilter(run_ids=[context.run_id])
    run_record = context.get_step_execution_context().instance.run_storage.get_run_records(filters=filter)
y

Yassine Marzougui

08/23/2021, 4:48 PM
Hi, maybe something like this?
stats = context.instance.event_log_storage.get_stats_for_run(context.run_id)
The execution date would be
stats.launch_time
and the start date would be
stats.start_time
.
c

Chris Evans

08/23/2021, 6:10 PM
Thank you!