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

Procedural Scheduling #1496

Merged
merged 108 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
7881355
Procedural scheduling build infrastructure
JoelCourtney Mar 14, 2024
576699a
Plan edit and simulation interface
JoelCourtney May 9, 2024
43ff11b
Use SimulatedPlan in Constraint.kt
mattdailis Aug 7, 2024
f0b1c7b
Remove timeline duration duplicate
JoelCourtney May 9, 2024
fabbcf3
Fix inspect function
JoelCourtney Apr 26, 2024
0dfbd8a
Documentation updates
JoelCourtney May 9, 2024
1099d97
Add create overload
JoelCourtney Apr 26, 2024
19bceaf
Move plan and sim result implementations to remote package
JoelCourtney May 9, 2024
d5a0d7e
Rename Procedure to Rule
JoelCourtney May 21, 2024
f8aa585
Fix simulation results identity comparison bug
mattdailis Aug 7, 2024
b2bd1e6
Move timeline library to ammos.aerie.procedural
mattdailis Aug 6, 2024
7d366e4
Move remote package from jpl to ammos
mattdailis Aug 6, 2024
aa9d38d
Move procedural constraints from jpl to ammos
mattdailis Aug 6, 2024
27f644e
Move procedural scheduling from jpl to ammos package
mattdailis Aug 6, 2024
7112e0b
Remove obsolete scheduling jar path
skovati Aug 20, 2024
791202d
Update timeline library for procedural scheduling
mattdailis Aug 7, 2024
097a173
Use ActivityDirectiveId and ActivityInstanceId in timeline
mattdailis Aug 7, 2024
5acf7d5
Return initial sim results if latest is null
JoelCourtney Jul 9, 2024
ac8c53c
Use switch instead of if in GoalBuilder
mattdailis Aug 7, 2024
37259b4
Implement database changes for goal invocations
skovati Aug 20, 2024
69a324b
Update scheduler server to handle goal invocation id
skovati Aug 20, 2024
1e70194
Implement Procedural Scheduling
mattdailis Aug 7, 2024
b0aaadb
Implement database changes for scheduling procedures
skovati Aug 20, 2024
8f17c64
Add hook to update scheduling procedure parameters
mattdailis Aug 7, 2024
43cedae
Implement annotation processor for scheduling procedures
mattdailis Aug 7, 2024
9db34ef
Update procedural constraints to use ActivityId from merlin
mattdailis Aug 7, 2024
4fb64b4
Add examples of scheduling procedures and constraints
mattdailis Aug 6, 2024
3abc3fd
Build procedure jars in CI
skovati Aug 20, 2024
22b1ef1
Update e2e tests
skovati Aug 20, 2024
ddb5692
add simple db test for goal / procedure type DB constraint check
skovati Aug 20, 2024
6d881b9
Create interval step function
JoelCourtney Aug 14, 2024
313fce9
Update to kotlin 2.0
JoelCourtney Aug 23, 2024
741836d
Fixes after rebase
JoelCourtney Aug 23, 2024
6b48187
Add double constructors for Duration
JoelCourtney Aug 28, 2024
5bd5d8b
Misc timeline improvements and bug fixes
JoelCourtney Aug 28, 2024
e0df9f6
Fix out of bounds error in coalesce
JoelCourtney Aug 29, 2024
69b37a4
Fix checkpoint sim up-to-date check
JoelCourtney Aug 29, 2024
23acb8a
Improve uncommitted activities error
JoelCourtney Aug 29, 2024
e72eeba
Fix activity start time bug
JoelCourtney Aug 29, 2024
178bc4a
Remove duplicate activites
JoelCourtney Aug 29, 2024
391cb94
Set expected duration
JoelCourtney Aug 29, 2024
addbabe
Validate activity arguments
JoelCourtney Aug 29, 2024
11254f2
Add complex test case
JoelCourtney Aug 29, 2024
e95fdd1
Rename Rule to Goal
JoelCourtney Aug 29, 2024
d152593
bump migration ids
skovati Sep 3, 2024
25e451c
Rename Intervals to Universal
JoelCourtney Sep 3, 2024
8472e44
Add extra highlight and split varieties
JoelCourtney Sep 3, 2024
72b81d4
Fix one e2e test
JoelCourtney Sep 3, 2024
c261313
Mock activity instances in sim result injection test
JoelCourtney Sep 3, 2024
4305a70
Small timeline QOL updates
JoelCourtney Sep 4, 2024
f32a889
Rebase after stateless aerie
JoelCourtney Sep 4, 2024
96af26e
Add parentId field to instances
JoelCourtney Sep 4, 2024
d87027f
remove procedural-scheduling comment from goal_invocations migration
skovati Sep 4, 2024
f63138e
explictly mark columns as non-null before PKing
skovati Sep 4, 2024
76bf92b
use FK config mapping instead of manual config
skovati Sep 4, 2024
2199df4
add more db-tests to check goal definition type constraint
skovati Sep 4, 2024
6b19cbf
remove update permissions for event trigger
skovati Sep 4, 2024
a4c8914
add new explicit `set not null` statements
skovati Sep 4, 2024
06c12c8
update comments in migration
skovati Sep 4, 2024
6802a24
merge proc sched migrations into one
skovati Sep 4, 2024
a9150f4
rename 10th migration
skovati Sep 4, 2024
43bf7d4
fix sql syntax
skovati Sep 4, 2024
0dff759
Better deserializer for constants
JoelCourtney Sep 4, 2024
c6751c5
fix foreign key array relationship metadata
skovati Sep 4, 2024
b7f0a31
Small rework for deserializers
JoelCourtney Sep 5, 2024
50e2f0d
restore `scheduling_goal_analysis` table comment
skovati Sep 5, 2024
45bc2ab
fix sql comments about explictly setting not null
skovati Sep 5, 2024
5912d58
inline `set not null` into existing PK table alter statements
skovati Sep 5, 2024
fdb6e81
reset directiveId vars in `beforeEach`
skovati Sep 5, 2024
05086a7
Minor edits
JoelCourtney Sep 5, 2024
7cb74b9
Fix plan duplication bug
JoelCourtney Sep 5, 2024
413f17d
use `GoalSource` instead of string for additional context
skovati Sep 5, 2024
ecb8f5f
update to `com.gradleup.shadow`
skovati Sep 5, 2024
f8f3527
use `GoalSource` in test instantiation
skovati Sep 5, 2024
5d1ca87
also find and replace goooler plugin
skovati Sep 5, 2024
da3b564
Fix foo-procedures readme
JoelCourtney Sep 5, 2024
249da9c
Clarify remote docs
JoelCourtney Sep 5, 2024
3724f83
Implement GoalInvocationId.fromJSON
JoelCourtney Sep 5, 2024
c57a149
Clarify duration range explanation
JoelCourtney Sep 5, 2024
2e35b14
Remove obsolete scheduling goal jar env var
mattdailis Sep 5, 2024
6f88a2f
Update scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/se…
skovati Sep 5, 2024
935328f
Update scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/se…
skovati Sep 6, 2024
556e4e8
Remove references to SCHEDULER_RULES_JAR
mattdailis Sep 6, 2024
15d93de
Add ParallelOps.highlightAll()
JoelCourtney Sep 6, 2024
86fc313
Delete Duration.isEqualTo
JoelCourtney Sep 6, 2024
fade718
remove sim control example in SampleProcedure
skovati Sep 6, 2024
ea48982
Move args to goal invocationr record and represent them as Maps
mattdailis Sep 6, 2024
a274776
remove shadow plugin, not necessary once published
skovati Sep 6, 2024
16bef1b
remove unused imports and small misc changes
skovati Sep 6, 2024
d0637f8
Upgrade dokka
JoelCourtney Sep 6, 2024
60d99b7
Remove extra setLong call
mattdailis Sep 9, 2024
450d568
remove `Optional.of` wrapping to implictly use constructor wrapper in…
skovati Sep 9, 2024
3b487a6
introspect failed scheduling run reasons
skovati Sep 9, 2024
b0c4fd2
Publish kotlin docs to gh pages
JoelCourtney Sep 9, 2024
d230cd2
delete unused `ProcedureLoadingTest` class
skovati Sep 9, 2024
a2a6835
revert null check in GQL DB service anchoring
skovati Sep 9, 2024
c2daa92
unique key on invocation id when serializing
skovati Sep 9, 2024
4559d16
call JSON parsing a SQLException so it gets serialized as DatabaseExc…
skovati Sep 9, 2024
1de8776
add new procedural scheduling test cases
skovati Sep 9, 2024
2e9e834
clean up `SimulationDemo`
skovati Sep 9, 2024
d7df020
remove commented out exception throw
skovati Sep 9, 2024
5fe48b0
remove whitespace
skovati Sep 9, 2024
fd3a649
Remove merlin framework dependency
JoelCourtney Sep 9, 2024
a3348f9
Add missing doc comments
JoelCourtney Sep 9, 2024
6bb972b
Publish procedural libraries
JoelCourtney Sep 9, 2024
d0dfd01
Remove dokka directory of generated docs
JoelCourtney Sep 9, 2024
afc72b0
Reimplement .isEqualTo, as deprecated
JoelCourtney Sep 9, 2024
a974ed3
Expand truncateList doc comment
JoelCourtney Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/scripts/compareDatabasesDown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PGCBADEXPLAIN=./comparison/badexplanations.txt \
PGDB=postgres \
PGBINDIR=/usr/bin \
PGCOMITSCHEMAS="('hdb_catalog'),('pg_catalog'),('information_schema')" \
PGCEXPLANATIONS=./explanations \
./pgcmp
return_code=$?

Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/explanations
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trigger scheduler scheduler.scheduling_goal_definition."notify_hasura_refreshSchedulingProcedureParameterTypes_INSERT"/"INSERT" missing in 1st DB From_RefreshSchedProcParm_Action 2
trigger scheduler scheduler.scheduling_goal_definition."notify_hasura_refreshSchedulingProcedureParameterTypes_UPDATE"/"UPDATE" missing in 1st DB From_RefreshSchedProcParm_Action 2
3 changes: 3 additions & 0 deletions .github/workflows/deploy-to-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
cp -a ./scheduler-worker/scheduling-dsl-compiler/build/docs ./build/scheduling-edsl-api
- name: Build Java Docs
run: ./gradlew javadoc
- name: Build Kotlin Docs
run: ./gradlew dokkaHtmlMultiModule
- name: Copy Java Docs to Build Directory
run: |
cp -a ./constraints/build/docs/javadoc ./build/javadoc/constraints
Expand All @@ -50,6 +52,7 @@ jobs:
cp -a ./scheduler-driver/build/docs/javadoc ./build/javadoc/scheduler-driver
cp -a ./scheduler-server/build/docs/javadoc ./build/javadoc/scheduler-server
cp -a ./scheduler-worker/build/docs/javadoc ./build/javadoc/scheduler-worker
cp -a ./procedural/build/dokka/htmlMultiModule ./build/dokka/procedural-apis
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pgcmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ jobs:
- name: Compare Databases
id: dbcmp
run: |
cp ./.github/scripts/explanations pgcmp
cp ./.github/scripts/compareDatabasesUp.sh pgcmp/compareDatabases.sh
cd pgcmp
./compareDatabases.sh
Expand Down Expand Up @@ -332,6 +333,7 @@ jobs:
- name: Compare Databases
id: dbcmp
run: |
cp ./.github/scripts/explanations pgcmp
cp ./.github/scripts/compareDatabasesDown.sh pgcmp/compareDatabases.sh
cd pgcmp
./compareDatabases.sh
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ jobs:
uses: gradle/actions/setup-gradle@v3
- name: Assemble
run: ./gradlew assemble --parallel
- name: Build scheduling procedure jars for testing
run: ./gradlew procedural:examples:foo-procedures:buildAllSchedulingProcedureJars
- name: Start Services
run: |
docker compose -f ./e2e-tests/docker-compose-test.yml up -d --build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gov.nasa.jpl.aerie.constraints.model;

