Chris Stefano
03/13/2024, 4:39 PMScout
03/13/2024, 4:39 PMpython from dagster import asset, AssetKey, DagsterEventType, RunsFilter from dagster._core.storage.pipeline_run import IN_PROGRESS_RUN_STATUSES @asset def current_materializations(context): event = context.instance.get_event_records(event_records_filter=EventRecordsFilter(event_type=DagsterEventType.ASSET_MATERIALIZATION_PLANNED, asset_key=AssetKey("foo")), limit=1) in_progress = context.instance.get_runs( filters=RunsFilter( run_ids=[ event[0].event_log_entry.run_id ], statuses=IN_PROGRESS_RUN_STATUSES, ) ) # in_progress is a bool of where the materialization run is currently executing
Please note that IN_PROGRESS_RUN_STATUSES
is a non-public API, and it may change between releases. This means that while the method shown is currently valid, it may be subject to change and should be used with caution. Always refer to the latest documentation for the most up-to-date methods and APIs.