Skip to content

Commit 6d0e37e

Browse files
committed
Add more livenessProbe properties
1 parent 9a67398 commit 6d0e37e

8 files changed

Lines changed: 309 additions & 9 deletions

File tree

OpenFlow/src/Config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ export class Config {
117117
Config.nodered_requests_cpu = Config.getEnv("nodered_requests_cpu", ""); // 1000m = 1vCPU
118118
Config.nodered_limits_memory = Config.getEnv("nodered_limits_memory", "");
119119
Config.nodered_limits_cpu = Config.getEnv("nodered_limits_cpu", ""); // 1000m = 1vCPU
120+
121+
Config.nodered_liveness_failurethreshold = Config.getEnv("nodered_liveness_failurethreshold", "5");
122+
Config.nodered_liveness_timeoutseconds = Config.getEnv("nodered_liveness_timeoutseconds", "5");
123+
120124
Config.prometheus_measure_nodeid = Config.parseBoolean(Config.getEnv("prometheus_measure_nodeid", "false"));
121125
Config.prometheus_measure_queued_messages = Config.parseBoolean(Config.getEnv("prometheus_measure_queued_messages", "false"));
122126
Config.prometheus_measure__mongodb_watch = Config.parseBoolean(Config.getEnv("prometheus_measure__mongodb_watch", "false"));
@@ -240,7 +244,8 @@ export class Config {
240244
public static nodered_requests_cpu: string = Config.getEnv("nodered_requests_cpu", ""); // 1000m = 1vCPU
241245
public static nodered_limits_memory: string = Config.getEnv("nodered_limits_memory", "");
242246
public static nodered_limits_cpu: string = Config.getEnv("nodered_limits_cpu", ""); // 1000m = 1vCPU
243-
public static nodered_liveness_failurethreshold: string = Config.getEnv("nodered_liveness_failurethreshold", "5"); // 1000m = 1vCPU
247+
public static nodered_liveness_failurethreshold: string = Config.getEnv("nodered_liveness_failurethreshold", "5");
248+
public static nodered_liveness_timeoutseconds: string = Config.getEnv("nodered_liveness_timeoutseconds", "5");
244249

245250
public static prometheus_measure_nodeid: boolean = Config.parseBoolean(Config.getEnv("prometheus_measure_nodeid", "false"));
246251
public static prometheus_measure_queued_messages: boolean = Config.parseBoolean(Config.getEnv("prometheus_measure_queued_messages", "false"));

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/nodered",
3-
"version": "1.2.76",
3+
"version": "1.2.77",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

OpenFlowNodeRED/src/nodered/nodes/amqp_nodes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,13 @@ export class amqp_publisher_node {
253253
async oninput(msg: any) {
254254
try {
255255
this.node.status({});
256+
if (this.websocket() == null || !this.websocket().isConnected()) {
257+
throw new Error("Not connected to openflow");
258+
}
259+
if (NoderedUtil.IsNullEmpty(this.localqueue)) {
260+
throw new Error("Queue not registered yet");
261+
}
262+
256263
const data: any = {};
257264
data.payload = msg.payload;
258265
data.jwt = msg.jwt;

OpenFlowNodeRED/src/nodered/nodes/rpa.html

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
<label><i class="fa fa-tag"></i> Kill if running</label>
8181
<input type="checkbox" id="node-input-killexisting" style="width: auto;">
8282
</div>
83+
<div class="form-row">
84+
<label><i class="fa fa-tag"></i> Kill all running</label>
85+
<input type="checkbox" id="node-input-killallexisting" style="width: auto;">
86+
</div>
8387
<div class="form-row">
8488
<label ><i class="fa fa-tag"></i> Name</label>
8589
<input type="text" id="node-input-name" placeholder="Node name">
@@ -92,6 +96,7 @@
9296
You can set the timeout using msg.expiration<br>
9397
Expiration controls how long to wait for a robot to pickup the message, it does not effect how long the robot can run for.<br>
9498
Kill if running / msg.killexisting will tell a robot to kill the workflow if it is allready running.<br>
99+
killallexisting / msg.killallexisting will tell a robot to kill all running workflows before running workflow.<br>
95100
</script>
96101
<script type="text/javascript">
97102
RED.nodes.registerType('rpa workflow', {
@@ -104,6 +109,7 @@
104109
workflow: { value: "" },
105110
localqueue: { value: Math.random().toString(36).substr(2, 9) },
106111
killexisting: { value: false },
112+
killallexisting: { value: false },
107113
name: { value: "" }
108114
},
109115
inputs: 1,
@@ -116,7 +122,7 @@
116122
return this.name ? "node_label_italic" : "";
117123
},
118124
oneditprepare: function () {
119-
$.getJSON('rpa_robots', function (data) {
125+
$.getJSON('rpa_robots_roles', function (data) {
120126
$('#node-input-queue-select').empty();
121127
$('#node-input-queue-select').append($('<option>', {
122128
value: null,
@@ -174,4 +180,74 @@
174180
}
175181

176182
});
183+
</script>
184+
185+
186+
<script type="text/x-red" data-template-name="rpa killworkflows">
187+
<div class="form-row">
188+
<label ><i class="fa fa-tag"></i> Robot</label>
189+
<select id="node-input-queue-select">
190+
<option>Loading...</option>
191+
</select>
192+
<input id="node-input-queue" type="hidden">
193+
</div>
194+
<div class="form-row">
195+
<label ><i class="fa fa-tag"></i> Local queue name</label>
196+
<input type="text" id="node-input-localqueue" placeholder="Queue name">
197+
</div>
198+
<div class="form-row">
199+
<label ><i class="fa fa-tag"></i> Name</label>
200+
<input type="text" id="node-input-name" placeholder="Node name">
201+
</div>
202+
</script>
203+
<script type="text/x-red" data-help-name="rpa killworkflows">
204+
Active everytime a trigger gets triggered on a robot.
205+
</script>
206+
<script type="text/javascript">
207+
RED.nodes.registerType('rpa killworkflows', {
208+
category: 'rpa',
209+
color: "#E9967A",
210+
paletteLabel: 'killworkflows',
211+
icon: "font-awesome/fa-times-circle",
212+
defaults: {
213+
queue: { value: "", required: true },
214+
localqueue: { value: Math.random().toString(36).substr(2, 9) },
215+
name: { value: "" }
216+
},
217+
inputs: 1,
218+
outputs: 2,
219+
label: function () {
220+
return this.name || "rpa killworkflows";
221+
},
222+
labelStyle: function () {
223+
return this.name ? "node_label_italic" : "";
224+
},
225+
oneditprepare: function () {
226+
$.getJSON('rpa_robots', function (data) {
227+
$('#node-input-queue-select').empty();
228+
$('#node-input-queue-select').append($('<option>', {
229+
value: null,
230+
text: "none"
231+
}));
232+
$.each(data, function (i, ele) {
233+
$('#node-input-queue-select').append($('<option>', {
234+
value: ele._id,
235+
text: ele.name
236+
}));
237+
});
238+
$('#node-input-queue-select').val($('#node-input-queue').val());
239+
reloadWorkflows(true);
240+
$("#node-input-queue-select").change(function () {
241+
reloadWorkflows(false);
242+
})
243+
}).error(function (jqXHR, textStatus, errorThrown) {
244+
console.error("error " + textStatus);
245+
console.error("incoming Text " + jqXHR.responseText);
246+
alert("error:" + jqXHR.responseText);
247+
});
248+
},
249+
oneditsave: function () {
250+
$('#node-input-queue').val($('#node-input-queue-select').val());
251+
}
252+
});
177253
</script>

OpenFlowNodeRED/src/nodered/nodes/rpa.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import * as rpa from "./rpa_nodes";
44
export = function (RED: Red) {
55
RED.nodes.registerType("rpa detector", rpa.rpa_detector_node);
66
RED.nodes.registerType("rpa workflow", rpa.rpa_workflow_node);
7+
RED.nodes.registerType("rpa killworkflows", rpa.rpa_killworkflows_node);
78
RED.httpAdmin.get("/rpa_detectors", RED.auth.needsPermission('serial.read'), rpa.get_rpa_detectors);
89
RED.httpAdmin.get("/rpa_robots", RED.auth.needsPermission('serial.read'), rpa.get_rpa_robots);
10+
RED.httpAdmin.get("/rpa_robots_roles", RED.auth.needsPermission('serial.read'), rpa.get_rpa_robots_roles);
911
RED.httpAdmin.get("/rpa_workflows", RED.auth.needsPermission('serial.read'), rpa.get_rpa_workflows);
1012
}

0 commit comments

Comments
 (0)