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

Improve engine peformance on ancestry traversal #1174

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5f5fb61
Count the number of subtasks remaining before a call() can complete
Twisol Sep 5, 2023
23e2d1e
Resume calling tasks by counting subtasks
Twisol Sep 5, 2023
3e3abe8
Organize tasks into a tree of spans
Twisol Sep 6, 2023
cc1a25e
Replace String with TaskId in several places
Twisol Sep 6, 2023
83a2591
Associate events to spans, not to tasks
Twisol Sep 6, 2023
967c36d
Rename several variables from `task`-based to `span`-based
Twisol Sep 6, 2023
76d43de
Change `isTaskComplete` and `getTaskDuration` to use Span information
Twisol Sep 6, 2023
78e5795
Remove obsolete task lifecycle stages
Twisol Sep 6, 2023
ae3295e
Remove obsolete TaskSignalId
Twisol Sep 6, 2023
26ea90a
Reorganize fields and declarations
Twisol Sep 6, 2023
7d10097
Remove `isSpanComplete`
Twisol Sep 6, 2023
3772484
Rename `subtasks` to `blockedTasks`
Twisol Sep 6, 2023
4e13406
Add an ability for tasks to descend into new spans
Twisol Sep 6, 2023
2df4088
Wrap every directive instance in the scope of a new span
Twisol Sep 6, 2023
65b9774
Remove spans around regular spawns and calls
Twisol Sep 6, 2023
009127e
Fix span counting behavior
mattdailis Mar 21, 2024
ef675db
Rename spanTasks to spanContributors
mattdailis Mar 21, 2024
0ee175a
Update implementations of makeTaskFactory to push and pop spans
mattdailis Mar 21, 2024
6a51f16
Use scheduler.span instead of progress.span
mattdailis Mar 21, 2024
9a21287
Use set-based implementation as an oracle
mattdailis Mar 27, 2024
256f36d
Increment parent count if child hasn't closed
mattdailis Mar 27, 2024
74c7e7f
Remove set-based implementation
mattdailis Mar 27, 2024
34eb4e2
Use switch for TaskStatus matching
mattdailis Mar 28, 2024
b0f8809
Use the term Output instead of Return for task output generic
mattdailis Mar 28, 2024
aae5f1a
Include full stack trace in test failures
mattdailis Mar 28, 2024
e5ae0f5
Use unique plan name in Scheduling e2e test
mattdailis Mar 28, 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
3 changes: 3 additions & 0 deletions constraints/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ java {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions contrib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ java {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions db-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jacocoTestReport {

task e2eTest(type: Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

dependencies {
Expand Down
4 changes: 4 additions & 0 deletions e2e-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ task e2eTest(type: Test) {
// Run the tests in parallel to improve performance
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
useJUnitPlatform()

testLogging {
exceptionFormat = 'full'
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ void beforeEach() throws IOException, InterruptedException {
// Insert the Plan
fooPlan = hasura.createPlan(
fooId,
"Foo Plan - Simulation Tests",
"Foo Plan - Scheduling Tests",
"720:00:00",
planStartTimestamp);

Expand Down
3 changes: 3 additions & 0 deletions examples/banananation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ java {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions examples/config-with-defaults/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jar {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions examples/config-without-defaults/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jar {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions examples/foo-missionmodel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jar {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions examples/minimal-mission-model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jar {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions examples/streamline-demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jar {

test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
3 changes: 3 additions & 0 deletions merlin-driver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ test {
useJUnitPlatform {
includeEngines 'jqwik', 'junit-jupiter'
}
testLogging {
exceptionFormat = 'full'
}
}

jacocoTestReport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ void simulateTask(final MissionModel<Model> missionModel, final TaskFactory<Retu
}

// Schedule all activities.
final var taskId = engine.scheduleTask(elapsedTime, task);
final var spanId = engine.scheduleTask(elapsedTime, task);

// Drive the engine until we're out of time.
// TERMINATION: Actually, we might never break if real time never progresses forward.
while (!engine.isTaskComplete(taskId)) {
while (!engine.getSpan(spanId).isComplete()) {
final var batch = engine.extractNextJobs(Duration.MAX_VALUE);

// Increment real time, if necessary.
Expand Down Expand Up @@ -233,9 +233,11 @@ private static <Model, Output> TaskFactory<Unit> makeTaskFactory(
{
// Emit the current activity (defined by directiveId)
return executor -> scheduler0 -> TaskStatus.calling((TaskFactory<Output>) (executor1 -> scheduler1 -> {
scheduler1.pushSpan();
scheduler1.emit(directiveId, activityTopic);
return task.create(executor1).step(scheduler1);
}), scheduler2 -> {
scheduler2.popSpan();
// When the current activity finishes, get the list of the activities that needed this activity to finish to know their start time
final List<Pair<ActivityDirectiveId, Duration>> dependents = resolved.get(directiveId) == null ? List.of() : resolved.get(directiveId);
// Iterate over the dependents
Expand Down

This file was deleted.

Loading
Loading