import gov.nasa.jpl.aerie.constraints.time.Interval;
import gov.nasa.jpl.aerie.merlin.driver.ActivityInstanceId;
import gov.nasa.jpl.aerie.types.ActivityInstanceId;
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue;
import gov.nasa.jpl.aerie.types.ActivityDirectiveId;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package gov.nasa.jpl.aerie.constraints.time;

import gov.nasa.jpl.aerie.merlin.protocol.types.Duration;
import org.apache.commons.lang3.tuple.Pair;

import java.util.Comparator;
import java.util.Objects;

import static gov.nasa.jpl.aerie.constraints.time.Interval.Inclusivity.Exclusive;
Expand Down Expand Up @@ -265,7 +263,7 @@ public boolean contains(Interval x){
}

public boolean isSingleton(){
return this.start.isEqualTo(this.end);
return this.start.equals(this.end);
}

public static Interval betweenClosedOpen(final Duration start, final Duration end) {
Expand All @@ -286,7 +284,7 @@ public int compareTo(final Interval o) {

public static int compareStartToStart(final Interval x, final Interval y) {
// First, order by absolute time.
if (!x.start.isEqualTo(y.start)) {
if (!x.start.equals(y.start)) {
return x.start.compareTo(y.start);
}

Expand All @@ -300,7 +298,7 @@ public static int compareStartToStart(final Interval x, final Interval y) {

public static int compareEndToEnd(final Interval x, final Interval y) {
// First, order by absolute time.
if (!x.end.isEqualTo(y.end)) {
if (!x.end.equals(y.end)) {
return x.end.compareTo(y.end);
}

Expand Down Expand Up @@ -348,7 +346,7 @@ public static int compareEndToStart(final Interval x, final Interval y) {
}

public static boolean meets(final Interval x, final Interval y) {
return (x.end.isEqualTo(y.start)) && (x.endInclusivity != y.startInclusivity);
return (x.end.equals(y.start)) && (x.endInclusivity != y.startInclusivity);
}

public static boolean metBy(final Interval x, final Interval y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static Interval strictUpperBoundsOf(final Interval x) {
*/
public static boolean startBeforeStart(Interval x, Interval y) {
return x.start.shorterThan(y.start) ||
(x.start.isEqualTo(y.start) && (x.includesStart() && !y.includesStart()));
(x.start.equals(y.start) && (x.includesStart() && !y.includesStart()));
}

/**
Expand All @@ -123,7 +123,7 @@ public static boolean startBeforeStart(Interval x, Interval y) {
*/
public static boolean endBeforeStart(Interval x, Interval y) {
return x.end.shorterThan(y.start) ||
(x.end.isEqualTo(y.start) && (!x.includesEnd() || !y.includesStart()));
(x.end.equals(y.start) && (!x.includesEnd() || !y.includesStart()));
}

/**
Expand All @@ -135,7 +135,7 @@ public static boolean endBeforeStart(Interval x, Interval y) {
*/
public static boolean endBeforeEnd(Interval x, Interval y) {
return x.end.shorterThan(y.end) ||
(x.end.isEqualTo(y.end) && (!x.includesEnd() && y.includesEnd()));
(x.end.equals(y.end) && (!x.includesEnd() && y.includesEnd()));
}

/**
Expand Down Expand Up @@ -265,7 +265,7 @@ static boolean startsStrictlyAfter(Interval x, Interval y) {
static boolean endsStrictlyBefore(Interval x, Interval y) {
if (x.isEmpty() || y.isEmpty()) return false;
return x.end.shorterThan(y.start) ||
(x.end.isEqualTo(y.start) && (!x.includesEnd() && !y.includesStart()));
(x.end.equals(y.start) && (!x.includesEnd() && !y.includesStart()));
}

/**
Expand All @@ -277,7 +277,7 @@ static boolean endsStrictlyBefore(Interval x, Interval y) {
*/
static boolean meets(Interval x, Interval y) {
if (x.isEmpty() || y.isEmpty()) return false;
return x.end.isEqualTo(y.start) && (x.endInclusivity != y.startInclusivity);
return x.end.equals(y.start) && (x.endInclusivity != y.startInclusivity);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import gov.nasa.jpl.aerie.merlin.protocol.types.Duration;
import org.apache.commons.lang3.function.TriFunction;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
Expand Down Expand Up @@ -84,7 +83,7 @@ private static <V> boolean invariantsMet(Iterable<Segment<V>> segments) {
if (segment.interval().isEmpty() ||
(oldSegment != null &&
(!endBeforeStart(oldSegment.interval(), segment.interval()) ||
(segment.interval().start.isEqualTo(oldSegment.interval().end) && Objects.equals(segment.value(), oldSegment.value()))))) {
(segment.interval().start.equals(oldSegment.interval().end) && Objects.equals(segment.value(), oldSegment.value()))))) {
segmentsOkay = false;
break;
}
Expand Down Expand Up @@ -324,7 +323,7 @@ IntervalMap<R> map2(
if (!leftDone && (!leftGetNext || leftIter.hasNext())) {
if (leftGetNext) leftNextDefinedSegment = leftIter.next();
leftGetNext = false;
if (leftNextDefinedSegment.interval().start.shorterThan(startTime) || (leftNextDefinedSegment.interval().start.isEqualTo(startTime) && !leftNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
if (leftNextDefinedSegment.interval().start.shorterThan(startTime) || (leftNextDefinedSegment.interval().start.equals(startTime) && !leftNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
leftInterval = leftNextDefinedSegment.interval();
leftValue = Optional.of(leftNextDefinedSegment.value());
leftGetNext = true;
Expand All @@ -345,7 +344,7 @@ IntervalMap<R> map2(
if (!rightDone && (!rightGetNext || rightIter.hasNext())) {
if (rightGetNext) rightNextDefinedSegment = rightIter.next();
rightGetNext = false;
if (rightNextDefinedSegment.interval().start.shorterThan(startTime) || (rightNextDefinedSegment.interval().start.isEqualTo(startTime) && !rightNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
if (rightNextDefinedSegment.interval().start.shorterThan(startTime) || (rightNextDefinedSegment.interval().start.equals(startTime) && !rightNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
rightInterval = rightNextDefinedSegment.interval();
rightValue = Optional.of(rightNextDefinedSegment.value());
rightGetNext = true;
Expand All @@ -363,7 +362,7 @@ IntervalMap<R> map2(
rightValue = Optional.empty();
}

if (leftInterval.end.isEqualTo(rightInterval.end)) {
if (leftInterval.end.equals(rightInterval.end)) {
endTime = leftInterval.end;
if (leftInterval.includesEnd() && rightInterval.includesEnd()) {
endInclusivity = Inclusive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public static <D extends Dynamics<?, D>> Resource<D> shift(Resource<D> resource,
if (interval.shorterThan(ZERO)) {
throw new IllegalArgumentException("Cannot shift resource by negative interval: " + interval);
}
if (interval.isEqualTo(ZERO)) {
if (interval.equals(ZERO)) {
return resource;
}
var cell = resource(initialDynamics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
import org.apache.commons.math3.complex.Complex;

import java.util.Arrays;
import java.util.Optional;
import java.util.function.BiPredicate;
import java.util.function.DoublePredicate;
import java.util.function.Predicate;
import java.util.stream.Stream;

import static gov.nasa.jpl.aerie.contrib.streamline.core.Expiring.expiring;
import static gov.nasa.jpl.aerie.contrib.streamline.core.Expiry.NEVER;
import static gov.nasa.jpl.aerie.contrib.streamline.core.Expiry.expiry;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.EPSILON;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.SECOND;
import static gov.nasa.jpl.aerie.contrib.streamline.modeling.discrete.Discrete.discrete;
Expand Down Expand Up @@ -64,7 +61,7 @@ public Double extract() {

@Override
public Polynomial step(Duration t) {
return t.isEqualTo(ZERO) ? this : polynomial(shift(coefficients(), t.ratioOver(SECOND)));
return t.equals(ZERO) ? this : polynomial(shift(coefficients(), t.ratioOver(SECOND)));
}

public int degree() {
Expand Down
Loading
Loading