From f096560d39203fa99c69ef83e11ecbeb6c6ef12c Mon Sep 17 00:00:00 2001 From: Ankica Barisic <156663621+ankicabarisic@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:08:57 +0100 Subject: [PATCH] enable price field for edge (#111) * enable price field for edge * documenting price field for edge --- endpoints/4-edge-endpoints.md | 2 ++ .../org/ow2/proactive/sal/model/NodeProperties.java | 11 +++++++++++ .../org/ow2/proactive/sal/service/util/ByonUtils.java | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/endpoints/4-edge-endpoints.md b/endpoints/4-edge-endpoints.md index 2e7027d..f80573a 100644 --- a/endpoints/4-edge-endpoints.md +++ b/endpoints/4-edge-endpoints.md @@ -35,6 +35,7 @@ This endpoint is used to register new Edge nodes, which are passed as an [EdgeDe ], "nodeProperties": { "providerId": "1", + "price": "{{price}}", "numberOfCores": "{{cores}}", "memory": "{{memory}}", "disk": "{{disk}}", @@ -69,6 +70,7 @@ The fields are defined as: - `ipAddresses`: A list of IP addresses associated with the node, including both PUBLIC_IP and PRIVATE_IP with IP Version specified as V4. - `nodeProperties`: - `providerId`: The ID of the provider. Default is `"1"`. + - `price`: The price of the edge node source. - `numberOfCores`: A string representing number of hardware cores (e.g., `"1"`). - `memory`: The hardware memory in GB (e.g., `"1"`) - `disk`: The hardware storage space in GB (e.g., `"1.0"`). diff --git a/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeProperties.java b/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeProperties.java index a61d4af..f5c3e34 100644 --- a/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeProperties.java +++ b/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeProperties.java @@ -24,6 +24,9 @@ @NoArgsConstructor @Embeddable public class NodeProperties implements Serializable { + @JsonProperty("price") + private Double price = null; + @JsonProperty("providerId") private String providerId = null; @@ -61,6 +64,14 @@ public void setProviderId(String providerId) { this.providerId = providerId; } + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + public NodeProperties numberOfCores(Integer numberOfCores) { this.numberOfCores = numberOfCores; return this; diff --git a/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ByonUtils.java b/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ByonUtils.java index ef6a102..bf9b283 100644 --- a/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ByonUtils.java +++ b/sal-service/src/main/java/org/ow2/proactive/sal/service/util/ByonUtils.java @@ -62,7 +62,7 @@ public static NodeCandidate createNodeCandidate(NodeProperties np, String jobId, LOGGER.debug("Creating the {} node candidate ...", nodeType.toUpperCase()); //Start by setting the universal nodes properties NodeCandidate nc = new NodeCandidate(); - nc.setPrice(0.0); + nc.setPrice(np.getPrice()); nc.setMemoryPrice(0.0); nc.setPricePerInvocation(0.0); nc.setNodeId(nodeId);