Skip to content

Commit

Permalink
filter node candidates by hardware/name (#85)
Browse files Browse the repository at this point in the history
* nebulous-afCk4N8e

* node candidate hardware/name added

* node candidate hardware/name documented
  • Loading branch information
ankicabarisic authored Aug 12, 2024
1 parent d52ccc5 commit 9b257bf
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 21 deletions.
85 changes: 64 additions & 21 deletions documentation/7-node-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

* For the `NodeTypeRequirement` we verify that the node candidate is the type desired. These types are: `IAAS`, `PAAS`, `FAAS`, `BYON`, `EDGE`, `SIMULATION`
* For the `AttributeRequirement` they are catagorized in the following classes:
* `hardware`: In this class we can filter based on the `ram`, `cores`, `disk`, `fpga`.
* `hardware`: In this class we can filter based on the `ram`, `cores`, `disk`, `fpga`, `name`
* `location`: In this class we can filter based on the `geoLocation.country`
* `image`: In this class we can filter based on the `name`, `operatingSystem.family` , `operatingSystem.version`
* `cloud`: In this class we can filter based on the `type`. A cloud type can be `PRIVATE`, `PUBLIC`, `BYON`, `EDGE`
* `environment`: In this class we can filter based on the `runtime`. The possible runtimes are `nodejs`, `python`, `java`, `dotnet`, `go`
* `name`: In this class we can filter based on the `placementName`. This is used for BYON and EDGE nodes where we can select a specific node to handle a certain component.

For more details about these filters you can check the SAL code [NodeCandidateUtils class](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-service/src/main/java/org/ow2/proactive/sal/service/nc/NodeCandidateUtils.java) To check the Node types: [NodeTypeRequirement class](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeTypeRequirement.java) and [NodeType enum](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeType.java) To check the Cloud types: [CloudType enum](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/CloudType.java) to check the requirment operators: [RequirementOperator enum](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/RequirementOperator.java)
For more details about these filters you can check the SAL code [NodeCandidateUtils class](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-service/src/main/java/org/ow2/proactive/sal/service/nc/NodeCandidateUtils.java) To check the Node types: [NodeTypeRequirement class](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeTypeRequirement.java) and [NodeType enum](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/NodeType.java) To check the Cloud types: [CloudType enum](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/CloudType.java) to check the requirement operators: [RequirementOperator enum](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/sal-common/src/main/java/org/ow2/proactive/sal/model/RequirementOperator.java)

**Path**:

Expand All @@ -25,27 +25,70 @@ For more details about these filters you can check the SAL code [NodeCandidateUt

```json
[
{
"type": "NodeTypeRequirement",
"nodeTypes": ["IAAS"]
},
{
"type": "AttributeRequirement",
"requirementClass": "hardware",
"requirementAttribute": "cores",
"requirementOperator": "EQ",
"value": "2"
},
{
"type": "AttributeRequirement",
"requirementClass": "hardware",
"requirementAttribute": "ram",
"requirementOperator": "EQ",
"value": "4096" \\ in mb
}
// asking for IASS node type
{
"type": "NodeTypeRequirement",
"nodeTypes": ["IAAS"]
},
// asking for nodes from specific cloud
{
"type": "AttributeRequirement",
"requirementClass": "cloud",
"requirementAttribute": "id",
"requirementOperator": "EQ",
"value": "{{cloud_name}}"
},
// asking for UBUNTU operating system
{
"type": "AttributeRequirement",
"requirementClass": "image",
"requirementAttribute": "operatingSystem.family",
"requirementOperator": "IN",
"value": "UBUNTU"
},
// asking for 22 version of OS
{
"type": "AttributeRequirement",
"requirementClass": "image",
"requirementAttribute": "name",
"requirementOperator": "INC",
"value": "22"
},
// asking for specific region
{
"type": "AttributeRequirement",
"requirementClass": "location",
"requirementAttribute": "name",
"requirementOperator": "EQ",
"value": "bgo"
},
// asking for 8GB RAM
{
"type": "AttributeRequirement",
"requirementClass": "hardware",
"requirementAttribute": "ram",
"requirementOperator": "EQ",
"value": "8192"
},
// asking for 4 cores
{
"type": "AttributeRequirement",
"requirementClass": "hardware",
"requirementAttribute": "cores",
"requirementOperator": "EQ",
"value": "4"
},
// asking specific hardware name
{
"type": "AttributeRequirement",
"requirementClass": "hardware",
"requirementAttribute": "name",
"requirementOperator": "EQ",
"value": "c5.xlarge"
}
]
```

"Note: This JSON requirement is provided as an example. Please construct your own set of requirements tailored to your specific use case."
**Returns**: A JSON list of Node Candidates.

#### 7.2- getLengthOfNodeCandidates endpoint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ private static boolean satisfyAttributeRequirement(AttributeRequirement attribut
return attributeRequirement.getRequirementOperator()
.compare(nodeCandidate.getHardware().getFpga(),
Integer.valueOf(attributeRequirement.getValue()));
case "name":
return attributeRequirement.getRequirementOperator().compare(nodeCandidate.getHardware().getName(),
attributeRequirement.getValue());
}
}
if (attributeRequirement.getRequirementClass().equals("location")) {
Expand Down

0 comments on commit 9b257bf

Please sign in to comment.