First production ready product

This commit is contained in:
2026-06-22 15:29:36 +02:00
parent fe0d85db55
commit 51ca73c68f
14 changed files with 709 additions and 5677 deletions
+500 -324
View File
@@ -1,17 +1,25 @@
[
{
"id": "5a9dd923b7459820",
"type": "tab",
"label": "Get New Groupinformation",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f6f2187d.f17ca8",
"type": "tab",
"label": "Data Processing",
"label": "Process Groupinformation",
"disabled": false,
"info": " - Reads the ingested/downloaded data\n - Adds division information to each group\n - Calculates the total archive volume for a division\n - Handles error in a detailed way"
},
{
"id": "2d3b86fbe21570a6",
"id": "1593c8c9a04da215",
"type": "tab",
"label": "Data Ingest",
"label": "Run",
"disabled": false,
"info": " - Downloads the group data from the metabase server in form of a json file\n - Sets a link to this downloaded file for further reference\n - Handles errors that occur during the download process",
"info": "",
"env": []
},
{
@@ -20,6 +28,368 @@
"env": [],
"modules": {}
},
{
"id": "eaa3eb4a201883c0",
"type": "inject",
"z": "5a9dd923b7459820",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 360,
"wires": [
[
"metabase_api_flow"
]
]
},
{
"id": "metabase_api_flow",
"type": "change",
"z": "5a9dd923b7459820",
"name": "Metabase configuration of request",
"rules": [
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "POST",
"tot": "str"
},
{
"t": "set",
"p": "headers",
"pt": "msg",
"to": "{\t \"x-api-key\": $env('METABASE_API_KEY'),\t \"Content-Type\": \"application/x-www-form-urlencoded;charset=UTF-8\",\t \"Accept\": \"application/json\"\t}",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "parameters=%5B%5D&format_rows=true&pivot_results=false",
"tot": "str"
},
{
"t": "set",
"p": "requestTimeout",
"pt": "msg",
"to": "300000",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 360,
"wires": [
[
"metabase_http_node"
]
]
},
{
"id": "metabase_http_node",
"type": "http request",
"z": "5a9dd923b7459820",
"name": "Metabase request",
"method": "use",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://metabase.psi.ch/api/card/94/query/json",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 670,
"y": 360,
"wires": [
[
"b8cc9c157460e2c5"
]
]
},
{
"id": "metabase_output_debug",
"type": "debug",
"z": "5a9dd923b7459820",
"name": "Written File",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 930,
"y": 460,
"wires": []
},
{
"id": "b8cc9c157460e2c5",
"type": "json",
"z": "5a9dd923b7459820",
"name": "Convert JSON object to JSON string",
"property": "payload",
"action": "",
"pretty": false,
"x": 210,
"y": 460,
"wires": [
[
"91e9f1c0e52a0592"
]
]
},
{
"id": "cc064f55fd438347",
"type": "file",
"z": "5a9dd923b7459820",
"name": "Write json to disk",
"filename": "filename",
"filenameType": "msg",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 690,
"y": 460,
"wires": [
[
"metabase_output_debug",
"63ed8c262fa7753b"
]
]
},
{
"id": "91e9f1c0e52a0592",
"type": "change",
"z": "5a9dd923b7459820",
"name": "Set Filename",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "\"/data/size_by_ownergroup_and_number_of_copies_\" & $replace($now(), \":\", \"_\") & \".json\"",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 490,
"y": 460,
"wires": [
[
"cc064f55fd438347"
]
]
},
{
"id": "cdbf736ee149ac8f",
"type": "comment",
"z": "5a9dd923b7459820",
"name": "ZWECK: Kontaktiert metabase und laedt eine Liste von JSON Dictionaires herunter,\\n welche Informationen ueber die einzelnen Archivgruppen enthalten. \\n Diese JSON-Struktur wird dann in ein File abgespeichert.",
"info": "",
"x": 350,
"y": 100,
"wires": []
},
{
"id": "63ed8c262fa7753b",
"type": "exec",
"z": "5a9dd923b7459820",
"command": "cd /data/; ln -sf $(ls $BEGIN_NAME_GROUPINFO_JSON_FILE*.json | sort | tail -n 1) $GROUPINFO_JSON_LNK_NAME_WITH_PATH",
"addpay": "",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "create link to newest archivegroup information json",
"x": 310,
"y": 600,
"wires": [
[
"0957c917da9bc8b3",
"3e09805d0a8e88f9"
],
[
"2d8f3b73dc80bf4a"
],
[
"0957c917da9bc8b3"
]
]
},
{
"id": "0957c917da9bc8b3",
"type": "debug",
"z": "5a9dd923b7459820",
"name": "end of workflow",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 740,
"y": 560,
"wires": []
},
{
"id": "7fa57e2c57d1e6eb",
"type": "file",
"z": "5a9dd923b7459820",
"name": "write log error",
"filename": "\"/data/\" & $env(\"ERROR_LOGFILE\")",
"filenameType": "jsonata",
"appendNewline": false,
"createDir": false,
"overwriteFile": "false",
"encoding": "none",
"x": 580,
"y": 740,
"wires": [
[
"394f5382cb6182dd"
]
]
},
{
"id": "2d8f3b73dc80bf4a",
"type": "change",
"z": "5a9dd923b7459820",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$now() & \" - ERROR in node: 'create link to newest archivegroup information'\" & \" - message: \" & payload",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 360,
"y": 740,
"wires": [
[
"7fa57e2c57d1e6eb"
]
]
},
{
"id": "394f5382cb6182dd",
"type": "debug",
"z": "5a9dd923b7459820",
"name": "data ingest error debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 830,
"y": 740,
"wires": []
},
{
"id": "913d320bfbe13635",
"type": "link in",
"z": "5a9dd923b7459820",
"name": "link in Get New Groupinformation",
"links": [],
"x": 125,
"y": 280,
"wires": [
[
"metabase_api_flow"
]
]
},
{
"id": "3e09805d0a8e88f9",
"type": "link out",
"z": "5a9dd923b7459820",
"name": "link out Get New Groupinformation",
"mode": "return",
"links": [],
"x": 825,
"y": 640,
"wires": []
},
{
"id": "c62bf4e1cfd12c03",
"type": "status",
"z": "5a9dd923b7459820",
"name": "workflow status",
"scope": [
"metabase_api_flow",
"metabase_http_node",
"metabase_output_debug",
"b8cc9c157460e2c5",
"cc064f55fd438347",
"91e9f1c0e52a0592",
"63ed8c262fa7753b"
],
"x": 720,
"y": 260,
"wires": [
[
"dfd30c3d6f180d27"
]
]
},
{
"id": "dfd30c3d6f180d27",
"type": "debug",
"z": "5a9dd923b7459820",
"name": "debug workflow",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 940,
"y": 260,
"wires": []
},
{
"id": "3cc11d24.ff01a2",
"type": "comment",
@@ -30,112 +400,6 @@
"y": 80,
"wires": []
},
{
"id": "732389b81410a14f",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Inputdefinition",
"info": "# Definition der Inputquellen",
"x": 130,
"y": 260,
"wires": []
},
{
"id": "10a15fe29b7bbd63",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Get p-Groupinfos",
"info": "Read p-group information from metabase. \nThis is ownerGroup and copies. You get\nit in json format.",
"x": 340,
"y": 260,
"wires": []
},
{
"id": "6bb0a9c575f23c40",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Get a-Groupinfos",
"info": "Read a-group information from metabase. \nThis is ownerGroup and copies. You get\nit in json format.",
"x": 580,
"y": 260,
"wires": []
},
{
"id": "d8e7dea75d135eef",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Total Archived Volume",
"info": "Calculate the total volume of all the \narchived data.",
"x": 160,
"y": 380,
"wires": []
},
{
"id": "44bed35c7d56824d",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Get p-Group Division",
"info": "To each p-group get the according division\nwhich is the same as the payment unit.",
"x": 440,
"y": 380,
"wires": []
},
{
"id": "6d8993194484d836",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Get a-Group Division",
"info": "To each a-group get the according division\nwhich is the same as the payment unit.",
"x": 720,
"y": 380,
"wires": []
},
{
"id": "339116af234ce323",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Assign Division",
"info": "To each archive group assign the\nright division.",
"x": 160,
"y": 500,
"wires": []
},
{
"id": "b01709df41cdc5a4",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Calculate Division Archivevolume",
"info": "For each division calculate the total\nvolume of the archived data.",
"x": 430,
"y": 500,
"wires": []
},
{
"id": "9e16c8b2a2782747",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Store Result",
"info": "Store the result in a json file by\npreserving previous calculated values.",
"x": 730,
"y": 500,
"wires": []
},
{
"id": "e06ddee93749c977",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 560,
"y": 1100,
"wires": []
},
{
"id": "a918100ba6063585",
"type": "inject",
@@ -157,50 +421,14 @@
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 620,
"x": 120,
"y": 340,
"wires": [
[
"fb9ff82281dc83e0"
]
]
},
{
"id": "e8f1570441f300ee",
"type": "json",
"z": "f6f2187d.f17ca8",
"name": "Convert JSON text to JSON obejct",
"property": "payload",
"action": "",
"pretty": false,
"x": 840,
"y": 880,
"wires": [
[
"8f50bc0cb9009461"
]
]
},
{
"id": "69cad106adee2e2e",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "function 2",
"func": "if (Array.isArray(msg.payload)) {\n msg.payload = msg.payload.map(item => {\n return {\n ...item,\n // Wir nutzen 'ownerGroup', weil 'id' in deinen Daten fehlt\n \"tralala\": \"tralala-\" + item.ownerGroup || \"n/a\" \n };\n });\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 340,
"y": 1100,
"wires": [
[
"e06ddee93749c977"
]
]
},
{
"id": "fb9ff82281dc83e0",
"type": "exec",
@@ -213,8 +441,8 @@
"winHide": false,
"oldrc": false,
"name": "",
"x": 540,
"y": 620,
"x": 380,
"y": 340,
"wires": [
[
"dd3574493b97a5f4"
@@ -237,8 +465,8 @@
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1240,
"y": 620,
"x": 1020,
"y": 260,
"wires": []
},
{
@@ -253,8 +481,8 @@
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 920,
"y": 700,
"x": 700,
"y": 420,
"wires": []
},
{
@@ -268,38 +496,78 @@
"createDir": false,
"overwriteFile": "true",
"encoding": "utf8",
"x": 970,
"y": 620,
"x": 750,
"y": 320,
"wires": [
[
"426e46f53063d368"
"426e46f53063d368",
"dbc196df1931ee06"
]
]
},
{
"id": "5c695a90a30b61d5",
"type": "file in",
"id": "eb6d443e97fedbee",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "Read cached json file",
"filename": "\"/data/results/\" & $env(\"JSON_CACHE\")",
"filenameType": "jsonata",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "utf8",
"allProps": false,
"x": 480,
"y": 880,
"name": "link in Process Groupinformation",
"links": [],
"x": 115,
"y": 260,
"wires": [
[
"e8f1570441f300ee"
"fb9ff82281dc83e0"
]
]
},
{
"id": "6c8e4b6960b242ec",
"id": "dbc196df1931ee06",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "link out Process Groupinformation",
"mode": "return",
"links": [],
"x": 1015,
"y": 400,
"wires": []
},
{
"id": "845b63e247001e57",
"type": "status",
"z": "f6f2187d.f17ca8",
"name": "workflow status",
"scope": [
"fb9ff82281dc83e0",
"dd3574493b97a5f4"
],
"x": 640,
"y": 220,
"wires": [
[
"1e2a3c41555c2d9b"
]
]
},
{
"id": "1e2a3c41555c2d9b",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug workflow",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 220,
"wires": []
},
{
"id": "44c678d93545a6f5",
"type": "inject",
"z": "f6f2187d.f17ca8",
"z": "1593c8c9a04da215",
"name": "",
"props": [
{
@@ -317,191 +585,99 @@
"topic": "",
"payload": "",
"payloadType": "date",
"x": 200,
"y": 880,
"x": 140,
"y": 280,
"wires": [
[
"5c695a90a30b61d5"
"b994acfe29648a35"
]
]
},
{
"id": "8f50bc0cb9009461",
"id": "b994acfe29648a35",
"type": "link call",
"z": "1593c8c9a04da215",
"name": "",
"links": [
"913d320bfbe13635"
],
"linkType": "static",
"timeout": "300",
"x": 440,
"y": 280,
"wires": [
[
"5dab821150d36d52"
]
]
},
{
"id": "5dab821150d36d52",
"type": "link call",
"z": "1593c8c9a04da215",
"name": "",
"links": [
"eb6d443e97fedbee"
],
"linkType": "static",
"timeout": "300",
"x": 820,
"y": 280,
"wires": [
[
"4d7bd4a079e1c50d"
]
]
},
{
"id": "4d7bd4a079e1c50d",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 1",
"z": "1593c8c9a04da215",
"name": "End of workflow",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1120,
"y": 880,
"wires": []
},
{
"id": "363ce76bec0e6649",
"type": "comment",
"z": "2d3b86fbe21570a6",
"name": "TODO: Download groupinformation",
"info": "- Download the available information for each archive group from the metabase server as json file",
"x": 340,
"y": 280,
"wires": []
},
{
"id": "5c0cb04a9df89849",
"type": "exec",
"z": "2d3b86fbe21570a6",
"command": "cd /data; ln -sf $(ls $BEGIN_NAME_GROUPINFO_JSON_FILE*.json | sort | tail -n 1) $GROUPINFO_JSON_LNK_NAME",
"addpay": "",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "create link to newest archivegroup information json",
"x": 630,
"y": 400,
"wires": [
[
"639948c846411d05"
],
[
"78de4d0de4d2af52"
],
[
"639948c846411d05"
]
]
},
{
"id": "3a5dd77cc1bc7e89",
"type": "inject",
"z": "2d3b86fbe21570a6",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
"id": "cd1bcf72369d7e25",
"type": "status",
"z": "1593c8c9a04da215",
"name": "workflow status",
"scope": [
"b994acfe29648a35",
"5dab821150d36d52"
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"x": 420,
"y": 400,
"wires": [
[
"5c0cb04a9df89849"
"a613cbef5aae458b"
]
]
},
{
"id": "639948c846411d05",
"id": "a613cbef5aae458b",
"type": "debug",
"z": "2d3b86fbe21570a6",
"name": "end of workflow",
"z": "1593c8c9a04da215",
"name": "debug workflow",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1000,
"y": 360,
"x": 660,
"y": 400,
"wires": []
},
{
"id": "becf6cea4027743f",
"type": "file",
"z": "2d3b86fbe21570a6",
"name": "write log error",
"filename": "\"/data/\" & $env(\"ERROR_LOGFILE\")",
"filenameType": "jsonata",
"appendNewline": false,
"createDir": false,
"overwriteFile": "false",
"encoding": "none",
"x": 840,
"y": 540,
"wires": [
[
"2349d802aa58a575"
]
]
},
{
"id": "78de4d0de4d2af52",
"type": "change",
"z": "2d3b86fbe21570a6",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$now() & \" - ERROR in node: 'create link to newest archivegroup information'\" & \" - message: \" & payload",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 540,
"wires": [
[
"becf6cea4027743f"
]
]
},
{
"id": "2349d802aa58a575",
"type": "debug",
"z": "2d3b86fbe21570a6",
"name": "data ingest error debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1090,
"y": 540,
"wires": []
},
{
"id": "02e10d7f4b7f6f40",
"type": "function",
"z": "2d3b86fbe21570a6",
"name": "function 1",
"func": "node.error(\"Test-Alarm!\", msg);\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 640,
"y": 300,
"wires": [
[]
]
}
]