Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1077 persistent anchors #1390

Merged
merged 11 commits into from
Jun 7, 2024
Merged

1077 persistent anchors #1390

merged 11 commits into from
Jun 7, 2024

Conversation

jmdelfa
Copy link
Contributor

@jmdelfa jmdelfa commented Apr 8, 2024

Description

Inclusion of Persistent Anchors in Coexistence Goal. The anchor definition is optional so that backwards compatibility with older Coexistence Goals is guaranteed. An anchor can be either disabled, to the start of a directive or to its end.
Implementation has focused on mitigating the impact on existing code trying to reuse as much as possible existing AERIE infrastructure. Even so, 40 classes haven been added/modified/deleted. TimeExpression has been heavily re-architected as there were many legacy relations. CoexistenceGoal and PrioritySolver have been modified to account for the indentification and resolution of conflicts related to anchors. The need for new conflict types was explored and discarded for the sake of simplicity.

Verification

Multiple tests have been added, including a dedicated TestPersistentAnchors that explores all possible combinations of anchors and existing/non-existing directives in the plan.

Documentation

No documentation is invalidated. New documentation needs to be produced to explain the anchor behaviour

Future work

This work is self contained and complete. Future extensions such as deeper control on when/how anchors are created should derive from user experience

@jmdelfa jmdelfa added feature A new feature or feature request scheduling Anything related to the scheduling domain labels Apr 8, 2024
@jmdelfa jmdelfa requested a review from a team as a code owner April 8, 2024 21:27
@jmdelfa jmdelfa requested review from dandelany and joswig April 8, 2024 21:27
@jmdelfa jmdelfa requested a review from adrienmaillard April 8, 2024 21:28
@jmdelfa jmdelfa requested review from mattdailis and Mythicaeda April 8, 2024 21:29
@Mythicaeda
Copy link
Contributor

I'm concerned about the e2e test failure:

SchedulingTests > schedulingPostsSimResults() FAILED
    java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "gov.nasa.jpl.***.e2e.types.SchedulingResponse.datasetId()" is null
        at gov.nasa.jpl.***.e2e.SchedulingTests.schedulingPostsSimResults(SchedulingTests.java:358)

datasetId is only null if no simulation results were posted as a result of scheduling. It should not be null in this case, as the first time the plan in this test is simulated is within the scheduling run.

Copy link
Contributor

@adrienmaillard adrienmaillard left a comment

Choose a reason for hiding this comment

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

No major problem. Nice testing.

@jmdelfa jmdelfa force-pushed the 1077-persistent-anchors branch from 6ef16e5 to 3ef1771 Compare April 29, 2024 22:53
Copy link
Contributor

@adrienmaillard adrienmaillard left a comment

Choose a reason for hiding this comment

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

We're almost there. I'll approve after this last batch.

Copy link
Contributor

@adrienmaillard adrienmaillard left a comment

Choose a reason for hiding this comment

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

Looks good now ! thank you.

jmdelfa added 5 commits June 7, 2024 15:59
…ved. All time expressions are actually relative. TimeExpressoinRelatveFixed replaced refactored as TimeExpressionRelativeSimple
…methods. Also add a type method returning the AcitivityType of the directive. Changes used in PrioritySolver, MissingActivityTemplateConflict and goals
…d/update anchorIds

PersistentTimeAnchor.java adds the three states of an anchor: Disabled, anchoring to start or anchoring to end
ActivityExpression.java adds a new matches method to evaluate the time offset considering the absolute time, which is calculated by iteratively navigating the anchors.
GraphQLMerlinService.java provides a new method to update the anchorids in a list of activities
MerlinService.java adds a new method to update a list of SchedulingActivityDirectives from a plan, replacing the anchorids generated by the scheduler by new anchorids provided by the database
Plan.java and PlanInMemory.java provide methods to replace an old activity by a new one
jmdelfa added 6 commits June 7, 2024 15:59
…t. They incorporate the anchorId (if any) and whether the anchor is to Start as information for PrioritySolver.java to solve the conflict
… on anchors. The logic is:

1. If persistentTimeAnchor is disabled, then no anchors are created. There are two scenarios:
1.1 Matching activity found: MissingAssociationConflict created.
1.2 No matching activity found: MissingActivityTemplateConflict created

2. If persistentTimeAnchor is enabled (START or END) then an anchor will be created. There are three scenarios
2.1 Matching activity with anchor found. MissingAssociationConflict created.
2.2 Matching activity found, but only without anchor. MissingAssociationConflict created, passing the ID of the matching activity in order to create the anchor
2.3 No matching activity found: MissingActivityTemplateConflict created
The scenarios are:
If existing activity act is a match but is missing the anchor, then the appropriate anchorId has been included in MissingAssociationConflict. In that case, a new activity must be created as a copy of act but including the anchorId. This activity is then added to all appropriate data structures and the association is created
If there is no match, a MissingActivityTemplateConflict.java has been created, including the ID of the directive to which the new activity should be anchored. In that case, we calculate the absolute start offset and create the new activity with the anchorid
…c classes and mechanism based on EnumMap to define hierarchically subsystem states for system states
…ned a HashMap. That has been superseded by getBidiAcitivbityIdCorrespondence which uses the new type BidiMap. The old method has been removed and the only call to the getActivityIdCorrespondence, in class SynchronousSchedulerAgent, has been modified to receive a BidiMap and then convert to HashMap so that the existing logic doesn't need to be changed.
@dandelany dandelany force-pushed the 1077-persistent-anchors branch from ed75820 to cd3cb33 Compare June 7, 2024 22:59
@dandelany
Copy link
Collaborator

Thanks! This had a failing test before but it passed on re-run so I think it was a fluke. Rebased & merging now.

@dandelany dandelany merged commit 7a2ad4b into develop Jun 7, 2024
6 checks passed
@dandelany dandelany deleted the 1077-persistent-anchors branch June 7, 2024 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature or feature request scheduling Anything related to the scheduling domain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential Bug in ActivityExpression Support Anchor Creation in the Scheduler
6 participants