diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2025-06-20 16:07:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 16:07:27 +0200 |
| commit | 8f846655347195bf6f22a4a102aa06f0ab127da1 (patch) | |
| tree | c6a9cb7cdeac9d655ef2ac27a5f7d7572ca810bb /opendc-compute/opendc-compute-simulator/src/main/java | |
| parent | 0df3d9ced743ac3385dd710c7133a6cf369b051c (diff) | |
Task now saves the hostName of connected host, until a new Host is selected. (#347)
Diffstat (limited to 'opendc-compute/opendc-compute-simulator/src/main/java')
2 files changed, 14 insertions, 6 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java index 11394ce9..2b4306af 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java +++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java @@ -205,7 +205,6 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver { LOGGER.error("Unknown host {}", host); } - task.setHost(null); host.delete(task); if (newState == TaskState.COMPLETED) { @@ -523,7 +522,7 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver { LOGGER.info("Assigned task {} to host {}", task, host); try { - task.host = host; + task.setHost(host); task.scheduledAt = clock.instant(); host.spawn(task); @@ -709,7 +708,7 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver { // from.delete(internalTask); - internalTask.host = null; + internalTask.setHost(null); internalTask.setWorkload(workload); internalTask.start(); diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java index 66b69bde..281f75ca 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java +++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java @@ -63,7 +63,9 @@ public class ServiceTask { Instant scheduledAt = null; Instant submittedAt; Instant finishedAt; - SimHost host = null; + private SimHost host = null; + private String hostName = null; + private SchedulingRequest request = null; private int numFailures = 0; @@ -158,8 +160,15 @@ public class ServiceTask { return host; } - public void setHost(SimHost host) { - this.host = host; + public String getHostName() { + return hostName; + } + + public void setHost(SimHost newHost) { + this.host = newHost; + if (newHost != null) { + this.hostName = newHost.getName(); + } } public int getNumFailures() { |
