summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator/src/main
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2025-11-04 21:09:38 +0100
committerGitHub <noreply@github.com>2025-11-04 21:09:38 +0100
commit71f63618fb83c8e19ae48d5dc4a6e3927031cc10 (patch)
tree6bf4048b1e683bbcac53e162be787e80828e48e2 /opendc-compute/opendc-compute-simulator/src/main
parent59898b873eabc72719376854770c55e8d8efaa0f (diff)
Memory update (#379)
* Updated the memory usage of Tasks. Still in Progress. * Merged Task and ServiceTask -> Currently not fully working!!! * Fixed bugs that made the merger between Task and ServiceTask not work well. * Updated jdk version for Dockerfile * Removed ServiceFlavor.java and Task.kt
Diffstat (limited to 'opendc-compute/opendc-compute-simulator/src/main')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java104
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceFlavor.java142
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceTask.java346
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt11
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/DifferentHostFilter.kt5
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/RamFilter.kt4
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/SameHostFilter.kt5
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuCapacityFilter.kt9
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuFilter.kt4
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuCapacityFilter.kt7
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuFilter.kt2
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/MemorizingTimeshift.kt20
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/TimeshiftScheduler.kt13
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VCpuCapacityWeigher.kt4
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VGpuCapacityWeigher.kt4
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt13
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskInfo.kt2
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt6
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt26
19 files changed, 351 insertions, 376 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 f1e747b3..f357b164 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
@@ -38,7 +38,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.opendc.common.Dispatcher;
import org.opendc.common.util.Pacer;
-import org.opendc.compute.api.Flavor;
import org.opendc.compute.api.TaskState;
import org.opendc.compute.simulator.host.HostListener;
import org.opendc.compute.simulator.host.HostModel;
@@ -123,13 +122,6 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
private final List<Integer> terminatedTasks = new ArrayList<>();
/**
- * The registered flavors for this compute service.
- */
- private final Map<Integer, ServiceFlavor> flavorById = new HashMap<>();
-
- private final List<ServiceFlavor> flavors = new ArrayList<>();
-
- /**
* The registered tasks for this compute service.
*/
private final Map<Integer, ServiceTask> taskById = new HashMap<>();
@@ -176,20 +168,19 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
|| newState == TaskState.PAUSED
|| newState == TaskState.TERMINATED
|| newState == TaskState.FAILED) {
- LOGGER.info("task {} {} {} finished", task.getId(), task.getName(), task.getFlavor());
+ LOGGER.info("task {} {} {} finished", task.getId(), task.getName());
if (activeTasks.remove(task) != null) {
tasksActive--;
}
HostView hv = hostToView.get(host);
- final ServiceFlavor flavor = task.getFlavor();
if (hv != null) {
- hv.provisionedCpuCores -= flavor.getCpuCoreCount();
- hv.availableCpuCores += flavor.getCpuCoreCount();
+ hv.provisionedCpuCores -= task.getCpuCoreCount();
+ hv.availableCpuCores += task.getCpuCoreCount();
hv.instanceCount--;
- hv.availableMemory += flavor.getMemorySize();
- hv.provisionedGpuCores -= flavor.getGpuCoreCount();
+ hv.availableMemory += task.getMemorySize();
+ hv.provisionedGpuCores -= task.getGpuCoreCount();
} else {
LOGGER.error("Unknown host {}", host);
}
@@ -436,10 +427,8 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
long now = clock.millis();
SchedulingRequest request = new SchedulingRequest(task, now);
- ServiceFlavor flavor = task.getFlavor();
-
// If the task has parents, put in blocked tasks
- if (!flavor.getParents().isEmpty()) {
+ if (task.hasParents()) {
blockedTasks.put(task.getId(), request);
return null;
}
@@ -457,17 +446,21 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
void addCompletedTask(ServiceTask completedTask) {
int parentId = completedTask.getId();
- for (int taskId : completedTask.getFlavor().getChildren()) {
- SchedulingRequest request = blockedTasks.get(taskId);
- if (request != null) {
- request.getTask().getFlavor().removeFromParents(parentId);
+ if (!completedTask.hasChildren()) {
+ return;
+ }
- Set<Integer> pendingDependencies = request.getTask().getFlavor().getParents();
+ for (int childTaskId : completedTask.getChildren()) {
+ SchedulingRequest childRequest = blockedTasks.get(childTaskId);
+ if (childRequest != null) {
+ ServiceTask childTask = childRequest.getTask();
+ childTask.removeFromParents(parentId);
- if (pendingDependencies.isEmpty()) {
- taskQueue.add(request);
+ // If the child task has no more parents, it can be scheduled
+ if (!childTask.hasParents()) {
+ taskQueue.add(childRequest);
tasksPending++;
- blockedTasks.remove(taskId);
+ blockedTasks.remove(childTaskId);
}
}
}
@@ -475,8 +468,8 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
void addTerminatedTask(ServiceTask task) {
- for (int taskId : task.getFlavor().getChildren()) {
- SchedulingRequest request = blockedTasks.get(taskId);
+ for (int childTaskId : task.getChildren()) {
+ SchedulingRequest request = blockedTasks.get(childTaskId);
if (request != null) {
ServiceTask childTask = request.getTask();
@@ -491,11 +484,6 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
}
}
- void delete(ServiceFlavor flavor) {
- flavorById.remove(flavor.getTaskId());
- flavors.remove(flavor);
- }
-
void delete(ServiceTask task) {
completedTasks.remove(task);
taskById.remove(task.getId());
@@ -537,12 +525,10 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
final SchedulingRequest req = result.getReq();
final ServiceTask task = req.getTask();
- final ServiceFlavor flavor = task.getFlavor();
-
if (result.getResultType() == SchedulingResultType.FAILURE) {
LOGGER.trace("Task {} selected for scheduling but no capacity available for it at the moment", task);
- if (flavor.getMemorySize() > maxMemory || flavor.getCpuCoreCount() > maxCores) {
+ if (task.getMemorySize() > maxMemory || task.getCpuCoreCount() > maxCores) {
// Remove the incoming image
taskQueue.remove(req);
tasksPending--;
@@ -571,7 +557,7 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
try {
task.setHost(host);
- task.scheduledAt = clock.instant();
+ task.setScheduledAt(clock.millis());
host.spawn(task);
@@ -579,10 +565,10 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
attemptsSuccess++;
hv.instanceCount++;
- hv.provisionedCpuCores += flavor.getCpuCoreCount();
- hv.availableCpuCores -= flavor.getCpuCoreCount();
- hv.availableMemory -= flavor.getMemorySize();
- hv.provisionedGpuCores += flavor.getGpuCoreCount();
+ hv.provisionedCpuCores += task.getCpuCoreCount();
+ hv.availableCpuCores -= task.getCpuCoreCount();
+ hv.availableMemory -= task.getMemorySize();
+ hv.provisionedGpuCores += task.getGpuCoreCount();
activeTasks.put(task, host);
@@ -651,44 +637,15 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
}
@NotNull
- public List<Flavor> queryFlavors() {
- checkOpen();
- return new ArrayList<>(service.flavors);
- }
+ public ServiceTask newTask(ServiceTask task) {
- @NotNull
- public ServiceFlavor newFlavor(
- int taskId,
- int cpuCount,
- long memorySize,
- int gpuCoreCount,
- @NotNull Set<Integer> parents,
- @NotNull Set<Integer> children,
- @NotNull Map<String, ?> meta) {
checkOpen();
final ComputeService service = this.service;
- return new ServiceFlavor(service, taskId, cpuCount, memorySize, gpuCoreCount, parents, children, meta);
- }
+ task.setService(service);
- @NotNull
- public ServiceTask newTask(
- int id,
- @NotNull String name,
- @NotNull TaskNature nature,
- @NotNull Duration duration,
- @NotNull Long deadline,
- @NotNull ServiceFlavor flavor,
- @NotNull Workload workload,
- @NotNull Map<String, ?> meta) {
- checkOpen();
-
- final ComputeService service = this.service;
-
- ServiceTask task = new ServiceTask(service, id, name, nature, duration, deadline, flavor, workload, meta);
-
- service.taskById.put(id, task);
+ service.taskById.put(task.getId(), task);
service.tasksTotal++;
@@ -715,9 +672,6 @@ public final class ComputeService implements AutoCloseable, CarbonReceiver {
@Nullable
public void rescheduleTask(@NotNull ServiceTask task, @NotNull Workload workload) {
ServiceTask internalTask = findTask(task.getId());
- // SimHost from = service.lookupHost(internalTask);
-
- // from.delete(internalTask);
internalTask.setHost(null);
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceFlavor.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceFlavor.java
deleted file mode 100644
index 2d6f0342..00000000
--- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ServiceFlavor.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2022 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.compute.simulator.service;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import org.jetbrains.annotations.NotNull;
-import org.opendc.compute.api.Flavor;
-
-/**
- * Implementation of {@link Flavor} provided by {@link ComputeService}.
- */
-public final class ServiceFlavor implements Flavor {
- private final ComputeService service;
- private final int taskId;
- private final int cpuCoreCount;
- private final long memorySize;
- private final int gpuCoreCount;
- private final Set<Integer> parents;
- private final Set<Integer> children;
- private final Map<String, ?> meta;
-
- ServiceFlavor(
- ComputeService service,
- int taskId,
- int cpuCoreCount,
- long memorySize,
- int gpuCoreCount,
- Set<Integer> parents,
- Set<Integer> children,
- Map<String, ?> meta) {
- this.service = service;
- this.taskId = taskId;
- this.cpuCoreCount = cpuCoreCount;
- this.memorySize = memorySize;
- this.gpuCoreCount = gpuCoreCount;
- this.parents = parents;
- this.children = children;
- this.meta = meta;
- }
-
- @Override
- public int getCpuCoreCount() {
- return cpuCoreCount;
- }
-
- @Override
- public long getMemorySize() {
- return memorySize;
- }
-
- @Override
- public int getGpuCoreCount() {
- return gpuCoreCount;
- }
-
- @Override
- public int getTaskId() {
- return taskId;
- }
-
- @NotNull
- @Override
- public Map<String, Object> getMeta() {
- return Collections.unmodifiableMap(meta);
- }
-
- @Override
- public void reload() {
- // No-op: this object is the source-of-truth
- }
-
- @Override
- public void delete() {
- service.delete(this);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- ServiceFlavor flavor = (ServiceFlavor) o;
- return service.equals(flavor.service) && taskId == flavor.taskId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(service, taskId);
- }
-
- @Override
- public String toString() {
- return "Flavor[name=" + taskId + "]";
- }
-
- public void removeFromParents(List<Integer> completedTasks) {
- for (int task : completedTasks) {
- this.removeFromParents(task);
- }
- }
-
- public void removeFromParents(int completedTask) {
- this.parents.remove(completedTask);
- }
-
- public boolean isInDependencies(int task) {
- return this.parents.contains(task);
- }
-
- @Override
- public @NotNull Set<Integer> getParents() {
- return parents;
- }
-
- @Override
- public @NotNull Set<Integer> getChildren() {
- return children;
- }
-}
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 57bbb7c3..8c066e4f 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
@@ -22,15 +22,11 @@
package org.opendc.compute.simulator.service;
-import java.time.Duration;
-import java.time.Instant;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
+import java.util.Set;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import org.opendc.compute.api.TaskState;
import org.opendc.compute.simulator.TaskWatcher;
import org.opendc.compute.simulator.host.SimHost;
@@ -45,23 +41,32 @@ import org.slf4j.LoggerFactory;
public class ServiceTask {
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceTask.class);
- private final ComputeService service;
+ private ComputeService service;
private final int id;
+ private final ArrayList<Integer> parents;
+ private final Set<Integer> children;
private final String name;
- private final TaskNature nature;
- private final Duration duration;
- private final Long deadline;
- private ServiceFlavor flavor;
+ private final boolean deferrable;
+
+ private final long duration;
+ private long deadline;
public Workload workload;
- private final Map<String, ?> meta; // TODO: remove this
+ private final int cpuCoreCount;
+ private final double cpuCapacity;
+ private final double totalCPULoad;
+ private final long memorySize;
+
+ private final int gpuCoreCount;
+ private final double gpuCapacity;
+ private final long gpuMemorySize;
- private final List<TaskWatcher> watchers = new ArrayList<>();
- private TaskState state = TaskState.CREATED;
- Instant scheduledAt = null;
- Instant submittedAt;
- Instant finishedAt;
+ private final List<TaskWatcher> watchers = new ArrayList<>(1);
+ private int stateOrdinal = TaskState.CREATED.ordinal();
+ private long submittedAt;
+ private long scheduledAt;
+ private long finishedAt;
private SimHost host = null;
private String hostName = null;
@@ -70,115 +75,256 @@ public class ServiceTask {
private int numFailures = 0;
private int numPauses = 0;
- ServiceTask(
- ComputeService service,
- int id,
- String name,
- TaskNature nature,
- Duration duration,
- Long deadline,
- ServiceFlavor flavor,
- Workload workload,
- Map<String, ?> meta) {
- this.service = service;
- this.id = id;
- this.name = name;
- this.nature = nature;
- this.duration = duration;
- this.deadline = deadline;
- this.flavor = flavor;
- this.workload = workload;
- this.meta = meta;
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Getters and Setters
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
- this.submittedAt = this.service.getClock().instant();
+ public ComputeService getService() {
+ return service;
+ }
+
+ public void setService(ComputeService service) {
+ this.service = service;
}
public int getId() {
return id;
}
- @NotNull
- public TaskNature getNature() {
- return nature;
+ public ArrayList<Integer> getParents() {
+ return parents;
}
- @NotNull
- public Duration getDuration() {
+ public Set<Integer> getChildren() {
+ return children;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean getDeferrable() {
+ return deferrable;
+ }
+
+ public long getDuration() {
return duration;
}
- @NotNull
- public Long getDeadline() {
+ public long getDeadline() {
return deadline;
}
- @NotNull
- public String getName() {
- return name;
+ public void setDeadline(long deadline) {
+ this.deadline = deadline;
}
- @NotNull
- public ServiceFlavor getFlavor() {
- return flavor;
+ public Workload getWorkload() {
+ return workload;
}
- @NotNull
- public Map<String, Object> getMeta() {
- return Collections.unmodifiableMap(meta);
+ public void setWorkload(Workload workload) {
+ this.workload = workload;
}
- public void setWorkload(Workload newWorkload) {
- this.workload = newWorkload;
+ public int getCpuCoreCount() {
+ return cpuCoreCount;
+ }
+
+ public double getCpuCapacity() {
+ return cpuCapacity;
+ }
+
+ public double getTotalCPULoad() {
+ return totalCPULoad;
+ }
+
+ public long getMemorySize() {
+ return memorySize;
+ }
+
+ public int getGpuCoreCount() {
+ return gpuCoreCount;
+ }
+
+ public double getGpuCapacity() {
+ return gpuCapacity;
+ }
+
+ public long getGpuMemorySize() {
+ return gpuMemorySize;
+ }
+
+ public List<TaskWatcher> getWatchers() {
+ return watchers;
}
@NotNull
public TaskState getState() {
- return state;
+ return TaskState.getEntries().get(stateOrdinal);
}
- @Nullable
- public Instant getScheduledAt() {
- return scheduledAt;
+ void setState(TaskState newState) {
+ if (this.getState() == newState) {
+ return;
+ }
+
+ for (TaskWatcher watcher : watchers) {
+ watcher.onStateChanged(this, newState);
+ }
+ if (newState == TaskState.FAILED) {
+ this.numFailures++;
+ } else if (newState == TaskState.PAUSED) {
+ this.numPauses++;
+ }
+
+ if ((newState == TaskState.COMPLETED) || (newState == TaskState.FAILED) || (newState == TaskState.TERMINATED)) {
+ this.finishedAt = this.service.getClock().millis();
+ }
+
+ this.stateOrdinal = newState.ordinal();
+ }
+
+ public int getStateOrdinal() {
+ return stateOrdinal;
+ }
+
+ public void setStateOrdinal(int stateOrdinal) {
+ this.stateOrdinal = stateOrdinal;
}
- @Nullable
- public Instant getSubmittedAt() {
+ public long getSubmittedAt() {
return submittedAt;
}
- @Nullable
- public Instant getFinishedAt() {
+ public void setSubmittedAt(long submittedAt) {
+ this.submittedAt = submittedAt;
+ }
+
+ public long getScheduledAt() {
+ return scheduledAt;
+ }
+
+ public void setScheduledAt(long scheduledAt) {
+ this.scheduledAt = scheduledAt;
+ }
+
+ public long getFinishedAt() {
return finishedAt;
}
- /**
- * Return the {@link SimHost} on which the task is running or <code>null</code> if it is not running on a host.
- */
- public SimHost getHost() {
- return host;
+ public void setFinishedAt(long finishedAt) {
+ this.finishedAt = finishedAt;
}
- public String getHostName() {
- return hostName;
+ public SimHost getHost() {
+ return host;
}
public void setHost(SimHost newHost) {
this.host = newHost;
if (newHost != null) {
- this.hostName = newHost.getName();
+ this.setHostName(newHost.getName());
}
}
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public SchedulingRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(SchedulingRequest request) {
+ this.request = request;
+ }
+
public int getNumFailures() {
- return this.numFailures;
+ return numFailures;
+ }
+
+ public void setNumFailures(int numFailures) {
+ this.numFailures = numFailures;
}
public int getNumPauses() {
- return this.numPauses;
+ return numPauses;
+ }
+
+ public void setNumPauses(int numPauses) {
+ this.numPauses = numPauses;
+ }
+
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Constructor and Public Methods
+ /// //////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public ServiceTask(
+ int id,
+ String name,
+ long submissionTime,
+ long duration,
+ int cpuCoreCount,
+ double cpuCapacity,
+ double totalCPULoad,
+ long memorySize,
+ int gpuCoreCount,
+ double gpuCapacity,
+ long gpuMemorySize,
+ Workload workload,
+ boolean deferrable,
+ long deadline,
+ ArrayList<Integer> parents,
+ Set<Integer> children) {
+ this.id = id;
+ this.name = name;
+ this.submittedAt = submissionTime;
+ this.duration = duration;
+ this.workload = workload;
+
+ this.cpuCoreCount = cpuCoreCount;
+ this.cpuCapacity = cpuCapacity;
+ this.totalCPULoad = totalCPULoad;
+ this.memorySize = memorySize;
+
+ this.gpuCoreCount = gpuCoreCount;
+ this.gpuCapacity = gpuCapacity;
+ this.gpuMemorySize = gpuMemorySize;
+
+ this.deferrable = deferrable;
+ this.deadline = deadline;
+
+ this.parents = parents;
+ this.children = children;
+ }
+
+ public ServiceTask copy() {
+ return new ServiceTask(
+ this.id,
+ this.name,
+ this.submittedAt,
+ this.duration,
+ this.cpuCoreCount,
+ this.cpuCapacity,
+ this.totalCPULoad,
+ this.memorySize,
+ this.gpuCoreCount,
+ this.gpuCapacity,
+ 0,
+ this.workload,
+ this.deferrable,
+ this.deadline,
+ this.parents == null ? null : new ArrayList<>(this.parents),
+ this.children == null ? null : Set.copyOf(this.children));
}
public void start() {
- switch (state) {
+ switch (this.getState()) {
case PROVISIONING:
LOGGER.debug("User tried to start task but request is already pending: doing nothing");
case RUNNING:
@@ -224,7 +370,6 @@ public class ServiceTask {
service.delete(this);
this.workload = null;
- this.flavor = null;
this.setState(TaskState.DELETED);
}
@@ -241,38 +386,51 @@ public class ServiceTask {
}
public String toString() {
- return "Task[uid=" + id + ",name=" + name + ",state=" + state + "]";
+ return "Task[uid=" + this.id + ",name=" + this.name + ",state=" + this.getState() + "]";
}
- void setState(TaskState newState) {
- if (this.state == newState) {
+ /**
+ * Cancel the provisioning request if active.
+ */
+ private void cancelProvisioningRequest() {
+ final SchedulingRequest request = this.request;
+ if (request != null) {
+ this.request = null;
+ request.setCancelled(true);
+ }
+ }
+
+ public void removeFromParents(List<Integer> completedTasks) {
+ if (this.parents == null) {
return;
}
- for (TaskWatcher watcher : watchers) {
- watcher.onStateChanged(this, newState);
+ for (int task : completedTasks) {
+ this.removeFromParents(task);
}
- if (newState == TaskState.FAILED) {
- this.numFailures++;
- } else if (newState == TaskState.PAUSED) {
- this.numPauses++;
+ }
+
+ public void removeFromParents(int completedTask) {
+ if (this.parents == null) {
+ return;
}
- if ((newState == TaskState.COMPLETED) || (newState == TaskState.FAILED) || (newState == TaskState.TERMINATED)) {
- this.finishedAt = this.service.getClock().instant();
+ this.parents.remove(Integer.valueOf(completedTask));
+ }
+
+ public boolean hasChildren() {
+ if (children == null) {
+ return false;
}
- this.state = newState;
+ return !children.isEmpty();
}
- /**
- * Cancel the provisioning request if active.
- */
- private void cancelProvisioningRequest() {
- final SchedulingRequest request = this.request;
- if (request != null) {
- this.request = null;
- request.setCancelled(true);
+ public boolean hasParents() {
+ if (parents == null) {
+ return false;
}
+
+ return !parents.isEmpty();
}
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt
index 856cfd3b..cb7d028c 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/host/SimHost.kt
@@ -23,7 +23,6 @@
package org.opendc.compute.simulator.host
import org.opendc.common.ResourceType
-import org.opendc.compute.api.Flavor
import org.opendc.compute.api.TaskState
import org.opendc.compute.simulator.internal.Guest
import org.opendc.compute.simulator.internal.GuestListener
@@ -231,9 +230,9 @@ public class SimHost(
}
public fun canFit(task: ServiceTask): Boolean {
- val sufficientMemory = model.memoryCapacity >= task.flavor.memorySize
- val enoughCpus = model.coreCount >= task.flavor.cpuCoreCount
- val canFit = simMachine!!.canFit(task.flavor.toMachineModel())
+ val sufficientMemory = model.memoryCapacity >= task.memorySize
+ val enoughCpus = model.coreCount >= task.cpuCoreCount
+ val canFit = simMachine!!.canFit(task.toMachineModel())
return sufficientMemory && enoughCpus && canFit
}
@@ -404,10 +403,10 @@ public class SimHost(
/**
* Convert flavor to machine model.
*/
- private fun Flavor.toMachineModel(): MachineModel {
+ private fun ServiceTask.toMachineModel(): MachineModel {
return MachineModel(
simMachine!!.machineModel.cpuModel,
- MemoryUnit("Generic", "Generic", 3200.0, memorySize),
+ MemoryUnit("Generic", "Generic", 3200.0, this.memorySize),
simMachine!!.machineModel.gpuModels,
simMachine!!.machineModel.cpuDistributionStrategy,
simMachine!!.machineModel.gpuDistributionStrategy,
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/DifferentHostFilter.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/DifferentHostFilter.kt
index bc98a575..9d0006a4 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/DifferentHostFilter.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/DifferentHostFilter.kt
@@ -34,7 +34,8 @@ public class DifferentHostFilter : HostFilter {
task: ServiceTask,
): Boolean {
@Suppress("UNCHECKED_CAST")
- val affinityIDs = task.meta["scheduler_hint:different_host"] as? Set<Int> ?: return true
- return host.host.getInstances().none { it.id in affinityIDs }
+ return true // TODO: re-enable different_host filter
+// val affinityIDs = task.meta["scheduler_hint:different_host"] as? Set<Int> ?: return true
+// return host.host.getInstances().none { it.id in affinityIDs }
}
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/RamFilter.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/RamFilter.kt
index fcc5e49c..a58cd408 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/RamFilter.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/RamFilter.kt
@@ -37,9 +37,9 @@ public class RamFilter(private val allocationRatio: Double = 1.0) : HostFilter {
host: HostView,
task: ServiceTask,
): Boolean {
- if (isSimple) return host.availableMemory >= task.flavor.memorySize
+ if (isSimple) return host.availableMemory >= task.memorySize
- val requestedMemory = task.flavor.memorySize
+ val requestedMemory = task.memorySize
val availableMemory = host.availableMemory
val memoryCapacity = host.host.getModel().memoryCapacity
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/SameHostFilter.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/SameHostFilter.kt
index 73fd0d3c..8d5048d3 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/SameHostFilter.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/SameHostFilter.kt
@@ -34,7 +34,8 @@ public class SameHostFilter : HostFilter {
task: ServiceTask,
): Boolean {
@Suppress("UNCHECKED_CAST")
- val affinityIDs = task.meta["scheduler_hint:same_host"] as? Set<Int> ?: return true
- return host.host.getInstances().any { it.id in affinityIDs }
+// val affinityIDs = task.meta["scheduler_hint:same_host"] as? Set<Int> ?: return true
+// return host.host.getInstances().any { it.id in affinityIDs }
+ return true
}
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuCapacityFilter.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuCapacityFilter.kt
index 7fa7a051..72d6be97 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuCapacityFilter.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuCapacityFilter.kt
@@ -34,13 +34,10 @@ public class VCpuCapacityFilter : HostFilter {
host: HostView,
task: ServiceTask,
): Boolean {
- val requiredCapacity = task.flavor.meta["cpu-capacity"] as? Double
+ val requiredCapacity = task.cpuCapacity
val availableCapacity = host.host.getModel().cpuCapacity
- return (
- requiredCapacity == null ||
- (availableCapacity / host.host.getModel().coreCount)
- >= (requiredCapacity / task.flavor.cpuCoreCount)
- )
+ return (availableCapacity / host.host.getModel().coreCount) >=
+ (requiredCapacity / task.cpuCoreCount)
}
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuFilter.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuFilter.kt
index a017c623..2b66fd17 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuFilter.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VCpuFilter.kt
@@ -37,9 +37,9 @@ public class VCpuFilter(private val allocationRatio: Double = 1.0) : HostFilter
host: HostView,
task: ServiceTask,
): Boolean {
- if (isSimple) return host.availableCpuCores >= task.flavor.cpuCoreCount
+ if (isSimple) return host.availableCpuCores >= task.cpuCoreCount
- val requested = task.flavor.cpuCoreCount
+ val requested = task.cpuCoreCount
val totalCores = host.host.getModel().coreCount
// Do not allow an instance to overcommit against itself, only against other instances
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuCapacityFilter.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuCapacityFilter.kt
index 5f517257..bcb4a066 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuCapacityFilter.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuCapacityFilter.kt
@@ -35,14 +35,11 @@ public class VGpuCapacityFilter : HostFilter {
host: HostView,
task: ServiceTask,
): Boolean {
- val requiredCapacity = task.flavor.meta["gpu-capacity"] as? Double
+ val requiredCapacity = task.gpuCapacity
val availableCapacity = (host.host.getModel().gpuHostModels().maxOfOrNull { it.gpuCoreCapacity() } ?: 0).toDouble()
val availableCores = (host.host.getModel().gpuHostModels().maxOfOrNull { it -> it.gpuCoreCount } ?: -1).toDouble()
val availableRatio = availableCapacity / availableCores
- return (
- requiredCapacity == null ||
- (availableRatio >= (requiredCapacity / task.flavor.gpuCoreCount))
- )
+ return availableRatio >= (requiredCapacity / task.gpuCoreCount)
}
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuFilter.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuFilter.kt
index f47013b1..26855944 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuFilter.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/filters/VGpuFilter.kt
@@ -35,7 +35,7 @@ public class VGpuFilter(private val allocationRatio: Double) : HostFilter {
host: HostView,
task: ServiceTask,
): Boolean {
- val requested = task.flavor.gpuCoreCount
+ val requested = task.gpuCoreCount
val totalCores = host.host.getModel().gpuHostModels()?.sumOf { it.gpuCoreCount() } ?: 0
val limit = totalCores * allocationRatio
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/MemorizingTimeshift.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/MemorizingTimeshift.kt
index e0488e30..f84d1a4b 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/MemorizingTimeshift.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/MemorizingTimeshift.kt
@@ -30,7 +30,6 @@ import org.opendc.compute.simulator.scheduler.filters.HostFilter
import org.opendc.compute.simulator.service.HostView
import org.opendc.compute.simulator.service.ServiceTask
import org.opendc.simulator.compute.power.CarbonModel
-import java.time.Instant
import java.time.InstantSource
import java.util.LinkedList
@@ -126,18 +125,25 @@ public class MemorizingTimeshift(
Only delay tasks if they are deferrable and it doesn't violate the deadline.
Separate delay thresholds for short and long tasks.
*/
- if (task.nature.deferrable) {
- val durInHours = task.duration.toHours()
+ if (task.deferrable) {
+ val durInHours = task.duration / (1000.0 * 60.0 * 60.0)
if ((durInHours < 2 && !shortLowCarbon) ||
(durInHours >= 2 && !longLowCarbon)
) {
- val currentTime = clock.instant()
- val estimatedCompletion = currentTime.plus(task.duration)
- val deadline = Instant.ofEpochMilli(task.deadline)
- if (estimatedCompletion.isBefore(deadline)) {
+ val currentTime = clock.millis()
+ val estimatedCompletion = currentTime + task.duration
+ val deadline = task.deadline
+ if (estimatedCompletion <= deadline) {
// No need to schedule this task in a high carbon intensity period
continue
}
+// val currentTime = clock.instant()
+// val estimatedCompletion = currentTime.plus(task.duration)
+// val deadline = Instant.ofEpochMilli(task.deadline)
+// if (estimatedCompletion.isBefore(deadline)) {
+// // No need to schedule this task in a high carbon intensity period
+// continue
+// }
}
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/TimeshiftScheduler.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/TimeshiftScheduler.kt
index 58b8904b..535336e8 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/TimeshiftScheduler.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/timeshift/TimeshiftScheduler.kt
@@ -31,7 +31,6 @@ import org.opendc.compute.simulator.scheduler.weights.HostWeigher
import org.opendc.compute.simulator.service.HostView
import org.opendc.compute.simulator.service.ServiceTask
import org.opendc.simulator.compute.power.CarbonModel
-import java.time.Instant
import java.time.InstantSource
import java.util.LinkedList
import java.util.SplittableRandom
@@ -96,15 +95,15 @@ public class TimeshiftScheduler(
Only delay tasks if they are deferrable and it doesn't violate the deadline.
Separate delay thresholds for short and long tasks.
*/
- if (task.nature.deferrable) {
- val durInHours = task.duration.toHours()
+ if (task.deferrable) {
+ val durInHours = task.duration / (1000.0 * 60.0 * 60.0)
if ((durInHours < 2 && !shortLowCarbon) ||
(durInHours >= 2 && !longLowCarbon)
) {
- val currentTime = clock.instant()
- val estimatedCompletion = currentTime.plus(task.duration)
- val deadline = Instant.ofEpochMilli(task.deadline)
- if (estimatedCompletion.isBefore(deadline)) {
+ val currentTime = clock.millis()
+ val estimatedCompletion = currentTime + task.duration
+ val deadline = task.deadline
+ if (estimatedCompletion < deadline) {
// No need to schedule this task in a high carbon intensity period
continue
}
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VCpuCapacityWeigher.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VCpuCapacityWeigher.kt
index d9b094fb..65cc66a7 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VCpuCapacityWeigher.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VCpuCapacityWeigher.kt
@@ -34,8 +34,8 @@ public class VCpuCapacityWeigher(override val multiplier: Double = 1.0) : HostWe
task: ServiceTask,
): Double {
val model = host.host.getModel()
- val requiredCapacity = task.flavor.meta["cpu-capacity"] as? Double ?: 0.0
- return model.cpuCapacity - requiredCapacity / task.flavor.cpuCoreCount
+ val requiredCapacity = task.cpuCapacity
+ return model.cpuCapacity - requiredCapacity / task.cpuCoreCount
}
override fun toString(): String = "VCpuWeigher"
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VGpuCapacityWeigher.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VGpuCapacityWeigher.kt
index 35f2c7b9..78c49271 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VGpuCapacityWeigher.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/weights/VGpuCapacityWeigher.kt
@@ -34,9 +34,9 @@ public class VGpuCapacityWeigher(override val multiplier: Double = 1.0) : HostWe
task: ServiceTask,
): Double {
val model = host.host.getModel()
- val requiredCapacity = task.flavor.meta["gpu-capacity"] as? Double ?: 0.0
+ val requiredCapacity = task.gpuCapacity
val availableCapacity = model.gpuHostModels.maxOfOrNull { it.gpuCoreCapacity } ?: 0.0
- return availableCapacity - requiredCapacity / task.flavor.gpuCoreCount
+ return availableCapacity - requiredCapacity / task.gpuCoreCount
}
override fun toString(): String = "VGpuWeigher"
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt
index 0397b9a1..b88c75e6 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/parquet/DfltTaskExportColumns.kt
@@ -71,7 +71,12 @@ public object DfltTaskExportColumns {
Types.required(BINARY)
.`as`(LogicalTypeAnnotation.stringType())
.named("task_name"),
- ) { Binary.fromString(it.taskInfo.name) }
+ ) {
+ if (it.taskInfo.name == null) {
+ return@ExportColumn Binary.fromString("")
+ }
+ return@ExportColumn Binary.fromString(it.taskInfo.name)
+ }
public val HOST_NAME: ExportColumn<TaskTableReader> =
ExportColumn(
@@ -194,17 +199,17 @@ public object DfltTaskExportColumns {
public val SCHEDULE_TIME: ExportColumn<TaskTableReader> =
ExportColumn(
field = Types.optional(INT64).named("schedule_time"),
- ) { it.scheduleTime?.toEpochMilli() }
+ ) { it.scheduleTime }
public val SUBMISSION_TIME: ExportColumn<TaskTableReader> =
ExportColumn(
field = Types.optional(INT64).named("submission_time"),
- ) { it.submissionTime?.toEpochMilli() }
+ ) { it.submissionTime }
public val FINISH_TIME: ExportColumn<TaskTableReader> =
ExportColumn(
field = Types.optional(INT64).named("finish_time"),
- ) { it.finishTime?.toEpochMilli() }
+ ) { it.finishTime }
public val TASK_STATE: ExportColumn<TaskTableReader> =
ExportColumn(
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskInfo.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskInfo.kt
index 2727847f..c23f3fb5 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskInfo.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskInfo.kt
@@ -27,7 +27,7 @@ package org.opendc.compute.simulator.telemetry.table.task
*/
public data class TaskInfo(
val id: Int,
- val name: String,
+ val name: String?,
val type: String,
val arch: String,
val cpuCount: Int,
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt
index e3860606..1f18ee50 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReader.kt
@@ -83,17 +83,17 @@ public interface TaskTableReader : Exportable {
/**
* The [Instant] at which the task was scheduled relative to the start of the workload.
*/
- public val scheduleTime: Instant?
+ public val scheduleTime: Long?
/**
* The [Instant] at which the task was submitted relative to the start of the workload.
*/
- public val submissionTime: Instant?
+ public val submissionTime: Long?
/**
* The [Instant] at which the task finished relative to the start of the workload.
*/
- public val finishTime: Instant?
+ public val finishTime: Long?
/**
* The capacity of the CPUs of Host on which the task is running (in MHz).
diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt
index 3183cf11..d4d5c7a6 100644
--- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt
+++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/table/task/TaskTableReaderImpl.kt
@@ -93,9 +93,9 @@ public class TaskTableReaderImpl(
task.name,
"vm",
"x86",
- task.flavor.cpuCoreCount,
- task.flavor.memorySize,
- task.flavor.gpuCoreCount,
+ task.cpuCoreCount,
+ task.memorySize,
+ task.gpuCoreCount,
)
/**
@@ -134,17 +134,17 @@ public class TaskTableReaderImpl(
get() = _numPauses
private var _numPauses = 0
- override val submissionTime: Instant?
+ override val submissionTime: Long?
get() = _submissionTime
- private var _submissionTime: Instant? = null
+ private var _submissionTime: Long? = null
- override val scheduleTime: Instant?
+ override val scheduleTime: Long?
get() = _scheduleTime
- private var _scheduleTime: Instant? = null
+ private var _scheduleTime: Long? = null
- override val finishTime: Instant?
+ override val finishTime: Long?
get() = _finishTime
- private var _finishTime: Instant? = null
+ private var _finishTime: Long? = null
override val cpuLimit: Double
get() = _cpuLimit
@@ -190,22 +190,22 @@ public class TaskTableReaderImpl(
get() = _gpuDemand
private var _gpuDemand: Double? = 0.0
- override val gpuActiveTime: Long?
+ override val gpuActiveTime: Long
get() = (_gpuActiveTime ?: 0L) - (previousGpuActiveTime ?: 0L)
private var _gpuActiveTime: Long? = null
private var previousGpuActiveTime: Long? = null
- override val gpuIdleTime: Long?
+ override val gpuIdleTime: Long
get() = (_gpuIdleTime ?: 0L) - (previousGpuIdleTime ?: 0L)
private var _gpuIdleTime: Long? = null
private var previousGpuIdleTime: Long? = null
- override val gpuStealTime: Long?
+ override val gpuStealTime: Long
get() = (_gpuStealTime ?: 0L) - (previousGpuStealTime ?: 0L)
private var _gpuStealTime: Long? = null
private var previousGpuStealTime: Long? = null
- override val gpuLostTime: Long?
+ override val gpuLostTime: Long
get() = (_gpuLostTime ?: 0L) - (previousGpuLostTime ?: 0L)
private var _gpuLostTime: Long? = null
private var previousGpuLostTime: Long? = null