summaryrefslogtreecommitdiff
path: root/opendc-compute
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-10 15:57:05 +0200
committerGitHub <noreply@github.com>2022-10-10 15:57:05 +0200
commita832ea376e360f3029036a9570c244fb9080e91f (patch)
treea54e3f9d3a44a0248ef1b17430eed9b5d47ff5de /opendc-compute
parent7ba3b953300c46b4e3afcde17cd3dd14b1af8406 (diff)
parent4ebe2f28ba940aabdaa1f57653fbe86a91582ebd (diff)
merge: Add support for accounting of user simulation time (#108)
This pull request adds support for tracking and limiting the simulation time consumed per user. These changes allow users to consume 60 minutes of shared compute resources for simulations in OpenDC per month. Closes #103 ## Implementation Notes :hammer_and_pick: * Limit exception mapper to WebApplicationException * Add support for accounting simulation time * Add API for querying user accounting data * Show monthly simulation budget in UI ## External Dependencies :four_leaf_clover: * N/A ## Breaking API Changes :warning: * The web runner now also sends the runtime of the simulation job to the server, in order to update the consumed simulation time in the database.
Diffstat (limited to 'opendc-compute')
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt1
-rw-r--r--opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt2
2 files changed, 3 insertions, 0 deletions
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt
index caa95e09..0fe016aa 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/internal/ComputeServiceImpl.kt
@@ -295,6 +295,7 @@ internal class ComputeServiceImpl(
_attemptsSuccess,
_attemptsFailure,
_attemptsError,
+ servers.size,
_serversPending,
_serversActive
)
diff --git a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt
index 4dc70286..6e9f458a 100644
--- a/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt
+++ b/opendc-compute/opendc-compute-service/src/main/kotlin/org/opendc/compute/service/telemetry/SchedulerStats.kt
@@ -32,6 +32,7 @@ import org.opendc.compute.service.ComputeService
* @property attemptsSuccess Scheduling attempts that resulted into an allocation onto a host.
* @property attemptsFailure The number of failed scheduling attempt due to insufficient capacity at the moment.
* @property attemptsError The number of scheduling attempts that failed due to system error.
+ * @property serversTotal The number of servers registered with the service.
* @property serversPending The number of servers that are pending to be scheduled.
* @property serversActive The number of servers that are currently managed by the service and running.
*/
@@ -41,6 +42,7 @@ public data class SchedulerStats(
val attemptsSuccess: Long,
val attemptsFailure: Long,
val attemptsError: Long,
+ val serversTotal: Int,
val serversPending: Int,
val serversActive: Int
)