From 230edf82deea9c415d39facdaafbc351cb1b503b Mon Sep 17 00:00:00 2001 From: Jonathan Castello Date: Wed, 6 Sep 2023 08:24:53 -0700 Subject: [PATCH] Remove spans around regular spawns and calls --- .../merlin/driver/engine/SimulationEngine.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/merlin-driver/src/main/java/gov/nasa/jpl/aerie/merlin/driver/engine/SimulationEngine.java b/merlin-driver/src/main/java/gov/nasa/jpl/aerie/merlin/driver/engine/SimulationEngine.java index b951a2fa52..0999200466 100644 --- a/merlin-driver/src/main/java/gov/nasa/jpl/aerie/merlin/driver/engine/SimulationEngine.java +++ b/merlin-driver/src/main/java/gov/nasa/jpl/aerie/merlin/driver/engine/SimulationEngine.java @@ -225,14 +225,9 @@ private void stepEffectModel( this.tasks.put(task, progress.continueWith(scheduler.span, scheduler.shadowedSpans, s.continuation())); this.scheduledJobs.schedule(JobId.forTask(task), SubInstant.Tasks.at(currentTime.plus(s.delay()))); } else if (status instanceof TaskStatus.CallingTask s) { - // TODO: Not *every* task should get a new span. Allow the model to decide where spans go. - final var targetSpan = SpanId.generate(); - SimulationEngine.this.spans.put(targetSpan, new Span(Optional.of(progress.span()), currentTime, Optional.empty())); - SimulationEngine.this.spanTasks.get(progress.span()).increment(); - final var target = TaskId.generate(); - SimulationEngine.this.spanTasks.put(targetSpan, new MutableInt(1)); - SimulationEngine.this.tasks.put(target, new ExecutionState<>(targetSpan, 0, Optional.of(task), s.child().create(this.executor))); + SimulationEngine.this.spanTasks.put(scheduler.span, new MutableInt(1)); + SimulationEngine.this.tasks.put(target, new ExecutionState<>(scheduler.span, 0, Optional.of(task), s.child().create(this.executor))); SimulationEngine.this.blockedTasks.put(task, new MutableInt(1)); frame.signal(JobId.forTask(target)); @@ -680,14 +675,9 @@ public void emit(final EventType event, final Topic topic @Override public void spawn(final TaskFactory state) { - // TODO: Not *every* task should get a new span. Allow the model to decide where spans go. - final var taskSpan = SpanId.generate(); - SimulationEngine.this.spans.put(taskSpan, new Span(Optional.of(this.span), this.currentTime, Optional.empty())); - SimulationEngine.this.spanTasks.put(taskSpan, new MutableInt(1)); - final var task = TaskId.generate(); SimulationEngine.this.spanTasks.get(this.span).increment(); - SimulationEngine.this.tasks.put(task, new ExecutionState<>(taskSpan, 0, this.caller, state.create(SimulationEngine.this.executor))); + SimulationEngine.this.tasks.put(task, new ExecutionState<>(this.span, 0, this.caller, state.create(SimulationEngine.this.executor))); this.caller.ifPresent($ -> SimulationEngine.this.blockedTasks.get($).increment()); this.frame.signal(JobId.forTask(task)); }