@webda/async 4.0.0-beta.2 → 4.0.0-beta.4
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
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
2
|
+
var useValue = arguments.length > 2;
|
|
3
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
4
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5
|
+
}
|
|
6
|
+
return useValue ? value : void 0;
|
|
7
|
+
};
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.unshift(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
35
|
+
import { canCallOperation, Command, CronService, listFullOperations, registerOperation, registerSchema, Service, ServiceParameters, SimpleOperationContext, useApplication, useCore, useDynamicService, useModel, useParameters, validateSchema, ValidationError, WebdaError } from "@webda/core";
|
|
36
|
+
import { CancelableLoopPromise, CancelablePromise, FileUtils, getUuid, JSONUtils, sleep } from "@webda/utils";
|
|
37
|
+
import axios from "axios";
|
|
38
|
+
import * as crypto from "node:crypto";
|
|
39
|
+
import { schedule as crontabSchedule } from "node-cron";
|
|
40
|
+
import { Runner } from "./runner.service.js";
|
|
41
|
+
import { ServiceRunner, ServiceRunnerParameters } from "./servicerunner.service.js";
|
|
42
|
+
/**
|
|
43
|
+
* @inheritdoc
|
|
44
|
+
*/
|
|
45
|
+
export class AsyncJobServiceParameters extends ServiceParameters {
|
|
46
|
+
/**
|
|
47
|
+
* @override
|
|
48
|
+
* @param params - the input parameters
|
|
49
|
+
* @returns this
|
|
50
|
+
*/
|
|
51
|
+
load(params = {}) {
|
|
52
|
+
super.load(params);
|
|
53
|
+
this.url ?? (this.url = "/async");
|
|
54
|
+
this.queue ?? (this.queue = "AsyncActionsQueue");
|
|
55
|
+
this.runners ?? (this.runners = []);
|
|
56
|
+
this.schedulerResolution ?? (this.schedulerResolution = 60000);
|
|
57
|
+
this.onlyHttpHook ?? (this.onlyHttpHook = false);
|
|
58
|
+
this.includeCron ?? (this.includeCron = true);
|
|
59
|
+
this.logsLimit ?? (this.logsLimit = 500);
|
|
60
|
+
this.asyncActionModel ?? (this.asyncActionModel = "Webda/AsyncWebdaAction");
|
|
61
|
+
this.asyncOperationModel ?? (this.asyncOperationModel = "Webda/AsyncOperationAction");
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let AsyncJobService = (() => {
|
|
66
|
+
var _a;
|
|
67
|
+
let _classSuper = Service;
|
|
68
|
+
let _instanceExtraInitializers = [];
|
|
69
|
+
let _worker_decorators;
|
|
70
|
+
let _runAction_decorators;
|
|
71
|
+
let _scheduler_decorators;
|
|
72
|
+
return _a = class AsyncJobService extends _classSuper {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(...arguments);
|
|
75
|
+
/**
|
|
76
|
+
* Queue for execution
|
|
77
|
+
*/
|
|
78
|
+
this.queue = __runInitializers(this, _instanceExtraInitializers);
|
|
79
|
+
/**
|
|
80
|
+
* Validator of sessions
|
|
81
|
+
*/
|
|
82
|
+
this.operationsQueries = {};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @inheritdoc
|
|
86
|
+
* @returns this
|
|
87
|
+
*/
|
|
88
|
+
resolve() {
|
|
89
|
+
super.resolve();
|
|
90
|
+
this.model = useModel(this.parameters.asyncActionModel);
|
|
91
|
+
this.queue = this.parameters.queue ? useDynamicService(this.parameters.queue) : undefined;
|
|
92
|
+
if (!this.queue && !this.parameters.localLaunch) {
|
|
93
|
+
throw new Error(`AsyncService requires a valid queue. '${this.parameters.queue}' is invalid`);
|
|
94
|
+
}
|
|
95
|
+
// Get all runners
|
|
96
|
+
this.runners = this.parameters.runners
|
|
97
|
+
.map(n => {
|
|
98
|
+
const res = useDynamicService(n);
|
|
99
|
+
if (res === undefined) {
|
|
100
|
+
this.log("WARN", `Runner ${n} does not exist`);
|
|
101
|
+
}
|
|
102
|
+
return res;
|
|
103
|
+
})
|
|
104
|
+
.filter(r => r !== undefined);
|
|
105
|
+
// Add route for operations launch
|
|
106
|
+
if (this.parameters.asyncOperationDefinition) {
|
|
107
|
+
this.log("INFO", "Loading operations", this.parameters.asyncOperationDefinition);
|
|
108
|
+
this.addRoute(`${this.parameters.url}{?full}`, ["GET"], this.listOperations);
|
|
109
|
+
this.addRoute(`${this.parameters.url}/{operationId}{?schedule}`, ["PUT"], this.launchOperation);
|
|
110
|
+
this.operationModel = useModel(this.parameters.asyncOperationModel);
|
|
111
|
+
this.registerOperations(FileUtils.load(this.parameters.asyncOperationDefinition));
|
|
112
|
+
}
|
|
113
|
+
// This is internal job reporting so no need to document the api
|
|
114
|
+
this.addRoute(`${this.parameters.url}/status`, ["POST"], this.statusHook, {
|
|
115
|
+
hidden: true
|
|
116
|
+
});
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Register new operations
|
|
121
|
+
* @param operations - the operations definition
|
|
122
|
+
*/
|
|
123
|
+
registerOperations(operations) {
|
|
124
|
+
this.operations ?? (this.operations = {
|
|
125
|
+
application: operations.application || { name: "Unknown", version: "0.0.0" },
|
|
126
|
+
operations: {},
|
|
127
|
+
schemas: {}
|
|
128
|
+
});
|
|
129
|
+
// Register all schemas
|
|
130
|
+
const app = useApplication();
|
|
131
|
+
Object.keys(operations?.schemas || {})
|
|
132
|
+
.filter(key => !app.getSchema(key))
|
|
133
|
+
.forEach(key => {
|
|
134
|
+
app.getSchemas()[key] = operations.schemas[key];
|
|
135
|
+
registerSchema(key, operations.schemas[key]);
|
|
136
|
+
this.operations.schemas[key] = operations.schemas[key];
|
|
137
|
+
});
|
|
138
|
+
// Register all operations now
|
|
139
|
+
Object.keys(operations?.operations || {}).forEach(key => {
|
|
140
|
+
registerOperation(key, {
|
|
141
|
+
...operations.operations[key],
|
|
142
|
+
method: "callOperation",
|
|
143
|
+
service: this.getName()
|
|
144
|
+
});
|
|
145
|
+
this.operations.operations[key] = operations.operations[key];
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Allow job status report url
|
|
150
|
+
* @param context - the web context
|
|
151
|
+
* @returns true if the request is a job status report
|
|
152
|
+
*/
|
|
153
|
+
async checkRequest(context) {
|
|
154
|
+
const url = context.getHttpContext().getRelativeUri();
|
|
155
|
+
// Only for status endpoint - operations endpoint should still be authorized by something else
|
|
156
|
+
if (url === `${this.parameters.url}/status`) {
|
|
157
|
+
// Allow status url to be called without other mechanism
|
|
158
|
+
const httpContext = context.getHttpContext();
|
|
159
|
+
return ["X-Job-Id", "X-Job-Time", "X-Job-Hash"].every(v => httpContext.getUniqueHeader(v) !== undefined);
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Status hook for job report
|
|
165
|
+
*
|
|
166
|
+
* Only updates specific fields: status, errorMessage, statusDetails, results, logs (appending)
|
|
167
|
+
* @param context - the web context
|
|
168
|
+
*/
|
|
169
|
+
async statusHook(context) {
|
|
170
|
+
if (!context.getHttpContext().getUniqueHeader("X-Job-Id")) {
|
|
171
|
+
throw new WebdaError.NotFound("X-Job-Id header required");
|
|
172
|
+
}
|
|
173
|
+
const jobId = context.getHttpContext().getUniqueHeader("X-Job-Id");
|
|
174
|
+
if (!(await this.model.ref(jobId).exists())) {
|
|
175
|
+
throw new WebdaError.NotFound(`Unknown Job Id '${jobId}'`);
|
|
176
|
+
}
|
|
177
|
+
const action = await this.model.ref(jobId).get();
|
|
178
|
+
await action.statusAction(context);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Worker
|
|
182
|
+
*
|
|
183
|
+
* This will launch actions based on defined runners
|
|
184
|
+
* @returns a cancelable promise
|
|
185
|
+
*/
|
|
186
|
+
worker() {
|
|
187
|
+
if (this.runners.length === 0) {
|
|
188
|
+
throw new Error(`AsyncJobService.worker requires runners`);
|
|
189
|
+
}
|
|
190
|
+
const p = [this.queue.consume(this.handleEvent.bind(this))];
|
|
191
|
+
if (this.parameters.includeSchedulerInWorker) {
|
|
192
|
+
p.push(this.scheduler());
|
|
193
|
+
}
|
|
194
|
+
// Return a cancelable promise for both worker and scheduler
|
|
195
|
+
return new CancelablePromise((resolve, reject) => {
|
|
196
|
+
Promise.all(p).then(() => resolve(), reject);
|
|
197
|
+
}, async () => {
|
|
198
|
+
this.log("INFO", "Worker stopped");
|
|
199
|
+
await Promise.all(p.map(pi => (pi.cancel ? pi.cancel() : "")));
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Handle one event from the queue and launch the job
|
|
204
|
+
* @param event - the queue item
|
|
205
|
+
* @returns the job promise if any
|
|
206
|
+
*/
|
|
207
|
+
async handleEvent(event) {
|
|
208
|
+
let selectedRunner;
|
|
209
|
+
// Take first to acknowledge the job
|
|
210
|
+
for (const runner of this.runners) {
|
|
211
|
+
if (runner.handleType(event.type)) {
|
|
212
|
+
selectedRunner = runner;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Fallback if needed
|
|
217
|
+
if (selectedRunner === undefined && this.parameters.fallbackOnFirst) {
|
|
218
|
+
selectedRunner = this.runners[0];
|
|
219
|
+
}
|
|
220
|
+
if (selectedRunner === undefined) {
|
|
221
|
+
this.log("ERROR", `Cannot find a runner for action ${event.uuid}`);
|
|
222
|
+
await this.model.ref(event.uuid).patch({
|
|
223
|
+
status: "ERROR",
|
|
224
|
+
errorMessage: `No runner found for the job`
|
|
225
|
+
});
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.log("INFO", `Starting action ${event.uuid}`);
|
|
229
|
+
await this.model.ref(event.uuid).patch({
|
|
230
|
+
status: "STARTING"
|
|
231
|
+
});
|
|
232
|
+
const action = await this.model.ref(event.uuid).get();
|
|
233
|
+
const job = await selectedRunner.launchAction(action, this.getJobInfo(action));
|
|
234
|
+
await action.patch({ job });
|
|
235
|
+
return job.promise || Promise.resolve();
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Absolute url of the status hook remote runners POST their reports to
|
|
239
|
+
*
|
|
240
|
+
* It is this service status route: its request filter lets the job headers through
|
|
241
|
+
* and the HMAC is then verified by the action
|
|
242
|
+
* @returns the hook url
|
|
243
|
+
*/
|
|
244
|
+
getHookUrl() {
|
|
245
|
+
return `${useParameters().apiUrl ?? ""}${this.parameters.url}/status`;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get the job info
|
|
249
|
+
* @param action - the action
|
|
250
|
+
* @returns the job information
|
|
251
|
+
*/
|
|
252
|
+
getJobInfo(action) {
|
|
253
|
+
return {
|
|
254
|
+
JOB_SECRET_KEY: action.__secretKey,
|
|
255
|
+
JOB_ID: action.uuid,
|
|
256
|
+
JOB_HOOK: this.parameters.onlyHttpHook || !action.isInternal() ? this.getHookUrl() : "store",
|
|
257
|
+
JOB_ORCHESTRATOR: this.getName()
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* List available operations through this service
|
|
262
|
+
* @param context - the web context
|
|
263
|
+
*/
|
|
264
|
+
async listOperations(context) {
|
|
265
|
+
const filtered = JSONUtils.duplicate(this.operations);
|
|
266
|
+
// Filter operations based on permissions
|
|
267
|
+
Object.keys(filtered.operations)
|
|
268
|
+
.filter(key => filtered.operations[key].permission && !canCallOperation(context, key))
|
|
269
|
+
.forEach(key => delete filtered.operations[key]);
|
|
270
|
+
// Remove permission definition
|
|
271
|
+
Object.values(filtered.operations)
|
|
272
|
+
.filter(def => def.permission)
|
|
273
|
+
.forEach(def => delete def.permission);
|
|
274
|
+
if (!context.getParameters().full) {
|
|
275
|
+
context.write(Object.keys(filtered.operations));
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const schemas = [];
|
|
279
|
+
Object.values(filtered.operations).forEach((operation) => {
|
|
280
|
+
if (operation.input && operation.input !== "void") {
|
|
281
|
+
schemas.push(operation.input);
|
|
282
|
+
}
|
|
283
|
+
if (operation.output && operation.output !== "void") {
|
|
284
|
+
schemas.push(operation.output);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
// Filter schemas
|
|
288
|
+
Object.keys(filtered.schemas)
|
|
289
|
+
.filter(key => !schemas.includes(key))
|
|
290
|
+
.forEach(key => {
|
|
291
|
+
delete filtered.schemas[key];
|
|
292
|
+
});
|
|
293
|
+
context.write(filtered);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Call an operation for an external system
|
|
297
|
+
* @param context - the operation context
|
|
298
|
+
* @returns the launched action
|
|
299
|
+
*/
|
|
300
|
+
async callOperation(context) {
|
|
301
|
+
return await this.launchAction(new this.operationModel(context.getExtension("operation"), context));
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Check the operation exists, is allowed and its input is valid
|
|
305
|
+
* @param context - the operation context
|
|
306
|
+
* @param operationId - the operation id
|
|
307
|
+
*/
|
|
308
|
+
async checkOperation(context, operationId) {
|
|
309
|
+
const operation = listFullOperations()[operationId];
|
|
310
|
+
if (!operation) {
|
|
311
|
+
throw new WebdaError.NotFound(`${operationId} Unknown`);
|
|
312
|
+
}
|
|
313
|
+
if (!canCallOperation(context, operationId)) {
|
|
314
|
+
throw new WebdaError.Forbidden(`${operationId} PermissionDenied`);
|
|
315
|
+
}
|
|
316
|
+
if (operation.input && operation.input !== "void") {
|
|
317
|
+
try {
|
|
318
|
+
validateSchema(operation.input, await context.getInput());
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
if (err instanceof ValidationError) {
|
|
322
|
+
throw new WebdaError.BadRequest(`${operationId} InvalidInput ${err.message}`);
|
|
323
|
+
}
|
|
324
|
+
throw err;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Launch an operation through this service
|
|
330
|
+
* @param context - the web context
|
|
331
|
+
*/
|
|
332
|
+
async launchOperation(context) {
|
|
333
|
+
const { operationId, schedule } = context.getParameters();
|
|
334
|
+
await this.checkOperation(context, operationId);
|
|
335
|
+
let action;
|
|
336
|
+
if (schedule) {
|
|
337
|
+
action = await this.scheduleAction(new this.operationModel(operationId, await SimpleOperationContext.fromContext(context)), schedule);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
action = await this.callOperation((await SimpleOperationContext.fromContext(context)).setExtension("operation", operationId));
|
|
341
|
+
}
|
|
342
|
+
context.write(action);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Launch the action asynchronously
|
|
346
|
+
* @param action - the action
|
|
347
|
+
* @returns the action
|
|
348
|
+
*/
|
|
349
|
+
async launchAction(action) {
|
|
350
|
+
action.status = "QUEUED";
|
|
351
|
+
action.type = action.constructor.name;
|
|
352
|
+
action.__secretKey = getUuid();
|
|
353
|
+
await action.save();
|
|
354
|
+
const item = { uuid: action.uuid, __secretKey: action.__secretKey, type: action.type };
|
|
355
|
+
if (this.parameters.localLaunch) {
|
|
356
|
+
// Directly call the handler but not wait for its result
|
|
357
|
+
this.handleEvent(item);
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
await this.queue.sendMessage(item);
|
|
361
|
+
}
|
|
362
|
+
return action;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Schedule action for later execution
|
|
366
|
+
*
|
|
367
|
+
* @param action - the action
|
|
368
|
+
* @param timestamp - when to launch it
|
|
369
|
+
* @returns the action
|
|
370
|
+
*/
|
|
371
|
+
async scheduleAction(action, timestamp) {
|
|
372
|
+
action.status = "SCHEDULED";
|
|
373
|
+
action.type = action.constructor.name;
|
|
374
|
+
// Schedule based on the scheduler resolution
|
|
375
|
+
action.scheduled = timestamp - (timestamp % this.parameters.schedulerResolution);
|
|
376
|
+
await action.save();
|
|
377
|
+
return action;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Return headers to request status hook
|
|
381
|
+
*
|
|
382
|
+
* @param jobInfo - the job information
|
|
383
|
+
* @returns the headers
|
|
384
|
+
*/
|
|
385
|
+
getHeaders(jobInfo) {
|
|
386
|
+
const res = {
|
|
387
|
+
"X-Job-Id": jobInfo.JOB_ID,
|
|
388
|
+
"X-Job-Time": Date.now().toString()
|
|
389
|
+
};
|
|
390
|
+
res["X-Job-Hash"] = crypto
|
|
391
|
+
.createHmac(_a.HMAC_ALGO, jobInfo.JOB_SECRET_KEY)
|
|
392
|
+
.update(res["X-Job-Time"])
|
|
393
|
+
.digest("hex");
|
|
394
|
+
return res;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Post hook to a remote url or use local store to update status
|
|
398
|
+
* @param jobInfo - the job information
|
|
399
|
+
* @param message - the status report
|
|
400
|
+
* @returns the updated action
|
|
401
|
+
*/
|
|
402
|
+
async postHook(jobInfo, message) {
|
|
403
|
+
// Http allow to break paradigm between the executor and the orchestrator
|
|
404
|
+
if (jobInfo.JOB_HOOK.startsWith("http")) {
|
|
405
|
+
return (await axios.post(jobInfo.JOB_HOOK, message, {
|
|
406
|
+
headers: this.getHeaders(jobInfo)
|
|
407
|
+
})).data;
|
|
408
|
+
}
|
|
409
|
+
else if (jobInfo.JOB_HOOK === "store") {
|
|
410
|
+
// If executor and orchestrator runs within same privilege it simplify the infrastructure
|
|
411
|
+
return (await this.model.ref(jobInfo.JOB_ID).get()).update(message);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Launch a service.method as an AsyncAction
|
|
416
|
+
* @param serviceName - the service
|
|
417
|
+
* @param method - the method
|
|
418
|
+
* @param args - the arguments
|
|
419
|
+
* @returns the action
|
|
420
|
+
*/
|
|
421
|
+
async launchAsAsyncAction(serviceName, method, ...args) {
|
|
422
|
+
return this.launchAction(new this.model(serviceName, method, ...args));
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Execute a service.method as an AsyncAction
|
|
426
|
+
*
|
|
427
|
+
* Useful for crontab execution
|
|
428
|
+
* @param serviceName - the service
|
|
429
|
+
* @param method - the method
|
|
430
|
+
* @param args - the arguments
|
|
431
|
+
* @returns the execution promise
|
|
432
|
+
*/
|
|
433
|
+
async executeAsAsyncAction(serviceName, method, ...args) {
|
|
434
|
+
let runner = Object.values(useCore().getServices()).find(s => s instanceof ServiceRunner);
|
|
435
|
+
// Create a temporary one if needed
|
|
436
|
+
runner ?? (runner = await new ServiceRunner(this.getName() + "_temprunner", new ServiceRunnerParameters().load({ type: "Webda/ServiceRunner" }))
|
|
437
|
+
.resolve()
|
|
438
|
+
.init());
|
|
439
|
+
// Save action
|
|
440
|
+
const action = await new this.model(serviceName, method, ...args).save();
|
|
441
|
+
// Run it
|
|
442
|
+
return (await runner.launchAction(action, this.getJobInfo(action))).promise;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Run the AsyncAction described by the JOB_* environment variables
|
|
446
|
+
* @returns the execution promise
|
|
447
|
+
*/
|
|
448
|
+
async runAction() {
|
|
449
|
+
return this.runAsyncOperationAction();
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Wrap async job and call the job status hook
|
|
453
|
+
* @param jobInfo - the job information, from environment if not provided
|
|
454
|
+
* @returns a promise resolved once the job is reported
|
|
455
|
+
*/
|
|
456
|
+
async runAsyncOperationAction(jobInfo) {
|
|
457
|
+
// Get it from environment
|
|
458
|
+
if (jobInfo === undefined) {
|
|
459
|
+
jobInfo = {};
|
|
460
|
+
Object.keys(process.env)
|
|
461
|
+
.filter(k => k.startsWith("JOB_"))
|
|
462
|
+
// @ts-ignore
|
|
463
|
+
.forEach((k) => (jobInfo[k] = process.env[k]));
|
|
464
|
+
}
|
|
465
|
+
// Ensure correct context
|
|
466
|
+
if (!jobInfo.JOB_ORCHESTRATOR || !jobInfo.JOB_ID || !jobInfo.JOB_SECRET_KEY || !jobInfo.JOB_HOOK) {
|
|
467
|
+
this.log("ERROR", "Cannot run AsyncAction without context");
|
|
468
|
+
throw new Error("Cannot run AsyncAction without context");
|
|
469
|
+
}
|
|
470
|
+
// If we are not the target redirect to the right one
|
|
471
|
+
if (jobInfo.JOB_ORCHESTRATOR !== this.getName()) {
|
|
472
|
+
this.log("DEBUG", `Passing jobInfo ${jobInfo} to targeted service`);
|
|
473
|
+
return useDynamicService(jobInfo.JOB_ORCHESTRATOR).runAsyncOperationAction(jobInfo);
|
|
474
|
+
}
|
|
475
|
+
this.log("DEBUG", "Getting action to execute from hook", jobInfo);
|
|
476
|
+
// Get action info by calling the hook
|
|
477
|
+
const action = await this.postHook(jobInfo, {
|
|
478
|
+
agent: {
|
|
479
|
+
...Runner.getAgentInfo(),
|
|
480
|
+
nodeVersion: process.version
|
|
481
|
+
},
|
|
482
|
+
status: "RUNNING"
|
|
483
|
+
});
|
|
484
|
+
this.log("DEBUG", "Action received", action.serviceName, action.method, action.arguments);
|
|
485
|
+
let results;
|
|
486
|
+
try {
|
|
487
|
+
// Check it contains the right info
|
|
488
|
+
if (!action.method || !action.serviceName) {
|
|
489
|
+
throw new Error("WebdaAsyncAction must have method and serviceName defined at least");
|
|
490
|
+
}
|
|
491
|
+
// Call the service[method](...args)
|
|
492
|
+
const service = useDynamicService(action.serviceName);
|
|
493
|
+
if (!service) {
|
|
494
|
+
throw new Error(`WebdaAsyncAction Service '${action.serviceName}' not found: mismatch app version`);
|
|
495
|
+
}
|
|
496
|
+
// @ts-ignore
|
|
497
|
+
if (!service[action.method]) {
|
|
498
|
+
throw new Error(`WebdaAsyncAction Method '${action.method}' not found in service ${action.serviceName}: mismatch app version`);
|
|
499
|
+
}
|
|
500
|
+
// @ts-ignore
|
|
501
|
+
results = await service[action.method](...(action.arguments || []));
|
|
502
|
+
}
|
|
503
|
+
catch (err) {
|
|
504
|
+
// Job is in error
|
|
505
|
+
await this.postHook(jobInfo, {
|
|
506
|
+
errorMessage: err?.message,
|
|
507
|
+
status: "ERROR"
|
|
508
|
+
});
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
// Update status
|
|
512
|
+
await this.postHook(jobInfo, {
|
|
513
|
+
results,
|
|
514
|
+
status: "SUCCESS"
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Get the cron callback function
|
|
519
|
+
* @param cron - the cron definition
|
|
520
|
+
* @returns the cron callback
|
|
521
|
+
*/
|
|
522
|
+
getCronExecutor(cron) {
|
|
523
|
+
return async () => {
|
|
524
|
+
try {
|
|
525
|
+
this.log("INFO", `Execute cron ${cron.cron}: ${cron.serviceName}.${cron.method}(...) # ${cron.description} as an AsyncOperationAction`);
|
|
526
|
+
await this.launchAction(new this.model(cron.serviceName, cron.method, cron.args));
|
|
527
|
+
}
|
|
528
|
+
catch (err) {
|
|
529
|
+
this.log("ERROR", `Execution error cron ${cron.cron}: ${cron.serviceName}.${cron.method}(...) # ${cron.description} - ${err}`);
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Manage scheduled actions and crontab actions
|
|
535
|
+
* @returns a cancelable loop promise
|
|
536
|
+
*/
|
|
537
|
+
scheduler() {
|
|
538
|
+
// Map cron to an AsyncOperationAction
|
|
539
|
+
// It allows you to keep a trace of the cron execution in the AsyncAction
|
|
540
|
+
if (this.parameters.includeCron) {
|
|
541
|
+
CronService.loadAnnotations(useCore().getServices()).forEach(cron => {
|
|
542
|
+
this.log("INFO", `Schedule cron ${cron.cron}: ${cron.serviceName}.${cron.method}(...) # ${cron.description}`);
|
|
543
|
+
crontabSchedule(cron.cron, this.getCronExecutor(cron));
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
// Every schedulerResolution will check for scheduled task
|
|
547
|
+
return new CancelableLoopPromise(async () => {
|
|
548
|
+
let time = Date.now();
|
|
549
|
+
time -= time % this.parameters.schedulerResolution;
|
|
550
|
+
// Queue all actions
|
|
551
|
+
await Promise.all((await this.model.query(`status = 'SCHEDULED' AND scheduled < ${time + 1}`)).results.map(a => this.launchAction(a)));
|
|
552
|
+
time += this.parameters.schedulerResolution;
|
|
553
|
+
// Wait for next scheduler resolution
|
|
554
|
+
if (time > Date.now()) {
|
|
555
|
+
await sleep(time - Date.now());
|
|
556
|
+
/* c8 ignore next */
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
(() => {
|
|
562
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
563
|
+
_worker_decorators = [Command("async worker", { description: "Launch the async actions worker" })];
|
|
564
|
+
_runAction_decorators = [Command("async run", { description: "Run the async action described by the JOB_* environment variables" })];
|
|
565
|
+
_scheduler_decorators = [Command("async scheduler", { description: "Launch the async actions scheduler" })];
|
|
566
|
+
__esDecorate(_a, null, _worker_decorators, { kind: "method", name: "worker", static: false, private: false, access: { has: obj => "worker" in obj, get: obj => obj.worker }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
567
|
+
__esDecorate(_a, null, _runAction_decorators, { kind: "method", name: "runAction", static: false, private: false, access: { has: obj => "runAction" in obj, get: obj => obj.runAction }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
568
|
+
__esDecorate(_a, null, _scheduler_decorators, { kind: "method", name: "scheduler", static: false, private: false, access: { has: obj => "scheduler" in obj, get: obj => obj.scheduler }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
569
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
570
|
+
})(),
|
|
571
|
+
/**
|
|
572
|
+
* HMAC Algorithm used for simple auth
|
|
573
|
+
*/
|
|
574
|
+
_a.HMAC_ALGO = "sha256",
|
|
575
|
+
_a;
|
|
576
|
+
})();
|
|
577
|
+
/**
|
|
578
|
+
* AsyncService allows you to launch jobs and report status
|
|
579
|
+
*
|
|
580
|
+
* @WebdaModda
|
|
581
|
+
*/
|
|
582
|
+
export default AsyncJobService;
|
|
583
|
+
export { AsyncJobService };
|
|
584
|
+
//# sourceMappingURL=asyncjobservice.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncjobservice.service.js","sourceRoot":"","sources":["../../src/services/asyncjobservice.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,gBAAgB,EAChB,OAAO,EAEP,WAAW,EACX,kBAAkB,EAGlB,iBAAiB,EACjB,cAAc,EAEd,OAAO,EACP,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,EACd,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,cAAc,EACd,eAAe,EAEf,UAAU,EACX,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE9G,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAYpF;;GAEG;AACH,MAAM,OAAO,yBAA0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