node-red-contrib-oscar-cluster-summary
Version:
The fundamental characteristics of an OSCAR cluster are obtained through the OSCAR API.
609 lines (608 loc) • 11.2 kB
JSON
{
"id": "86a552213fc0228d",
"type": "subflow",
"name": "oscar-cluster-summary",
"info": "# Node-RED OSCAR Cluster Nodes\n\nThis library provides Node-RED nodes to interact with the [OSCAR API](https://docs.oscar.grycap.net/latest/api/), enabling monitoring and management of OSCAR clusters from.\n\n---\n\n## Cluster Information Endpoints\n\nThese endpoints allow retrieving general information, status, and configuration details from an OSCAR cluster.\n\n---\n\n### Info -- `/system/info`\n\nReturns general information about the OSCAR cluster.\n\n#### Example response:\n```json\n{\n \"version\": \"string\",\n \"git_commit\": \"string\",\n \"architecture\": \"string\",\n \"kubernetes_version\": \"string\",\n \"serverless_backend\": {\n \"name\": \"string\",\n \"version\": \"string\"\n }\n}\n```\n---\n\n### Config -- `/system/config`\n\nReturns the cluster configuration regarding:\n\n#### Example response:\n```json\n{ \n \"minio_provider\": { \n \"endpoint\": \"string\", \n \"region\": \"string\", \n \"secret_key\": \"string\", \n \"access_key\": \"string\", \n \"verify\": true \n }, \n \"name\": \"string\", \n \"namespace\": \"string\", \n \"gpu_avaliable\": true, \n \"serverless_backend\": \"string\", \n \"yunikorn_enable\": true, \n \"oidc_groups\": [ \n \"string\" \n ]\n}\n```\n\n---\n\n### Status -- `/system/status`\n\nReturns the characteristics in terms of CPU and memory (e.g., cluster node RAM, CPU usage, etc.).\n\n---\n\n### Health -- `/system/health`\n\nReturns \"OK\" if the cluster is functioning correctly.\n",
"category": "OSCAR API",
"in": [
{
"x": 40,
"y": 260,
"wires": [
{
"id": "5c9e06117c5ff8f8"
}
]
}
],
"out": [
{
"x": 1180,
"y": 260,
"wires": [
{
"id": "64d060a316ea02f8",
"port": 0
},
{
"id": "0495dfce4edf26b3",
"port": 0
}
]
}
],
"env": [
{
"name": "Server",
"type": "str",
"value": "",
"ui": {
"type": "input",
"opts": {
"types": [
"str"
]
}
}
},
{
"name": "User",
"type": "str",
"value": "",
"ui": {
"type": "input",
"opts": {
"types": [
"str"
]
}
}
},
{
"name": "Access_Token",
"type": "cred"
},
{
"name": "Information",
"type": "str",
"value": "",
"ui": {
"type": "select",
"opts": {
"opts": [
{
"l": {
"en-US": "Info"
},
"v": "info"
},
{
"l": {
"en-US": "Config"
},
"v": "config"
},
{
"l": {
"en-US": "Status"
},
"v": "status"
},
{
"l": {
"en-US": "Health"
},
"v": "health"
}
]
}
}
}
],
"meta": {
"module": "node-red-contrib-oscar-cluster-summary",
"type": "oscar_info",
"version": "0.0.6",
"author": "vicente.rdguezb@gmail.com",
"desc": "The fundamental characteristics of an OSCAR cluster are obtained through the OSCAR API.",
"keywords": "node-red, node-red-contrib, OSCAR-API, UPV, GryCAP",
"license": "Apache-2.0"
},
"color": "#3FADB5",
"icon": "node-red/cog.svg",
"status": {
"x": 1040,
"y": 120,
"wires": [
{
"id": "9fc662bf41f585c9",
"port": 0
},
{
"id": "52c7a7dd679cebb7",
"port": 0
},
{
"id": "c0221e3eabe970c7",
"port": 0
}
]
},
"flow": [
{
"id": "3887c6016b1e709e",
"type": "http request",
"z": "86a552213fc0228d",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": true,
"authType": "bearer",
"senderr": true,
"headers": [],
"x": 490,
"y": 260,
"wires": [
[
"56fa0a9e600d2e09",
"c0221e3eabe970c7"
]
]
},
{
"id": "5c9e06117c5ff8f8",
"type": "change",
"z": "86a552213fc0228d",
"name": "",
"rules": [
{
"t": "set",
"p": "oscar_server",
"pt": "msg",
"to": "Server",
"tot": "env"
},
{
"t": "set",
"p": "username",
"pt": "msg",
"to": "User",
"tot": "env"
},
{
"t": "set",
"p": "token",
"pt": "msg",
"to": "Access_Token",
"tot": "env"
},
{
"t": "set",
"p": "information",
"pt": "msg",
"to": "Information",
"tot": "env"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 160,
"y": 260,
"wires": [
[
"2f78cc6f0b77caff",
"9fc662bf41f585c9"
]
]
},
{
"id": "2f78cc6f0b77caff",
"type": "function",
"z": "86a552213fc0228d",
"name": "function 3",
"func": "var server=msg.oscar_server;\nvar token=msg.token\n//msg.payload={\n//\"username\":msg.username,\n//\"password\":msg.pass\n\n//}\n\nvar data=msg.information\nif (data != \"health\"){\nmsg.url = server +\"/system/\"+data;\n}\nelse {\nmsg.url = server +\"/\" + data; \n}\nmsg.headers = {\n Authorization: \"Bearer \" + token\n}\n\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 260,
"wires": [
[
"3887c6016b1e709e"
]
]
},
{
"id": "9f3770874803beb1",
"type": "change",
"z": "86a552213fc0228d",
"name": "Clear data",
"rules": [
{
"t": "delete",
"p": "token",
"pt": "msg"
},
{
"t": "delete",
"p": "username",
"pt": "msg"
},
{
"t": "delete",
"p": "oscar_server",
"pt": "msg"
},
{
"t": "delete",
"p": "headers",
"pt": "msg"
},
{
"t": "delete",
"p": "url",
"pt": "msg"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
},
{
"t": "delete",
"p": "redirectList",
"pt": "msg"
},
{
"t": "delete",
"p": "information",
"pt": "msg"
},
{
"t": "delete",
"p": "read",
"pt": "msg"
},
{
"t": "delete",
"p": "statusCode",
"pt": "msg"
},
{
"t": "delete",
"p": "retry",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 900,
"y": 340,
"wires": [
[
"64d060a316ea02f8"
]
]
},
{
"id": "64d060a316ea02f8",
"type": "json",
"z": "86a552213fc0228d",
"name": "",
"property": "payload",
"action": "",
"pretty": true,
"x": 1050,
"y": 340,
"wires": [
[]
]
},
{
"id": "4aa5da783f253c78",
"type": "catch",
"z": "86a552213fc0228d",
"name": "",
"scope": null,
"uncaught": false,
"x": 690,
"y": 60,
"wires": [
[
"52c7a7dd679cebb7"
]
]
},
{
"id": "56fa0a9e600d2e09",
"type": "function",
"z": "86a552213fc0228d",
"name": "function 4",
"func": "\n\nvar data=msg.information\nif (data == \"health\"){\n \n return [msg,null]\n\n}\nelse {\nreturn [null, msg]\n\n}\n\n\n",
"outputs": 2,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 720,
"y": 260,
"wires": [
[
"0495dfce4edf26b3"
],
[
"9f3770874803beb1"
]
]
},
{
"id": "52c7a7dd679cebb7",
"type": "change",
"z": "86a552213fc0228d",
"name": "Error Service",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "payload.text",
"pt": "msg",
"to": "error.message",
"tot": "msg"
},
{
"t": "set",
"p": "payload.shape",
"pt": "msg",
"to": "dot",
"tot": "str"
},
{
"t": "set",
"p": "payload.fill",
"pt": "msg",
"to": "red",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 910,
"y": 60,
"wires": [
[]
]
},
{
"id": "c0221e3eabe970c7",
"type": "change",
"z": "86a552213fc0228d",
"name": "End Service",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "payload.text",
"pt": "msg",
"to": "Finished!",
"tot": "str"
},
{
"t": "set",
"p": "payload.shape",
"pt": "msg",
"to": "dot",
"tot": "str"
},
{
"t": "set",
"p": "payload.fill",
"pt": "msg",
"to": "blue",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 730,
"y": 180,
"wires": [
[]
]
},
{
"id": "9fc662bf41f585c9",
"type": "change",
"z": "86a552213fc0228d",
"name": "Start Service",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "payload.text",
"pt": "msg",
"to": "Processing....",
"tot": "str"
},
{
"t": "set",
"p": "payload.shape",
"pt": "msg",
"to": "dot",
"tot": "str"
},
{
"t": "set",
"p": "payload.fill",
"pt": "msg",
"to": "green",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 330,
"y": 120,
"wires": [
[]
]
},
{
"id": "0495dfce4edf26b3",
"type": "change",
"z": "86a552213fc0228d",
"name": "Clear data",
"rules": [
{
"t": "delete",
"p": "token",
"pt": "msg"
},
{
"t": "delete",
"p": "username",
"pt": "msg"
},
{
"t": "delete",
"p": "oscar_server",
"pt": "msg"
},
{
"t": "delete",
"p": "headers",
"pt": "msg"
},
{
"t": "delete",
"p": "url",
"pt": "msg"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
},
{
"t": "delete",
"p": "redirectList",
"pt": "msg"
},
{
"t": "delete",
"p": "information",
"pt": "msg"
},
{
"t": "delete",
"p": "read",
"pt": "msg"
},
{
"t": "delete",
"p": "statusCode",
"pt": "msg"
},
{
"t": "delete",
"p": "retry",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 920,
"y": 260,
"wires": [
[]
]
},
{
"id": "a66f3decb70cfe67",
"type": "tls-config",
"z": "86a552213fc0228d",
"name": "",
"cert": "",
"key": "",
"ca": "",
"certname": "",
"keyname": "",
"caname": "",
"servername": "",
"verifyservercert": false,
"alpnprotocol": ""
},
{
"id": "b6efc68883bb07d0",
"type": "subflow:86a552213fc0228d",
"z": "3d1ac6c8f5597abc",
"name": "",
"env": [
{
"name": "Server",
"value": "inference-walton.cloud.imagine-ai.eu",
"type": "str"
},
{
"name": "User",
"value": "63710d5ce8f5cd44b91f5152e80ab3f1a144c0760b1773af2dfa6160ad8a368c@egi.eu",
"type": "str"
},
{
"name": "Access_Token",
"type": "cred"
},
{
"name": "Information",
"value": "health",
"type": "str"
}
],
"x": 640,
"y": 520,
"wires": [
[
"eeaef4b6b7ebc3d9"
]
]
}
]
}