Skip to content

Use a record instead of a pair for profile segments#434

Merged
mattdailis merged 2 commits intodevelopfrom
refactor/profile-segment-record
Nov 18, 2022
Merged

Use a record instead of a pair for profile segments#434
mattdailis merged 2 commits intodevelopfrom
refactor/profile-segment-record

Conversation

@mattdailis
Copy link
Copy Markdown
Collaborator

  • Tickets addressed: N/A
  • Review: By commit
  • Merge strategy: Merge (no squash)

Description

Profile segments in simulation results are currently represented as a Pair<Duration, Dynamics> - it is difficult to tell from this representation what the meaning of the "Duration" should be. By convention, we interpret the Duration to be the extent of the Profile Segment - i.e. the length of this segment. Other plausible interpretations would be the offset from the start of the plan, as well as the length of the previous segment.

This PR introduces a ProfileSegment record to make it clear which interpretation is being used, and to pave the way for changing that interpretation in the near future. (The current interpretation is somewhat incompatible with streaming - since as it stands you cannot emit a segment until its end time is known).

This PR updates SimulationResults as well as all uses of profiles that have merlin-driver as a dependency. It draws the line at the constraints package, which does not depend on merlin-driver.

As @JoelCourtney pointed out, we have numerous representations of profiles, and it's hard to keep them all straight - while this PR does not reduce the number of representations, it hopefully makes one of those representations a little easier to work with.

Verification

I spun up a local aerie and ran constraints checking, just to make sure that pipeline still works. Otherwise, I consider the fact that the code compiles, and that the tests pass on this PR to be sufficient verification.

Documentation

The ProfileSegment class has associated javadoc, but aside from that no documentation has been updated.

Future work

Future work: simulation results streaming

@mattdailis mattdailis added the refactor A code change that neither fixes a bug nor adds a feature label Nov 8, 2022
@mattdailis mattdailis self-assigned this Nov 8, 2022
@mattdailis mattdailis requested a review from a team as a code owner November 8, 2022 20:53
@mattdailis mattdailis force-pushed the refactor/profile-segment-record branch from d7e4352 to c8b6c6a Compare November 8, 2022 22:04
@mattdailis mattdailis temporarily deployed to e2e-test November 8, 2022 22:05 Inactive
@mattdailis mattdailis force-pushed the refactor/profile-segment-record branch from c8b6c6a to 5c990bf Compare November 9, 2022 19:51
@mattdailis mattdailis temporarily deployed to e2e-test November 9, 2022 19:51 Inactive
@mattdailis mattdailis force-pushed the refactor/profile-segment-record branch from 5c990bf to 08ad7a0 Compare November 9, 2022 21:28
@mattdailis mattdailis temporarily deployed to e2e-test November 9, 2022 21:28 Inactive
@camargo camargo changed the title [REFACTOR] Use a record instead of a pair for profile segments Use a record instead of a pair for profile segments Nov 12, 2022
@camargo camargo added this to the 1.1.0 - Ad Hoc Improvements milestone Nov 15, 2022
@mattdailis mattdailis force-pushed the refactor/profile-segment-record branch from 08ad7a0 to f0960c6 Compare November 17, 2022 18:41
@mattdailis mattdailis temporarily deployed to e2e-test November 17, 2022 18:41 Inactive
@mattdailis mattdailis merged commit e68705b into develop Nov 18, 2022
@mattdailis mattdailis deleted the refactor/profile-segment-record branch November 18, 2022 02:38
@camargo camargo added the breaking change A change that will require updating downstream code label Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change A change that will require updating downstream code refactor A code change that neither fixes a bug nor adds a feature

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants