From a8443400ffc11f5812ce2ff2dbb227f98e154acf Mon Sep 17 00:00:00 2001 From: JoelCourtney Date: Wed, 25 Sep 2024 09:46:06 -0700 Subject: [PATCH] Save activity names in db --- .../scheduler/model/SchedulingActivity.java | 34 ++++++++++++------- .../scheduler/solver/PrioritySolver.java | 3 +- .../scheduler/plan/InMemoryEditablePlan.kt | 3 +- .../GraphQLMerlinDatabaseService.java | 2 ++ 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/model/SchedulingActivity.java b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/model/SchedulingActivity.java index aee1d433e5..b756022cac 100644 --- a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/model/SchedulingActivity.java +++ b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/model/SchedulingActivity.java @@ -41,7 +41,8 @@ public record SchedulingActivity( ActivityDirectiveId topParent, ActivityDirectiveId anchorId, boolean anchoredToStart, - boolean isNew + boolean isNew, + String name ) { public static SchedulingActivity of( @@ -62,7 +63,8 @@ public static SchedulingActivity of( null, anchorId, anchoredToStart, - isNew + isNew, + null ); } @@ -86,12 +88,13 @@ public static SchedulingActivity of( topParent, anchorId, anchoredToStart, - isNew + isNew, + null ); } public SchedulingActivity withNewDuration(Duration duration){ - return SchedulingActivity.of( + return new SchedulingActivity( this.id, this.type, this.startOffset, @@ -100,12 +103,13 @@ public SchedulingActivity withNewDuration(Duration duration){ this.topParent, this.anchorId, this.anchoredToStart, - this.isNew() + this.isNew(), + this.name ); } public SchedulingActivity withNewAnchor(ActivityDirectiveId anchorId, boolean anchoredToStart, Duration startOffset) { - return SchedulingActivity.of( + return new SchedulingActivity( this.id, this.type, startOffset, @@ -114,12 +118,13 @@ public SchedulingActivity withNewAnchor(ActivityDirectiveId anchorId, boolean an this.topParent, anchorId, anchoredToStart, - this.isNew + this.isNew, + this.name ); } public SchedulingActivity withNewDirectiveId(ActivityDirectiveId id) { - return SchedulingActivity.of( + return new SchedulingActivity( id, this.type, startOffset, @@ -128,12 +133,13 @@ public SchedulingActivity withNewDirectiveId(ActivityDirectiveId id) { this.topParent, this.anchorId, this.anchoredToStart, - this.isNew + this.isNew, + this.name ); } public SchedulingActivity withNewTopParent(ActivityDirectiveId topParent) { - return SchedulingActivity.of( + return new SchedulingActivity( this.id, this.type, startOffset, @@ -142,12 +148,13 @@ public SchedulingActivity withNewTopParent(ActivityDirectiveId topParent) { topParent, this.anchorId, this.anchoredToStart, - this.isNew + this.isNew, + this.name ); } public static SchedulingActivity fromExistingActivityDirective(ActivityDirectiveId id, ActivityDirective activity, ActivityType type, Duration duration){ - return SchedulingActivity.of( + return new SchedulingActivity( id, type, activity.startOffset(), @@ -156,7 +163,8 @@ public static SchedulingActivity fromExistingActivityDirective(ActivityDirective null, activity.anchorId(), activity.anchoredToStart(), - false + false, + null ); } diff --git a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java index 3d5fdec293..cc9a5f14c9 100644 --- a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java +++ b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java @@ -1230,7 +1230,8 @@ public Duration valueAt(Duration start, final EquationSolvingAlgorithms.History< null, null, true, - true + true, + null ); Duration computedDuration = null; try { diff --git a/scheduler-driver/src/main/kotlin/gov/nasa/jpl/aerie/scheduler/plan/InMemoryEditablePlan.kt b/scheduler-driver/src/main/kotlin/gov/nasa/jpl/aerie/scheduler/plan/InMemoryEditablePlan.kt index 2652c03abf..275a2c39e1 100644 --- a/scheduler-driver/src/main/kotlin/gov/nasa/jpl/aerie/scheduler/plan/InMemoryEditablePlan.kt +++ b/scheduler-driver/src/main/kotlin/gov/nasa/jpl/aerie/scheduler/plan/InMemoryEditablePlan.kt @@ -122,7 +122,8 @@ data class InMemoryEditablePlan( is DirectiveStart.Absolute -> true is DirectiveStart.Anchor -> s.anchorPoint == DirectiveStart.Anchor.AnchorPoint.Start }, - isNew + isNew, + name ) } } diff --git a/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java b/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java index e9795dedc8..11ee8ef064 100644 --- a/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java +++ b/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java @@ -582,6 +582,8 @@ mutation createAllPlanActivityDirectives($activities: [activity_directive_insert .add("start_offset", act.startOffset().toString()) .add("anchored_to_start", act.anchoredToStart()); + if (act.name() != null) insertionObject = insertionObject.add("name", act.name()); + //add duration to parameters if controllable final var insertionObjectArguments = Json.createObjectBuilder(); if(act.getType().getDurationType() instanceof DurationType.Controllable durationType){