@webda/async 4.0.0-beta.2 → 4.0.0-beta.3
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.
- package/README.md +89 -4
- package/lib/{models.d.ts → asyncaction.model.d.ts} +75 -37
- package/lib/asyncaction.model.d.ts.map +1 -0
- package/lib/asyncaction.model.js +269 -0
- package/lib/asyncaction.model.js.map +1 -0
- package/lib/index.d.ts +6 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/lib/services/asyncevents.service.d.ts +154 -0
- package/lib/services/asyncevents.service.d.ts.map +1 -0
- package/lib/services/asyncevents.service.js +219 -0
- package/lib/services/asyncevents.service.js.map +1 -0
- package/lib/services/{asyncjobservice.d.ts → asyncjobservice.service.d.ts} +78 -61
- package/lib/services/asyncjobservice.service.d.ts.map +1 -0
- package/lib/services/asyncjobservice.service.js +584 -0
- package/lib/services/asyncjobservice.service.js.map +1 -0
- package/lib/services/{localrunner.d.ts → localrunner.service.d.ts} +24 -10
- package/lib/services/localrunner.service.d.ts.map +1 -0
- package/lib/services/localrunner.service.js +87 -0
- package/lib/services/localrunner.service.js.map +1 -0
- package/lib/services/{runner.d.ts → runner.service.d.ts} +17 -12
- package/lib/services/runner.service.d.ts.map +1 -0
- package/lib/services/{runner.js → runner.service.js} +16 -13
- package/lib/services/runner.service.js.map +1 -0
- package/lib/services/servicerunner.service.d.ts +105 -0
- package/lib/services/servicerunner.service.d.ts.map +1 -0
- package/lib/services/servicerunner.service.js +131 -0
- package/lib/services/servicerunner.service.js.map +1 -0
- package/package.json +32 -42
- package/webda.module.json +1925 -890
- package/lib/models.d.ts.map +0 -1
- package/lib/models.js +0 -179
- package/lib/models.js.map +0 -1
- package/lib/models.spec.d.ts +0 -7
- package/lib/models.spec.d.ts.map +0 -1
- package/lib/models.spec.js +0 -64
- package/lib/models.spec.js.map +0 -1
- package/lib/services/asyncjobservice.d.ts.map +0 -1
- package/lib/services/asyncjobservice.js +0 -469
- package/lib/services/asyncjobservice.js.map +0 -1
- package/lib/services/asyncjobservice.spec.d.ts +0 -2
- package/lib/services/asyncjobservice.spec.d.ts.map +0 -1
- package/lib/services/asyncjobservice.spec.js +0 -561
- package/lib/services/asyncjobservice.spec.js.map +0 -1
- package/lib/services/localrunner.d.ts.map +0 -1
- package/lib/services/localrunner.js +0 -70
- package/lib/services/localrunner.js.map +0 -1
- package/lib/services/localrunner.spec.d.ts +0 -2
- package/lib/services/localrunner.spec.d.ts.map +0 -1
- package/lib/services/localrunner.spec.js +0 -113
- package/lib/services/localrunner.spec.js.map +0 -1
- package/lib/services/runner.d.ts.map +0 -1
- package/lib/services/runner.js.map +0 -1
- package/lib/services/servicerunner.d.ts +0 -68
- package/lib/services/servicerunner.d.ts.map +0 -1
- package/lib/services/servicerunner.js +0 -97
- package/lib/services/servicerunner.js.map +0 -1
- package/lib/services/servicerunner.spec.d.ts +0 -2
- package/lib/services/servicerunner.spec.d.ts.map +0 -1
- package/lib/services/servicerunner.spec.js +0 -111
- package/lib/services/servicerunner.spec.js.map +0 -1
|
@@ -1,469 +0,0 @@
|
|
|
1
|
-
import { CancelableLoopPromise, CancelablePromise, Core, CronService, FileUtils, JSONUtils, Service, ServiceParameters, SimpleOperationContext, WebdaError } from "@webda/core";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import * as crypto from "crypto";
|
|
4
|
-
import { schedule as crontabSchedule } from "node-cron";
|
|
5
|
-
import { Runner } from "./runner.js";
|
|
6
|
-
import ServiceRunner from "./servicerunner.js";
|
|
7
|
-
/**
|
|
8
|
-
* @inheritdoc
|
|
9
|
-
*/
|
|
10
|
-
export class AsyncJobServiceParameters extends ServiceParameters {
|
|
11
|
-
constructor(params) {
|
|
12
|
-
super(params);
|
|
13
|
-
this.url ?? (this.url = "/async");
|
|
14
|
-
this.queue ?? (this.queue = "AsyncActionsQueue");
|
|
15
|
-
this.runners ?? (this.runners = []);
|
|
16
|
-
this.schedulerResolution ?? (this.schedulerResolution = 60000);
|
|
17
|
-
this.onlyHttpHook ?? (this.onlyHttpHook = false);
|
|
18
|
-
this.includeCron ?? (this.includeCron = true);
|
|
19
|
-
this.logsLimit ?? (this.logsLimit = 500);
|
|
20
|
-
this.asyncActionModel ?? (this.asyncActionModel = "Webda/AsyncWebdaAction");
|
|
21
|
-
this.asyncOperationModel ?? (this.asyncOperationModel = "Webda/AsyncOperationAction");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* AsyncService allows you to launch jobs and report status
|
|
26
|
-
*
|
|
27
|
-
* @WebdaModda
|
|
28
|
-
*/
|
|
29
|
-
class AsyncJobService extends Service {
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
/**
|
|
33
|
-
* Validator of sessions
|
|
34
|
-
*/
|
|
35
|
-
this.operationsQueries = {};
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @inheritdoc
|
|
39
|
-
*/
|
|
40
|
-
loadParameters(params) {
|
|
41
|
-
return new AsyncJobServiceParameters(params);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @inheritdoc
|
|
45
|
-
*/
|
|
46
|
-
resolve() {
|
|
47
|
-
super.resolve();
|
|
48
|
-
this.model = this.getWebda().getModel(this.parameters.asyncActionModel);
|
|
49
|
-
this.queue = this.getService(this.parameters.queue);
|
|
50
|
-
if (!this.queue && !this.parameters.localLaunch) {
|
|
51
|
-
throw new Error(`AsyncService requires a valid queue. '${this.parameters.queue}' is invalid`);
|
|
52
|
-
}
|
|
53
|
-
// Get all runners
|
|
54
|
-
this.runners = this.parameters.runners
|
|
55
|
-
.map(n => {
|
|
56
|
-
const res = this.getService(n);
|
|
57
|
-
if (res === undefined) {
|
|
58
|
-
this.log("WARN", `Runner ${n} does not exist`);
|
|
59
|
-
}
|
|
60
|
-
return res;
|
|
61
|
-
})
|
|
62
|
-
.filter(r => r !== undefined);
|
|
63
|
-
// Add route for operations launch
|
|
64
|
-
if (this.parameters.asyncOperationDefinition) {
|
|
65
|
-
this.log("INFO", "Loading operations", this.parameters.asyncOperationDefinition);
|
|
66
|
-
this.addRoute(`${this.parameters.url}{?full}`, ["GET"], this.listOperations);
|
|
67
|
-
this.addRoute(`${this.parameters.url}/{operationId}{?schedule}`, ["PUT"], this.launchOperation);
|
|
68
|
-
this.operationModel = this.getWebda().getModel(this.parameters.asyncOperationModel);
|
|
69
|
-
this.registerOperations(FileUtils.load(this.parameters.asyncOperationDefinition));
|
|
70
|
-
}
|
|
71
|
-
// This is internal job reporting so no need to document the api
|
|
72
|
-
this.addRoute(`${this.parameters.url}/status`, ["POST"], this.statusHook, {
|
|
73
|
-
hidden: true
|
|
74
|
-
});
|
|
75
|
-
this.getWebda().registerRequestFilter(this);
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Register new operations
|
|
80
|
-
* @param operations
|
|
81
|
-
*/
|
|
82
|
-
registerOperations(operations) {
|
|
83
|
-
this.operations ?? (this.operations = {
|
|
84
|
-
application: operations.application || { name: "Unknown", version: "0.0.0" },
|
|
85
|
-
operations: {},
|
|
86
|
-
schemas: {}
|
|
87
|
-
});
|
|
88
|
-
// Register all schemas
|
|
89
|
-
Object.keys(operations?.schemas || {})
|
|
90
|
-
.filter(key => !this.getWebda().getApplication().hasSchema(key))
|
|
91
|
-
.forEach(key => {
|
|
92
|
-
this.getWebda().getApplication().registerSchema(key, operations.schemas[key]);
|
|
93
|
-
this.operations.schemas[key] = operations.schemas[key];
|
|
94
|
-
});
|
|
95
|
-
// Register all operations now
|
|
96
|
-
Object.keys(operations?.operations || {}).forEach(key => {
|
|
97
|
-
this.getWebda().registerOperation(key, {
|
|
98
|
-
...operations.operations[key],
|
|
99
|
-
method: "callOperation",
|
|
100
|
-
service: this.getName()
|
|
101
|
-
});
|
|
102
|
-
this.operations.operations[key] = operations.operations[key];
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Allow job status report url
|
|
107
|
-
*/
|
|
108
|
-
async checkRequest(context) {
|
|
109
|
-
const url = context.getHttpContext().getRelativeUri();
|
|
110
|
-
// Only for status endpoint - operations endpoint should still be authorized by something else
|
|
111
|
-
if (url === `${this.parameters.url}/status`) {
|
|
112
|
-
// Allow status url to be called without other mechanism
|
|
113
|
-
const httpContext = context.getHttpContext();
|
|
114
|
-
return ["X-Job-Id", "X-Job-Time", "X-Job-Hash"].every(v => httpContext.getUniqueHeader(v) !== undefined);
|
|
115
|
-
}
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Status hook for job report
|
|
120
|
-
*
|
|
121
|
-
* Only updates specific fields: status, errorMessage, statusDetails, results, logs (appending)
|
|
122
|
-
*/
|
|
123
|
-
async statusHook(context) {
|
|
124
|
-
if (!context.getHttpContext().getUniqueHeader("X-Job-Id")) {
|
|
125
|
-
throw new WebdaError.NotFound("X-Job-Id header required");
|
|
126
|
-
}
|
|
127
|
-
const action = await this.model.ref(context.getHttpContext().getUniqueHeader("X-Job-Id")).get();
|
|
128
|
-
if (!action) {
|
|
129
|
-
throw new WebdaError.NotFound(`Unknown Job Id '${context.getHttpContext().getUniqueHeader("X-Job-Id")}'`);
|
|
130
|
-
}
|
|
131
|
-
await action.checkAct(context, "status");
|
|
132
|
-
await action.statusAction(context);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Worker
|
|
136
|
-
*
|
|
137
|
-
* This will launch actions based on defined runners
|
|
138
|
-
*/
|
|
139
|
-
worker() {
|
|
140
|
-
if (this.runners.length === 0) {
|
|
141
|
-
throw new Error(`AsyncJobService.worker requires runners`);
|
|
142
|
-
}
|
|
143
|
-
const p = [this.queue.consume(this.handleEvent.bind(this))];
|
|
144
|
-
if (this.parameters.includeSchedulerInWorker) {
|
|
145
|
-
p.push(this.scheduler());
|
|
146
|
-
}
|
|
147
|
-
// Return a cancelable promise for both worker and scheduler
|
|
148
|
-
return new CancelablePromise((resolve, reject) => {
|
|
149
|
-
Promise.all(p).then(() => resolve(), reject);
|
|
150
|
-
}, async () => {
|
|
151
|
-
this.log("INFO", "Worker stopped");
|
|
152
|
-
await Promise.all(p.map(pi => (pi.cancel ? pi.cancel() : "")));
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Handle one event from the queue and launch the job
|
|
157
|
-
* @param event
|
|
158
|
-
*/
|
|
159
|
-
async handleEvent(event) {
|
|
160
|
-
let selectedRunner;
|
|
161
|
-
// Take first to acknowledge the job
|
|
162
|
-
for (const runner of this.runners) {
|
|
163
|
-
if (runner.handleType(event.type)) {
|
|
164
|
-
selectedRunner = runner;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// Fallback if needed
|
|
169
|
-
if (selectedRunner === undefined && this.parameters.fallbackOnFirst) {
|
|
170
|
-
selectedRunner = this.runners[0];
|
|
171
|
-
}
|
|
172
|
-
if (selectedRunner === undefined) {
|
|
173
|
-
this.log("ERROR", `Cannot find a runner for action ${event.uuid}`);
|
|
174
|
-
await this.model.ref(event.uuid).patch({
|
|
175
|
-
status: "ERROR",
|
|
176
|
-
errorMessage: `No runner found for the job`
|
|
177
|
-
});
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
this.log("INFO", `Starting action ${event.uuid}`);
|
|
181
|
-
await this.model.ref(event.uuid).patch({
|
|
182
|
-
uuid: event.uuid,
|
|
183
|
-
status: "STARTING"
|
|
184
|
-
});
|
|
185
|
-
const action = await this.model.ref(event.uuid).get();
|
|
186
|
-
const job = await selectedRunner.launchAction(action, this.getJobInfo(action));
|
|
187
|
-
await action.patch({ job }, null);
|
|
188
|
-
return job.promise || Promise.resolve();
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Get the job info
|
|
192
|
-
* @param action
|
|
193
|
-
* @returns
|
|
194
|
-
*/
|
|
195
|
-
getJobInfo(action) {
|
|
196
|
-
return {
|
|
197
|
-
JOB_SECRET_KEY: action.__secretKey,
|
|
198
|
-
JOB_ID: action.getUuid(),
|
|
199
|
-
JOB_HOOK: this.parameters.onlyHttpHook || !action.isInternal() ? action.getHookUrl() : "store",
|
|
200
|
-
JOB_ORCHESTRATOR: this.getName()
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* List available operations through this service
|
|
205
|
-
* @param context
|
|
206
|
-
*/
|
|
207
|
-
async listOperations(context) {
|
|
208
|
-
const filtered = JSONUtils.duplicate(this.operations);
|
|
209
|
-
// Filter operations based on permissions
|
|
210
|
-
Object.keys(filtered.operations)
|
|
211
|
-
.filter(key => filtered.operations[key].permission && !this.getWebda().checkOperationPermission(context, key))
|
|
212
|
-
.forEach(key => delete filtered.operations[key]);
|
|
213
|
-
// Remove permission definition
|
|
214
|
-
Object.values(filtered.operations)
|
|
215
|
-
.filter(def => def.permission)
|
|
216
|
-
.forEach(def => delete def.permission);
|
|
217
|
-
if (!context.getParameters().full) {
|
|
218
|
-
context.write(Object.keys(filtered.operations));
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
const schemas = [];
|
|
222
|
-
Object.values(filtered.operations).forEach((operation) => {
|
|
223
|
-
if (operation.input) {
|
|
224
|
-
schemas.push(operation.input);
|
|
225
|
-
}
|
|
226
|
-
if (operation.output) {
|
|
227
|
-
schemas.push(operation.output);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
// Filter schemas
|
|
231
|
-
Object.keys(filtered.schemas)
|
|
232
|
-
.filter(key => !schemas.includes(key))
|
|
233
|
-
.forEach(key => {
|
|
234
|
-
delete filtered.schemas[key];
|
|
235
|
-
});
|
|
236
|
-
context.write(filtered);
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Call an operation for an external system
|
|
240
|
-
* @param context
|
|
241
|
-
* @returns
|
|
242
|
-
*/
|
|
243
|
-
async callOperation(context) {
|
|
244
|
-
return await this.launchAction(new this.operationModel(context.getExtension("operation"), context));
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Launch an operation through this service
|
|
248
|
-
*/
|
|
249
|
-
async launchOperation(context) {
|
|
250
|
-
const { operationId, schedule } = context.getParameters();
|
|
251
|
-
await this.getWebda().checkOperation(context, operationId);
|
|
252
|
-
let action;
|
|
253
|
-
if (schedule) {
|
|
254
|
-
action = await this.scheduleAction(new this.operationModel(operationId, await SimpleOperationContext.fromContext(context)), schedule);
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
action = await this.callOperation((await SimpleOperationContext.fromContext(context)).setExtension("operation", operationId));
|
|
258
|
-
}
|
|
259
|
-
context.write(action);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Launch the action asynchronously
|
|
263
|
-
* @param action
|
|
264
|
-
* @returns
|
|
265
|
-
*/
|
|
266
|
-
async launchAction(action) {
|
|
267
|
-
action.status = "QUEUED";
|
|
268
|
-
action.type = action.constructor.name;
|
|
269
|
-
action.__secretKey = this.getWebda().getUuid();
|
|
270
|
-
await action.save();
|
|
271
|
-
if (this.parameters.localLaunch) {
|
|
272
|
-
// Directly call the handler but not wait for its result
|
|
273
|
-
this.handleEvent({ uuid: action.getUuid(), __secretKey: action.__secretKey, type: action.type });
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
await this.queue.sendMessage({ uuid: action.getUuid(), __secretKey: action.__secretKey, type: action.type });
|
|
277
|
-
}
|
|
278
|
-
return action;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Schedule action for later execution
|
|
282
|
-
*
|
|
283
|
-
* @param action
|
|
284
|
-
* @param timestamp
|
|
285
|
-
*/
|
|
286
|
-
async scheduleAction(action, timestamp) {
|
|
287
|
-
action.status = "SCHEDULED";
|
|
288
|
-
action.type = action.constructor.name;
|
|
289
|
-
// Schedule based on the scheduler resolution
|
|
290
|
-
action.scheduled = timestamp - (timestamp % this.parameters.schedulerResolution);
|
|
291
|
-
await action.save();
|
|
292
|
-
return action;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Return headers to request status hook
|
|
296
|
-
*
|
|
297
|
-
* @param jobInfo
|
|
298
|
-
* @returns
|
|
299
|
-
*/
|
|
300
|
-
getHeaders(jobInfo) {
|
|
301
|
-
const res = {
|
|
302
|
-
"X-Job-Id": jobInfo.JOB_ID,
|
|
303
|
-
"X-Job-Time": Date.now().toString()
|
|
304
|
-
};
|
|
305
|
-
res["X-Job-Hash"] = crypto
|
|
306
|
-
.createHmac(AsyncJobService.HMAC_ALGO, jobInfo.JOB_SECRET_KEY)
|
|
307
|
-
.update(res["X-Job-Time"])
|
|
308
|
-
.digest("hex");
|
|
309
|
-
return res;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Post hook to a remote url or use local store to update status
|
|
313
|
-
* @param jobInfo
|
|
314
|
-
* @param message
|
|
315
|
-
* @returns
|
|
316
|
-
*/
|
|
317
|
-
async postHook(jobInfo, message) {
|
|
318
|
-
// Http allow to break paradigm between the executor and the orchestrator
|
|
319
|
-
if (jobInfo.JOB_HOOK.startsWith("http")) {
|
|
320
|
-
return (await axios.post(jobInfo.JOB_HOOK, message, {
|
|
321
|
-
headers: this.getHeaders(jobInfo)
|
|
322
|
-
})).data;
|
|
323
|
-
}
|
|
324
|
-
else if (jobInfo.JOB_HOOK === "store") {
|
|
325
|
-
// If executor and orchestrator runs within same privilege it simplify the infrastructure
|
|
326
|
-
return (await this.model.ref(jobInfo.JOB_ID).get()).update(message);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Launch a service.method as an AsyncAction
|
|
331
|
-
* @param serviceName
|
|
332
|
-
* @param method
|
|
333
|
-
* @param args
|
|
334
|
-
*/
|
|
335
|
-
async launchAsAsyncAction(serviceName, method, ...args) {
|
|
336
|
-
return this.launchAction(new this.model(serviceName, method, ...args));
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Execute a service.method as an AsyncAction
|
|
340
|
-
*
|
|
341
|
-
* Useful for crontab execution
|
|
342
|
-
* @param serviceName
|
|
343
|
-
* @param method
|
|
344
|
-
* @param args
|
|
345
|
-
*/
|
|
346
|
-
async executeAsAsyncAction(serviceName, method, ...args) {
|
|
347
|
-
let runner = Object.values(this.getWebda().getServicesOfType(ServiceRunner)).shift();
|
|
348
|
-
// Create a temporary one if needed
|
|
349
|
-
runner ?? (runner = await new ServiceRunner(this.getWebda(), this.getName() + "_temprunner").resolve().init());
|
|
350
|
-
// Save action
|
|
351
|
-
const action = await new this.model(serviceName, method, ...args).save();
|
|
352
|
-
// Run it
|
|
353
|
-
return (await runner.launchAction(action, this.getJobInfo(action))).promise;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Wrap async job and call the job status hook
|
|
357
|
-
*/
|
|
358
|
-
async runAsyncOperationAction(jobInfo) {
|
|
359
|
-
// Get it from environment
|
|
360
|
-
if (jobInfo === undefined) {
|
|
361
|
-
jobInfo = {};
|
|
362
|
-
Object.keys(process.env)
|
|
363
|
-
.filter(k => k.startsWith("JOB_"))
|
|
364
|
-
// @ts-ignore
|
|
365
|
-
.forEach((k) => (jobInfo[k] = process.env[k]));
|
|
366
|
-
}
|
|
367
|
-
// Ensure correct context
|
|
368
|
-
if (!jobInfo.JOB_ORCHESTRATOR || !jobInfo.JOB_ID || !jobInfo.JOB_SECRET_KEY || !jobInfo.JOB_HOOK) {
|
|
369
|
-
this.log("ERROR", "Cannot run AsyncAction without context");
|
|
370
|
-
throw new Error("Cannot run AsyncAction without context");
|
|
371
|
-
}
|
|
372
|
-
// If we are not the target redirect to the right one
|
|
373
|
-
if (jobInfo.JOB_ORCHESTRATOR !== this.getName()) {
|
|
374
|
-
this.log("DEBUG", `Passing jobInfo ${jobInfo} to targeted service`);
|
|
375
|
-
return this.getService(jobInfo.JOB_ORCHESTRATOR).runAsyncOperationAction(jobInfo);
|
|
376
|
-
}
|
|
377
|
-
this.log("DEBUG", "Getting action to execute from hook", jobInfo);
|
|
378
|
-
// Get action info by calling the hook
|
|
379
|
-
const action = await this.postHook(jobInfo, {
|
|
380
|
-
agent: {
|
|
381
|
-
...Runner.getAgentInfo(),
|
|
382
|
-
nodeVersion: process.version
|
|
383
|
-
},
|
|
384
|
-
status: "RUNNING"
|
|
385
|
-
});
|
|
386
|
-
this.log("DEBUG", "Action received", action.serviceName, action.method, action.arguments);
|
|
387
|
-
let results;
|
|
388
|
-
try {
|
|
389
|
-
// Check it contains the right info
|
|
390
|
-
if (!action.method || !action.serviceName) {
|
|
391
|
-
throw new Error("WebdaAsyncAction must have method and serviceName defined at least");
|
|
392
|
-
}
|
|
393
|
-
// Call the service[method](...args)
|
|
394
|
-
const service = this.getService(action.serviceName);
|
|
395
|
-
if (!service) {
|
|
396
|
-
throw new Error(`WebdaAsyncAction Service '${action.serviceName}' not found: mismatch app version`);
|
|
397
|
-
}
|
|
398
|
-
// @ts-ignore
|
|
399
|
-
if (!service[action.method]) {
|
|
400
|
-
throw new Error(`WebdaAsyncAction Method '${action.method}' not found in service ${action.serviceName}: mismatch app version`);
|
|
401
|
-
}
|
|
402
|
-
// @ts-ignore
|
|
403
|
-
results = await service[action.method](...(action.arguments || []));
|
|
404
|
-
}
|
|
405
|
-
catch (err) {
|
|
406
|
-
// Job is in error
|
|
407
|
-
await this.postHook(jobInfo, {
|
|
408
|
-
errorMessage: err?.message,
|
|
409
|
-
status: "ERROR"
|
|
410
|
-
});
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
// Update status
|
|
414
|
-
await this.postHook(jobInfo, {
|
|
415
|
-
results,
|
|
416
|
-
status: "SUCCESS"
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Get the cron callback function
|
|
421
|
-
* @param cron
|
|
422
|
-
* @returns
|
|
423
|
-
*/
|
|
424
|
-
getCronExecutor(cron) {
|
|
425
|
-
return async () => {
|
|
426
|
-
try {
|
|
427
|
-
this.log("INFO", `Execute cron ${cron.cron}: ${cron.serviceName}.${cron.method}(...) # ${cron.description} as an AsyncOperationAction`);
|
|
428
|
-
await this.launchAction(new this.model(cron.serviceName, cron.method, cron.args));
|
|
429
|
-
}
|
|
430
|
-
catch (err) {
|
|
431
|
-
this.log("ERROR", `Execution error cron ${cron.cron}: ${cron.serviceName}.${cron.method}(...) # ${cron.description} - ${err}`);
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Manage scheduled actions and crontab actions
|
|
437
|
-
* @returns
|
|
438
|
-
*/
|
|
439
|
-
scheduler() {
|
|
440
|
-
// Map cron to an AsyncOperationAction
|
|
441
|
-
// It allows you to keep a trace of the cron execution in the AsyncAction
|
|
442
|
-
if (this.parameters.includeCron) {
|
|
443
|
-
CronService.loadAnnotations(this._webda.getServices()).forEach(cron => {
|
|
444
|
-
this.log("INFO", `Schedule cron ${cron.cron}: ${cron.serviceName}.${cron.method}(...) # ${cron.description}`);
|
|
445
|
-
crontabSchedule(cron.cron, this.getCronExecutor(cron));
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
// Every schedulerResolution will check for scheduled task
|
|
449
|
-
return new CancelableLoopPromise(async () => {
|
|
450
|
-
let time = Date.now();
|
|
451
|
-
time -= time % this.parameters.schedulerResolution;
|
|
452
|
-
// Queue all actions
|
|
453
|
-
await Promise.all((await this.model.query(`status = 'SCHEDULED' AND scheduled < ${time + 1}`)).results.map(a => this.launchAction(a)));
|
|
454
|
-
time += this.parameters.schedulerResolution;
|
|
455
|
-
// Wait for next scheduler resolution
|
|
456
|
-
if (time > Date.now()) {
|
|
457
|
-
await Core.sleep(time - Date.now());
|
|
458
|
-
/* c8 ignore next */
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* HMAC Algorithm used for simple auth
|
|
465
|
-
*/
|
|
466
|
-
AsyncJobService.HMAC_ALGO = "sha256";
|
|
467
|
-
export default AsyncJobService;
|
|
468
|
-
export { AsyncJobService };
|
|
469
|
-
//# sourceMappingURL=asyncjobservice.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asyncjobservice.js","sourceRoot":"","sources":["../../src/services/asyncjobservice.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EAEjB,IAAI,EAGJ,WAAW,EACX,SAAS,EACT,SAAS,EAIT,OAAO,EACP,iBAAiB,EACjB,sBAAsB,EAGtB,UAAU,EACX,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAY5C;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAuF9D,YAAY,MAAW;QACrB,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,GAAG,KAAR,IAAI,CAAC,GAAG,GAAK,QAAQ,EAAC;QACtB,IAAI,CAAC,KAAK,KAAV,IAAI,CAAC,KAAK,GAAK,mBAAmB,EAAC;QACnC,IAAI,CAAC,OAAO,KAAZ,IAAI,CAAC,OAAO,GAAK,EAAE,EAAC;QACpB,IAAI,CAAC,mBAAmB,KAAxB,IAAI,CAAC,mBAAmB,GAAK,KAAK,EAAC;QACnC,IAAI,CAAC,YAAY,KAAjB,IAAI,CAAC,YAAY,GAAK,KAAK,EAAC;QAC5B,IAAI,CAAC,WAAW,KAAhB,IAAI,CAAC,WAAW,GAAK,IAAI,EAAC;QAC1B,IAAI,CAAC,SAAS,KAAd,IAAI,CAAC,SAAS,GAAK,GAAG,EAAC;QACvB,IAAI,CAAC,gBAAgB,KAArB,IAAI,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