-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1560 from NASA-AMMOS/feat/proc-external-profiles
External profiles in procedural scheduling
- Loading branch information
Showing
20 changed files
with
550 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@WithMappers(BasicValueMappers.class) | ||
package gov.nasa.jpl.aerie.e2e.procedural.scheduling; | ||
|
||
import gov.nasa.jpl.aerie.contrib.serialization.rulesets.BasicValueMappers; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.annotations.WithMappers; |
40 changes: 40 additions & 0 deletions
40
...main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/DumbRecurrenceGoal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package gov.nasa.jpl.aerie.e2e.procedural.scheduling.procedures; | ||
|
||
import gov.nasa.ammos.aerie.procedural.scheduling.plan.EditablePlan; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.Goal; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.annotations.SchedulingProcedure; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.plan.NewDirective; | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.AnyDirective; | ||
import gov.nasa.jpl.aerie.merlin.protocol.types.Duration; | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.DirectiveStart; | ||
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Waits 24hrs into the plan, then places `quantity` number of BiteBanana activities, | ||
* one every 6hrs. | ||
*/ | ||
@SchedulingProcedure | ||
public record DumbRecurrenceGoal(int quantity) implements Goal { | ||
@Override | ||
public void run(@NotNull final EditablePlan plan) { | ||
final var firstTime = Duration.hours(24); | ||
final var step = Duration.hours(6); | ||
|
||
var currentTime = firstTime; | ||
for (var i = 0; i < quantity; i++) { | ||
plan.create( | ||
new NewDirective( | ||
new AnyDirective(Map.of("biteSize", SerializedValue.of(1))), | ||
"It's a bite banana activity", | ||
"BiteBanana", | ||
new DirectiveStart.Absolute(currentTime) | ||
) | ||
); | ||
currentTime = currentTime.plus(step); | ||
} | ||
plan.commit(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ain/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ExternalProfileGoal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package gov.nasa.jpl.aerie.e2e.procedural.scheduling.procedures; | ||
|
||
import gov.nasa.ammos.aerie.procedural.scheduling.Goal; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.annotations.SchedulingProcedure; | ||
import gov.nasa.ammos.aerie.procedural.scheduling.plan.EditablePlan; | ||
import gov.nasa.ammos.aerie.procedural.timeline.collections.profiles.Booleans; | ||
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.DirectiveStart; | ||
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Map; | ||
|
||
@SchedulingProcedure | ||
public record ExternalProfileGoal() implements Goal { | ||
@Override | ||
public void run(@NotNull final EditablePlan plan) { | ||
final var myBoolean = plan.resource("/my_boolean", Booleans.deserializer()); | ||
for (final var interval: myBoolean.highlightTrue()) { | ||
plan.create( | ||
"BiteBanana", | ||
new DirectiveStart.Absolute(interval.start), | ||
Map.of("biteSize", SerializedValue.of(1)) | ||
); | ||
} | ||
|
||
plan.commit(); | ||
} | ||
} |
Oops, something went wrong.