@kumologica/sdk 3.6.4-beta6 → 3.6.4-beta8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -349,7 +349,7 @@ function validate(argv) {
|
|
|
349
349
|
}
|
|
350
350
|
if (argv.runtime) {
|
|
351
351
|
if (!argv.runtime.startsWith("nodejs")) {
|
|
352
|
-
throw new Error (`Validation error: parameter 'runtime' must be one of supported nodejs values:
|
|
352
|
+
throw new Error (`Validation error: parameter 'runtime' must be one of supported nodejs values: nodejs20.x|nodejs22.x|...`);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
if (argv.architectures ) {
|
package/cli/commands/run.js
CHANGED
|
@@ -28,6 +28,7 @@ const { codegen } = require("@kumologica/builder");
|
|
|
28
28
|
const { TaskServer} = require("../../src/server/TaskServer");
|
|
29
29
|
//const { DesignerServer } = require("../../src/server/DesignerServer");
|
|
30
30
|
const { logError, logNotice, logInfo, logFatal } = require("../utils/logger");
|
|
31
|
+
const { log } = require("console");
|
|
31
32
|
|
|
32
33
|
exports.command = "run [project_directory]";
|
|
33
34
|
exports.desc = `Start a local HTTP server to execute task and then stops HTTP server and exit.`;
|
|
@@ -55,9 +56,10 @@ exports.builder = (yargs) => {
|
|
|
55
56
|
nargs: 1,
|
|
56
57
|
});
|
|
57
58
|
yargs.option(`taskTimeout`, {
|
|
58
|
-
describe: "The timeout in seconds for task execution.",
|
|
59
|
+
describe: "The timeout in seconds for task execution, default 1800 seconds (30 minutes).",
|
|
59
60
|
type: "number",
|
|
60
61
|
alias: "o",
|
|
62
|
+
default: 1800,
|
|
61
63
|
nargs: 1,
|
|
62
64
|
});
|
|
63
65
|
yargs.option(`args`, {
|
|
@@ -67,13 +69,20 @@ exports.builder = (yargs) => {
|
|
|
67
69
|
});
|
|
68
70
|
};
|
|
69
71
|
|
|
70
|
-
exports.handler = async ({ project_directory, loglevel, port, taskName, args }) => {
|
|
72
|
+
exports.handler = async ({ project_directory, loglevel, port, taskName, taskTimeout, args }) => {
|
|
71
73
|
logNotice(`Starting HTTP Server...`);
|
|
72
74
|
let projectDirectory = project_directory || process.cwd();
|
|
73
75
|
// project_directory can point to a directory or a flow, so lets make sure that first the directory exists
|
|
74
76
|
let absProjectDirectory;
|
|
75
77
|
let exitCode = 1;
|
|
78
|
+
// Timeout in ms (default 10 minutes); make configurable via env or param if needed
|
|
79
|
+
const TIMEOUT_MS =
|
|
80
|
+
(typeof taskTimeout !== 'undefined' ? 1000 * taskTimeout :
|
|
81
|
+
process.env.TIMEOUT_MS ? Number(process.env.TIMEOUT_MS) :
|
|
82
|
+
30 * 60 * 1000); // 30 minutes default in ms
|
|
76
83
|
|
|
84
|
+
|
|
85
|
+
logInfo(`TIMEOUT_MS: ${TIMEOUT_MS} ms`);
|
|
77
86
|
try {
|
|
78
87
|
absProjectDirectory = fs.realpathSync(projectDirectory);
|
|
79
88
|
} catch (err) {
|
|
@@ -101,9 +110,6 @@ exports.handler = async ({ project_directory, loglevel, port, taskName, args })
|
|
|
101
110
|
|
|
102
111
|
const got = require('got');
|
|
103
112
|
|
|
104
|
-
// Timeout in ms (default 10 minutes); make configurable via env or param if needed
|
|
105
|
-
const TIMEOUT_MS = process.env.TIMEOUT_MS || 1000000; // 10 minutes
|
|
106
|
-
|
|
107
113
|
const tName = taskName || process.env.taskName;
|
|
108
114
|
const url = `http://127.0.0.1:${port || 1880}/__task__/${tName}`;
|
|
109
115
|
|
|
@@ -118,28 +124,27 @@ exports.handler = async ({ project_directory, loglevel, port, taskName, args })
|
|
|
118
124
|
});
|
|
119
125
|
|
|
120
126
|
// Log success and response details
|
|
121
|
-
logInfo(
|
|
122
|
-
logInfo(
|
|
123
|
-
logInfo(
|
|
127
|
+
logInfo(`Request succeeded!`);
|
|
128
|
+
logInfo(`Status: ${response.statusCode}`);
|
|
129
|
+
logInfo(`Response body: ${response.body}`); // Assuming JSON response; parse if needed via response.json
|
|
124
130
|
|
|
125
131
|
exitCode = 0;
|
|
126
132
|
|
|
127
133
|
} catch (error) {
|
|
128
134
|
// Log failure details
|
|
129
|
-
logFatal(
|
|
135
|
+
logFatal(`Task Error: ${error.message}`);
|
|
130
136
|
|
|
131
137
|
// if (error.response) {
|
|
132
138
|
// logFatal('Status:', error.response.statusCode);
|
|
133
139
|
// logFatal('Response body:', error.response.body);
|
|
134
140
|
// }
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
141
|
+
if (error.code === 'ETIMEDOUT') {
|
|
142
|
+
logFatal(`Timeout exceeded (${TIMEOUT_MS / 1000}s)`);
|
|
143
|
+
}
|
|
138
144
|
}
|
|
139
145
|
} catch (error) {
|
|
140
|
-
logFatal(
|
|
141
|
-
logFatal(
|
|
142
|
-
|
|
146
|
+
logFatal(`Task failed!`);
|
|
147
|
+
logFatal(`Error: ${error.message}`);
|
|
143
148
|
}
|
|
144
149
|
|
|
145
150
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumologica/sdk",
|
|
3
|
-
"version": "3.6.4-
|
|
3
|
+
"version": "3.6.4-beta8",
|
|
4
4
|
"productName": "Kumologica Designer",
|
|
5
5
|
"copyright": "Copyright 2020 Kumologica Pty Ltd, All Rights Reserved.",
|
|
6
6
|
"author": "Kumologica Pty Ltd <contact@kumologica.com>",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"@aws-sdk/credential-providers": "^3.556.0",
|
|
84
84
|
"@aws-sdk/lib-dynamodb": "^3.549.0",
|
|
85
85
|
"@electron/remote": "^2.0.8",
|
|
86
|
-
"@kumologica/builder": "3.6.4-
|
|
87
|
-
"@kumologica/devkit": "3.6.4-
|
|
88
|
-
"@kumologica/runtime": "3.6.4-
|
|
86
|
+
"@kumologica/builder": "3.6.4-beta8",
|
|
87
|
+
"@kumologica/devkit": "3.6.4-beta8",
|
|
88
|
+
"@kumologica/runtime": "3.6.4-beta8",
|
|
89
89
|
"ajv": "8.10.0",
|
|
90
90
|
"archive-type": "^4.0.0",
|
|
91
91
|
"basic-auth": "2.0.1",
|