Skip to content

Conversation

@daveey
Copy link
Contributor

@daveey daveey commented Jan 17, 2026

Add EventConfig class for timestep-based events that apply mutations
to filtered objects. Events can target any GridObject and include:

  • timesteps: list of timesteps when event fires
  • filters: list of filters to select target objects
  • mutations: list of mutations to apply

Includes helper functions:

  • periodic(start, period, end): generate periodic timesteps
  • once(timestep): single timestep event

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

Copy link
Contributor Author

daveey commented Jan 17, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • add-to-merge-queue - adds this PR to the back of the merge queue
  • add-to-merge-queue-as-hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@blacksmith-sh

This comment has been minimized.

@datadog-official

This comment has been minimized.

@daveey daveey marked this pull request as ready for review January 17, 2026 04:07
@daveey daveey requested a review from sasmith January 17, 2026 04:07
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from 78c9396 to adf7819 Compare January 17, 2026 04:37
@daveey daveey force-pushed the 01-16-refactor_mettagrid_remove_clipper_system branch from aa99928 to 4c32137 Compare January 17, 2026 04:37
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from adf7819 to 4809cc6 Compare January 17, 2026 04:42
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch 2 times, most recently from 166d42d to 7643db3 Compare January 17, 2026 05:17
@daveey daveey force-pushed the 01-16-refactor_mettagrid_remove_clipper_system branch 2 times, most recently from 3562405 to 653be6e Compare January 17, 2026 05:19
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from 7643db3 to 7d6268b Compare January 17, 2026 05:19
@daveey daveey force-pushed the 01-16-refactor_mettagrid_remove_clipper_system branch from 653be6e to c9aa87b Compare January 17, 2026 05:25
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from 7d6268b to a726bae Compare January 17, 2026 05:25
@daveey daveey changed the base branch from 01-16-refactor_mettagrid_remove_clipper_system to graphite-base/4954 January 17, 2026 05:34
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from a726bae to f9a8d61 Compare January 17, 2026 05:43
@daveey daveey force-pushed the graphite-base/4954 branch from c9aa87b to e1f2146 Compare January 17, 2026 05:43
@daveey daveey changed the base branch from graphite-base/4954 to 01-16-refactor_mettagrid_remove_clipper_system January 17, 2026 05:43
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from f9a8d61 to 4fca1f2 Compare January 17, 2026 07:04
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from 4fca1f2 to 17b2c02 Compare January 18, 2026 04:38
@daveey daveey force-pushed the 01-16-refactor_mettagrid_remove_clipper_system branch from e1f2146 to a8ff769 Compare January 18, 2026 04:44
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from 17b2c02 to f4d22bd Compare January 18, 2026 04:44
std::sort(_schedule.begin(), _schedule.end(), [](const auto& a, const auto& b) { return a.first < b.first; });
}

std::vector<Event*> EventScheduler::get_events_for_timestep(int timestep) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to get events, we can just execute them. then we don't need to return a vector

…of returning vector

Address review feedback: simplify the interface by having process_timestep()
apply events directly to targets instead of returning a vector of events.
This avoids the vector allocation overhead and simplifies the calling code.

- Rename get_events_for_timestep() to process_timestep()
- process_timestep() takes a callback to get targets and applies events directly
- Returns the count of events that fired

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@daveey daveey force-pushed the 01-16-feat_mettagrid_add_events_system_core_infrastructure_add_eventconfig_class_for_timestep-based_events_that_apply_mutations_to_filtered_objects._events_can_target_any_gridobject_and_include_-_timesteps_list_of_timesteps_when_event branch from f4d22bd to c2870e9 Compare January 18, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants