Skip to content

Commit

Permalink
mark get_event_records as deprecated (#25504)
Browse files Browse the repository at this point in the history
## Summary & Motivation
We want to restrict the type of events we support fetching records for,
for performance sake.

## How I Tested These Changes
Inspection
  • Loading branch information
prha authored Nov 22, 2024
1 parent 25ca2ca commit 8794192
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions python_modules/dagster/dagster/_core/instance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1988,8 +1988,8 @@ def get_latest_asset_check_evaluation_record(
asset_check_key
)

@public
@traced
@deprecated(breaking_version="2.0")
def get_event_records(
self,
event_records_filter: "EventRecordsFilter",
Expand All @@ -2008,7 +2008,7 @@ def get_event_records(
Returns:
List[EventLogRecord]: List of event log records stored in the event log storage.
"""
from dagster._core.events import DagsterEventType
from dagster._core.events import PIPELINE_EVENTS, DagsterEventType

if (
event_records_filter.event_type == DagsterEventType.ASSET_MATERIALIZATION_PLANNED
Expand All @@ -2018,6 +2018,18 @@ def get_event_records(
"Asset materialization planned events with partitions subsets will not be "
"returned when the event records filter contains the asset_partitions argument"
)
elif event_records_filter.event_type == DagsterEventType.ASSET_MATERIALIZATION:
warnings.warn(
"Use fetch_materializations instead of get_event_records to fetch materialization events."
)
elif event_records_filter.event_type == DagsterEventType.ASSET_OBSERVATION:
warnings.warn(
"Use fetch_observations instead of get_event_records to fetch observation events."
)
elif event_records_filter.event_type in PIPELINE_EVENTS:
warnings.warn(
"Use fetch_run_status_changes instead of get_event_records to fetch run status change events."
)

return self._event_storage.get_event_records(event_records_filter, limit, ascending)

Expand Down

0 comments on commit 8794192

Please sign in to comment.