From 99e33af242d8f5904488cdeaee2ae74af7052b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnar=20P=C3=A1ll?= Date: Fri, 6 Oct 2023 15:17:21 +0000 Subject: [PATCH] Adding ocean spark cluster spark core hours --- .../spark/paths/clusterSparkCoreHours.yaml | 34 +++++++++++++++++++ .../ocean/spark/responses/sparkCoreHours.yaml | 17 ++++++++++ .../oceanSparkClusterSparkCoreHours.yaml | 14 ++++++++ api/spot.yaml | 2 ++ 4 files changed, 67 insertions(+) create mode 100644 api/services/ocean/spark/paths/clusterSparkCoreHours.yaml create mode 100644 api/services/ocean/spark/responses/sparkCoreHours.yaml create mode 100644 api/services/ocean/spark/schemas/oceanSparkClusterSparkCoreHours.yaml diff --git a/api/services/ocean/spark/paths/clusterSparkCoreHours.yaml b/api/services/ocean/spark/paths/clusterSparkCoreHours.yaml new file mode 100644 index 000000000..4ce065d8e --- /dev/null +++ b/api/services/ocean/spark/paths/clusterSparkCoreHours.yaml @@ -0,0 +1,34 @@ +summary: Ocean Spark + +get: + summary: "Cluster Spark Core Hours" + description: > + Gets the number of core hours applications have consumed. + operationId: "OceanSparkClusterSparkCoreHours" + tags: + - "Ocean Spark" + parameters: + - $ref: "../../../../commons/parameters/nonRequiredAccountId.yaml" + - name: clusterId + in: query + required: false + schema: + type: array + items: + "$ref": "../schemas/oceanSparkClusterId.yaml" + collectionFormat: multi + - in: query + name: period + required: false + example: "2021-11" + description: > + The month to query from. + schema: + format: date-time + type: string + + responses: + 200: + $ref: "../responses/sparkCoreHours.yaml" + 400: + description: "Bad Request" diff --git a/api/services/ocean/spark/responses/sparkCoreHours.yaml b/api/services/ocean/spark/responses/sparkCoreHours.yaml new file mode 100644 index 000000000..e87c742c7 --- /dev/null +++ b/api/services/ocean/spark/responses/sparkCoreHours.yaml @@ -0,0 +1,17 @@ +description: Number of spark core hours consumed by cluster +content: + application/json: + schema: + allOf: + - $ref: "../../../../commons/schemas/responseItemWrapper.yaml" + - type: object + properties: + response: + type: object + description: > + response body + properties: + items: + type: array + items: + $ref: "../schemas/oceanSparkClusterSparkCoreHours.yaml" diff --git a/api/services/ocean/spark/schemas/oceanSparkClusterSparkCoreHours.yaml b/api/services/ocean/spark/schemas/oceanSparkClusterSparkCoreHours.yaml new file mode 100644 index 000000000..b9c6392d4 --- /dev/null +++ b/api/services/ocean/spark/schemas/oceanSparkClusterSparkCoreHours.yaml @@ -0,0 +1,14 @@ +type: object +required: +- id +- coreHours +description: > + Object that holds a pair of ocean cluster id and core hours that this cluster has consumed. +properties: + id: + $ref: "oceanSparkClusterId.yaml" + coreHours: + type: number + description: > + Number of core hours that the cluster has consumed. + example: 99 diff --git a/api/spot.yaml b/api/spot.yaml index c85dd7d11..c4616fa24 100644 --- a/api/spot.yaml +++ b/api/spot.yaml @@ -780,6 +780,8 @@ paths: $ref: services/ocean/spark/paths/clusters.yaml /ocean/spark/cluster/{clusterId}: $ref: services/ocean/spark/paths/cluster.yaml + /ocean/spark/cluster/sparkCoreHours: + $ref: services/ocean/spark/paths/clusterSparkCoreHours.yaml /ocean/spark/cluster/{clusterId}/appCompletionTrend: $ref: services/ocean/spark/paths/clusterAppCompletionTrend.yaml /ocean/spark/cluster/{clusterId}/appLoadHistory: