verteilen-core 1.4.21 → 1.4.22
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/dist/client/analysis.d.ts +0 -17
- package/dist/client/analysis.js +0 -22
- package/dist/client/client.d.ts +0 -17
- package/dist/client/client.js +4 -34
- package/dist/client/cluster.d.ts +0 -3
- package/dist/client/cluster.js +0 -32
- package/dist/client/database.d.ts +0 -16
- package/dist/client/database.js +0 -16
- package/dist/client/execute.d.ts +0 -33
- package/dist/client/execute.js +0 -38
- package/dist/client/javascript.d.ts +0 -23
- package/dist/client/javascript.js +0 -34
- package/dist/client/job_database.d.ts +0 -4
- package/dist/client/job_database.js +0 -4
- package/dist/client/job_execute.d.ts +0 -28
- package/dist/client/job_execute.js +0 -29
- package/dist/client/os.d.ts +0 -26
- package/dist/client/os.js +0 -32
- package/dist/client/resource.d.ts +0 -3
- package/dist/client/resource.js +0 -8
- package/dist/client/shell.d.ts +0 -16
- package/dist/client/shell.js +0 -21
- package/dist/computed.d.ts +0 -13
- package/dist/computed.js +32 -29
- package/dist/index.js +0 -4
- package/dist/interface/base.d.ts +0 -261
- package/dist/interface/base.js +0 -8
- package/dist/interface/bus.d.ts +0 -73
- package/dist/interface/enum.d.ts +0 -67
- package/dist/interface/enum.js +0 -74
- package/dist/interface/execute.d.ts +0 -46
- package/dist/interface/log.d.ts +0 -54
- package/dist/interface/plugin.d.ts +0 -192
- package/dist/interface/record.d.ts +0 -13
- package/dist/interface/server.d.ts +0 -20
- package/dist/interface/server.js +0 -8
- package/dist/interface/struct.d.ts +1 -140
- package/dist/interface/table.d.ts +0 -39
- package/dist/interface/ui.d.ts +0 -104
- package/dist/interface/ui.js +0 -8
- package/dist/interface.d.ts +0 -30
- package/dist/interface.js +18 -44
- package/dist/plugins/i18n.d.ts +0 -19
- package/dist/plugins/i18n.js +0 -24
- package/dist/script/console_manager.d.ts +0 -3
- package/dist/script/console_manager.js +0 -3
- package/dist/script/console_server_manager.d.ts +0 -3
- package/dist/script/console_server_manager.js +0 -3
- package/dist/script/execute/base.d.ts +2 -98
- package/dist/script/execute/base.js +0 -105
- package/dist/script/execute/feedback.d.ts +0 -34
- package/dist/script/execute/feedback.js +0 -46
- package/dist/script/execute/region_job.js +0 -6
- package/dist/script/execute/region_project.js +0 -17
- package/dist/script/execute/region_subtask.js +0 -5
- package/dist/script/execute/region_task.d.ts +5 -41
- package/dist/script/execute/region_task.js +0 -75
- package/dist/script/execute/runner.d.ts +0 -7
- package/dist/script/execute/runner.js +0 -15
- package/dist/script/execute/util_parser.d.ts +0 -41
- package/dist/script/execute/util_parser.js +1 -47
- package/dist/script/execute_manager.d.ts +0 -38
- package/dist/script/execute_manager.js +0 -54
- package/dist/script/socket_manager.d.ts +0 -79
- package/dist/script/socket_manager.js +0 -84
- package/dist/script/webhook_server_manager.js +1 -1
- package/dist/server/detail/console_handle.d.ts +0 -13
- package/dist/server/detail/console_handle.js +0 -14
- package/dist/server/detail/log_handle.d.ts +0 -5
- package/dist/server/detail/log_handle.js +0 -5
- package/dist/server/detail.d.ts +4 -32
- package/dist/server/detail.js +0 -43
- package/dist/server/io.d.ts +0 -21
- package/dist/server/io.js +0 -18
- package/dist/server/io2.d.ts +0 -19
- package/dist/server/io2.js +0 -54
- package/dist/server/module/account.d.ts +0 -6
- package/dist/server/module/account.js +0 -11
- package/dist/server/module/project.d.ts +1 -50
- package/dist/server/module/project.js +0 -49
- package/dist/server/plugin.d.ts +0 -51
- package/dist/server/plugin.js +0 -13
- package/dist/server/server.d.ts +0 -21
- package/dist/server/server.js +0 -10
- package/dist/server/server2.d.ts +0 -4
- package/dist/server/server2.js +0 -9
- package/dist/server.d.ts +0 -3
- package/dist/server.js +0 -3
- package/jest.config.js +11 -0
- package/package.json +3 -2
- package/src/client/client.ts +1 -1
- package/src/computed.ts +1 -5
- package/src/interface/struct.ts +1 -1
- package/src/script/webhook_server_manager.ts +1 -1
- package/test/call/print.ts +1 -1
- package/tsconfig.json +4 -4
- package/dist/util/port.d.ts +0 -1
- package/dist/util/port.js +0 -15
- package/jest.config.ts +0 -12
- package/src/util/port.ts +0 -15
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { DataType, ExecuteState } from "../../interface";
|
|
7
2
|
import { Region_Job } from "./region_job";
|
|
8
3
|
import { Region_Subtask } from "./region_subtask";
|
|
@@ -28,9 +23,6 @@ export class Region_Task {
|
|
|
28
23
|
return this.target.runner;
|
|
29
24
|
}
|
|
30
25
|
RUN = () => {
|
|
31
|
-
/**
|
|
32
|
-
* When it's the first iteration for this task
|
|
33
|
-
*/
|
|
34
26
|
if (this.target.t_state == ExecuteState.NONE) {
|
|
35
27
|
this.target.t_state = ExecuteState.RUNNING;
|
|
36
28
|
this.multithread = this.task.multi ? this.get_task_multi_count(this.task) : 1;
|
|
@@ -38,11 +30,7 @@ export class Region_Task {
|
|
|
38
30
|
}
|
|
39
31
|
let allJobFinish = false;
|
|
40
32
|
const hasJob = this.task.jobs.length > 0;
|
|
41
|
-
/**
|
|
42
|
-
* If a task has no job... we have to skip it...
|
|
43
|
-
*/
|
|
44
33
|
if (!hasJob) {
|
|
45
|
-
// We end it gracefully.
|
|
46
34
|
this.target.proxy?.executeTaskStart([this.task, this.task_count]);
|
|
47
35
|
this.target.proxy?.executeTaskFinish(this.task);
|
|
48
36
|
this.target.messager_log(`[Execute] Skip ! No job exists ${this.task.uuid}`);
|
|
@@ -62,30 +50,14 @@ export class Region_Task {
|
|
|
62
50
|
this.ExecuteTask_AllFinish(this.project, this.task);
|
|
63
51
|
}
|
|
64
52
|
};
|
|
65
|
-
/**
|
|
66
|
-
* It will spawn amounts of cronjob and send the tasks for assigned node to execute them one by one
|
|
67
|
-
* @param taskCount Should be equal to cronjob result
|
|
68
|
-
* @returns Is finish executing
|
|
69
|
-
*/
|
|
70
53
|
ExecuteTask_Cronjob(project, task, taskCount) {
|
|
71
54
|
let ns = this.get_idle_open();
|
|
72
55
|
let allJobFinish = false;
|
|
73
|
-
/**
|
|
74
|
-
* if current_cron length is zero\
|
|
75
|
-
* this means the init process has not been run yet
|
|
76
|
-
*/
|
|
77
56
|
if (this.cron.length == 0) {
|
|
78
|
-
// First time
|
|
79
57
|
this.Init_CronContainer(taskCount);
|
|
80
58
|
this.target.messager_log(`[Execute] TaskCount: ${taskCount}`);
|
|
81
59
|
}
|
|
82
60
|
else {
|
|
83
|
-
// If disconnect or deleted...
|
|
84
|
-
/**
|
|
85
|
-
* We query all the cron state and get all the processing first and count it\
|
|
86
|
-
* All we want is to filter out the node which is fully load\
|
|
87
|
-
* So we can follow the multithread limit to send the mission
|
|
88
|
-
*/
|
|
89
61
|
const worker = this.cron.filter(x => x.uuid != '').map(x => x.uuid);
|
|
90
62
|
const counter = [];
|
|
91
63
|
worker.forEach(uuid => {
|
|
@@ -102,15 +74,12 @@ export class Region_Task {
|
|
|
102
74
|
allJobFinish = true;
|
|
103
75
|
}
|
|
104
76
|
else {
|
|
105
|
-
// Assign worker
|
|
106
|
-
// Find the cron which is need to be execute by a node
|
|
107
77
|
const needs = this.cron.filter(x => x.uuid == '' && x.work.filter(y => y.state != ExecuteState.FINISH && y.state != ExecuteState.ERROR).length > 0);
|
|
108
78
|
const min = Math.min(needs.length, ns.length);
|
|
109
79
|
for (let i = 0; i < min; i++) {
|
|
110
80
|
needs[i].uuid = ns[i].uuid;
|
|
111
81
|
}
|
|
112
82
|
const single = this.cron.filter(x => x.uuid != '');
|
|
113
|
-
// Execute
|
|
114
83
|
for (var cronwork of single) {
|
|
115
84
|
const index = this.target.current_nodes.findIndex(x => x.uuid == cronwork.uuid);
|
|
116
85
|
if (index != -1) {
|
|
@@ -123,16 +92,10 @@ export class Region_Task {
|
|
|
123
92
|
}
|
|
124
93
|
return allJobFinish;
|
|
125
94
|
}
|
|
126
|
-
/**
|
|
127
|
-
* There will be no CronTask be called, it will go straight to the Execute job section
|
|
128
|
-
* @param taskCount Must be 1
|
|
129
|
-
* @returns Is finish executing
|
|
130
|
-
*/
|
|
131
95
|
ExecuteTask_Single(project, task, taskCount) {
|
|
132
96
|
let allJobFinish = false;
|
|
133
97
|
let ns = [];
|
|
134
98
|
if (this.target.current_job.length > 0) {
|
|
135
|
-
// If disconnect or deleted...
|
|
136
99
|
const last = this.target.current_nodes.find(x => x.uuid == this.job[0].uuid);
|
|
137
100
|
if (last == undefined) {
|
|
138
101
|
ns = this.get_idle();
|
|
@@ -147,7 +110,6 @@ export class Region_Task {
|
|
|
147
110
|
}
|
|
148
111
|
}
|
|
149
112
|
else {
|
|
150
|
-
// First time
|
|
151
113
|
this.sync_local_para(this.target.localPara);
|
|
152
114
|
ns = this.get_idle();
|
|
153
115
|
if (ns.length > 0) {
|
|
@@ -182,12 +144,7 @@ export class Region_Task {
|
|
|
182
144
|
ExecuteTask_Setup(project, task, taskCount) {
|
|
183
145
|
let ns = this.get_idle_open();
|
|
184
146
|
let allJobFinish = false;
|
|
185
|
-
/**
|
|
186
|
-
* if current_cron length is zero\
|
|
187
|
-
* this means the init process has not been run yet
|
|
188
|
-
*/
|
|
189
147
|
if (this.cron.length == 0) {
|
|
190
|
-
// First time
|
|
191
148
|
this.Init_CronContainer(taskCount);
|
|
192
149
|
this.target.messager_log(`[Execute] TaskCount: ${taskCount}`);
|
|
193
150
|
for (let i = 0; i < this.cron.length; i++) {
|
|
@@ -199,7 +156,6 @@ export class Region_Task {
|
|
|
199
156
|
}
|
|
200
157
|
else {
|
|
201
158
|
const single = this.cron.filter(x => x.uuid != '');
|
|
202
|
-
// Execute
|
|
203
159
|
for (var cronwork of single) {
|
|
204
160
|
const index = this.target.current_nodes.findIndex(x => x.uuid == cronwork.uuid);
|
|
205
161
|
if (index != -1) {
|
|
@@ -217,12 +173,10 @@ export class Region_Task {
|
|
|
217
173
|
this.target.messager_log(`[Execute] Task Finish ${task.uuid}`);
|
|
218
174
|
const index = project.tasks.findIndex(x => x.uuid == task.uuid);
|
|
219
175
|
if (index == project.tasks.length - 1) {
|
|
220
|
-
// Finish
|
|
221
176
|
this.parent.runner = undefined;
|
|
222
177
|
this.target.t_state = ExecuteState.FINISH;
|
|
223
178
|
}
|
|
224
179
|
else {
|
|
225
|
-
// Next
|
|
226
180
|
this.parent.runner = new Region_Task(this.target, project.tasks[index + 1]);
|
|
227
181
|
this.target.t_state = ExecuteState.NONE;
|
|
228
182
|
}
|
|
@@ -232,7 +186,6 @@ export class Region_Task {
|
|
|
232
186
|
Init_CronContainer = (taskCount) => {
|
|
233
187
|
this.sync_local_para(this.target.localPara);
|
|
234
188
|
this.cron = [];
|
|
235
|
-
// Create the cronjob instance here
|
|
236
189
|
for (let i = 0; i < taskCount; i++) {
|
|
237
190
|
const d = {
|
|
238
191
|
id: i,
|
|
@@ -250,21 +203,12 @@ export class Region_Task {
|
|
|
250
203
|
}
|
|
251
204
|
this.target.proxy?.executeTaskStart([this.task, taskCount]);
|
|
252
205
|
};
|
|
253
|
-
//#region Uility
|
|
254
|
-
/**
|
|
255
|
-
* Filter out the idle and connection open nodes
|
|
256
|
-
* @returns All idle and open connection nodes
|
|
257
|
-
*/
|
|
258
206
|
get_idle = () => {
|
|
259
207
|
return this.target.current_nodes.filter(x => this.check_socket_state(x) != ExecuteState.RUNNING && x.websocket.readyState == 1);
|
|
260
208
|
};
|
|
261
209
|
check_socket_state = (target) => {
|
|
262
210
|
return target.current_job.length == 0 ? ExecuteState.NONE : ExecuteState.RUNNING;
|
|
263
211
|
};
|
|
264
|
-
/**
|
|
265
|
-
* This will let nodes update the database and lib
|
|
266
|
-
* @param target
|
|
267
|
-
*/
|
|
268
212
|
sync_local_para = (target) => {
|
|
269
213
|
this.target.current_nodes.forEach(x => this.sync_para(target, x));
|
|
270
214
|
this.target.proxy?.updateDatabase(target);
|
|
@@ -286,41 +230,22 @@ export class Region_Task {
|
|
|
286
230
|
get_idle_open = () => {
|
|
287
231
|
return this.target.current_nodes.filter(x => x.websocket.readyState == 1);
|
|
288
232
|
};
|
|
289
|
-
/**
|
|
290
|
-
* Check all the cronjob is finish or not
|
|
291
|
-
*/
|
|
292
233
|
check_all_cron_end = () => {
|
|
293
234
|
return this.cron.filter(x => !this.check_cron_end(x)).length == 0;
|
|
294
235
|
};
|
|
295
|
-
/**
|
|
296
|
-
* Check input cronjob is finish or not
|
|
297
|
-
* @param cron target cronjob instance
|
|
298
|
-
*/
|
|
299
236
|
check_cron_end = (cron) => {
|
|
300
237
|
return cron.work.filter(x => x.state == ExecuteState.RUNNING || x.state == ExecuteState.NONE).length == 0;
|
|
301
238
|
};
|
|
302
|
-
/**
|
|
303
|
-
* Check current single is finish or not
|
|
304
|
-
*/
|
|
305
239
|
check_single_end = () => {
|
|
306
240
|
if (this.task == undefined)
|
|
307
241
|
return false;
|
|
308
242
|
return this.job.length == this.task.jobs.length &&
|
|
309
243
|
this.job.filter(y => y.state == ExecuteState.RUNNING || y.state == ExecuteState.NONE).length == 0;
|
|
310
244
|
};
|
|
311
|
-
/**
|
|
312
|
-
* Get the multi-core setting\
|
|
313
|
-
* Find in the database setting
|
|
314
|
-
* @param key The multi-core-key
|
|
315
|
-
* @returns
|
|
316
|
-
*/
|
|
317
245
|
get_task_multi_count = (t) => {
|
|
318
246
|
const r = this.get_number(t.multiKey);
|
|
319
247
|
return r == -1 ? 1 : r;
|
|
320
248
|
};
|
|
321
|
-
/**
|
|
322
|
-
* Get the task's cronjob count
|
|
323
|
-
*/
|
|
324
249
|
get_task_state_count(t) {
|
|
325
250
|
if (t.setupjob)
|
|
326
251
|
return this.target.current_nodes.length;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { Project } from "../../interface";
|
|
2
2
|
import { ExecuteManager_Feedback } from "./feedback";
|
|
3
|
-
/**
|
|
4
|
-
* The execute runner
|
|
5
|
-
*/
|
|
6
3
|
export declare class ExecuteManager_Runner extends ExecuteManager_Feedback {
|
|
7
|
-
/**
|
|
8
|
-
* Boradcasting all the database and library to all the websocket nodes
|
|
9
|
-
* @param p Target project
|
|
10
|
-
*/
|
|
11
4
|
SyncDatabase: (p: Project) => void;
|
|
12
5
|
}
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { DataType } from "../../interface";
|
|
7
2
|
import { ExecuteManager_Feedback } from "./feedback";
|
|
8
3
|
import { Util_Parser } from './util_parser';
|
|
9
|
-
/**
|
|
10
|
-
* The execute runner
|
|
11
|
-
*/
|
|
12
4
|
export class ExecuteManager_Runner extends ExecuteManager_Feedback {
|
|
13
|
-
/**
|
|
14
|
-
* Boradcasting all the database and library to all the websocket nodes
|
|
15
|
-
* @param p Target project
|
|
16
|
-
*/
|
|
17
5
|
SyncDatabase = (p) => {
|
|
18
|
-
// Get the clone para from it
|
|
19
6
|
this.localPara = JSON.parse(JSON.stringify(p.database));
|
|
20
7
|
this.messager_log("[Execute] Sync Database !");
|
|
21
8
|
this.messager_log("[Execute] Generate local database object");
|
|
22
|
-
// Then phrase the expression to value
|
|
23
9
|
for (let i = 0; i < this.localPara.containers.length; i++) {
|
|
24
10
|
if (this.localPara.containers[i].type == DataType.Expression && this.localPara.containers[i].meta != undefined) {
|
|
25
11
|
const text = `%{${this.localPara.containers[i].meta}}%`;
|
|
@@ -27,7 +13,6 @@ export class ExecuteManager_Runner extends ExecuteManager_Feedback {
|
|
|
27
13
|
this.localPara.containers[i].value = e.replacePara(text);
|
|
28
14
|
}
|
|
29
15
|
}
|
|
30
|
-
// Boradcasting
|
|
31
16
|
this.sync_local_para(this.localPara);
|
|
32
17
|
};
|
|
33
18
|
}
|
|
@@ -1,55 +1,14 @@
|
|
|
1
1
|
import { KeyValue, Database, DatabaseContainer } from "../../interface";
|
|
2
|
-
/**
|
|
3
|
-
* The worker which helps parsing database variables into argument\
|
|
4
|
-
* Including expression executing
|
|
5
|
-
*/
|
|
6
2
|
export declare class Util_Parser {
|
|
7
3
|
paras: Array<KeyValue>;
|
|
8
4
|
get count(): number;
|
|
9
5
|
constructor(_paras: Array<KeyValue>);
|
|
10
6
|
clone: () => Util_Parser;
|
|
11
|
-
/**
|
|
12
|
-
* Turn database into a list of keyvalue structure\
|
|
13
|
-
* Exclude the expression datatype
|
|
14
|
-
* @param p Target database instance
|
|
15
|
-
* @returns The list of keyvalue
|
|
16
|
-
*/
|
|
17
7
|
static to_keyvalue: (p: Database) => Array<KeyValue>;
|
|
18
|
-
/**
|
|
19
|
-
* Input a object data, and deep search all of subobject\
|
|
20
|
-
* Phrasing it into keyvalue data
|
|
21
|
-
* @param obj Object
|
|
22
|
-
* @returns Array of keyvalue data
|
|
23
|
-
*/
|
|
24
8
|
private static getDeepKeys;
|
|
25
|
-
/**
|
|
26
|
-
* Database containers into keyvalue list
|
|
27
|
-
*/
|
|
28
9
|
static _to_keyvalue: (p: Array<DatabaseContainer>) => Array<KeyValue>;
|
|
29
|
-
/**
|
|
30
|
-
* Search all the string result and replace to target string\
|
|
31
|
-
* @example
|
|
32
|
-
* replaceAll("ABCBCAB", "AB", "KK") // Result: KKCBCKK
|
|
33
|
-
* @param str string data
|
|
34
|
-
* @param fi feature
|
|
35
|
-
* @param tar replace target
|
|
36
|
-
*/
|
|
37
10
|
static replaceAll: (str: string, fi: string, tar: string) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Replace a string to environment string\
|
|
40
|
-
* * Include Expression calculation
|
|
41
|
-
* * Include Env string, boolean, number replacing
|
|
42
|
-
* @param text Input text
|
|
43
|
-
* @param paras The keyvalue list
|
|
44
|
-
* @returns The result string
|
|
45
|
-
*/
|
|
46
11
|
replacePara: (text: string) => string;
|
|
47
|
-
/**
|
|
48
|
-
* Expression magic
|
|
49
|
-
* @param str Input string, the expression part of string only, not the entire sentence
|
|
50
|
-
* @param paras Keyvalue list
|
|
51
|
-
* @returns Result calculation
|
|
52
|
-
*/
|
|
53
12
|
parse: (str: string) => string;
|
|
54
13
|
private _replacePara;
|
|
55
14
|
}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { formula, init } from "expressionparser";
|
|
7
2
|
import { DataType, ENV_CHARACTER, IGNORE_CHARACTER } from "../../interface";
|
|
8
|
-
/**
|
|
9
|
-
* The worker which helps parsing database variables into argument\
|
|
10
|
-
* Including expression executing
|
|
11
|
-
*/
|
|
12
3
|
export class Util_Parser {
|
|
13
4
|
paras = [];
|
|
14
5
|
get count() {
|
|
@@ -21,23 +12,11 @@ export class Util_Parser {
|
|
|
21
12
|
const b = JSON.parse(JSON.stringify(this.paras));
|
|
22
13
|
return new Util_Parser(b);
|
|
23
14
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Turn database into a list of keyvalue structure\
|
|
26
|
-
* Exclude the expression datatype
|
|
27
|
-
* @param p Target database instance
|
|
28
|
-
* @returns The list of keyvalue
|
|
29
|
-
*/
|
|
30
15
|
static to_keyvalue = (p) => {
|
|
31
16
|
return [
|
|
32
17
|
...this._to_keyvalue(p.containers)
|
|
33
18
|
];
|
|
34
19
|
};
|
|
35
|
-
/**
|
|
36
|
-
* Input a object data, and deep search all of subobject\
|
|
37
|
-
* Phrasing it into keyvalue data
|
|
38
|
-
* @param obj Object
|
|
39
|
-
* @returns Array of keyvalue data
|
|
40
|
-
*/
|
|
41
20
|
static getDeepKeys = (obj, name) => {
|
|
42
21
|
let keys = [];
|
|
43
22
|
for (var key in obj) {
|
|
@@ -56,9 +35,6 @@ export class Util_Parser {
|
|
|
56
35
|
}
|
|
57
36
|
return keys;
|
|
58
37
|
};
|
|
59
|
-
/**
|
|
60
|
-
* Database containers into keyvalue list
|
|
61
|
-
*/
|
|
62
38
|
static _to_keyvalue = (p) => {
|
|
63
39
|
const r = [];
|
|
64
40
|
r.push(...p.filter(x => x.type == DataType.Boolean || x.type == DataType.String || x.type == DataType.Textarea || x.type == DataType.Number || x.type == DataType.Expression).map(x => { return { key: x.name, value: x.value.toString() }; }));
|
|
@@ -82,28 +58,12 @@ export class Util_Parser {
|
|
|
82
58
|
}
|
|
83
59
|
return r;
|
|
84
60
|
};
|
|
85
|
-
/**
|
|
86
|
-
* Search all the string result and replace to target string\
|
|
87
|
-
* @example
|
|
88
|
-
* replaceAll("ABCBCAB", "AB", "KK") // Result: KKCBCKK
|
|
89
|
-
* @param str string data
|
|
90
|
-
* @param fi feature
|
|
91
|
-
* @param tar replace target
|
|
92
|
-
*/
|
|
93
61
|
static replaceAll = (str, fi, tar) => {
|
|
94
62
|
let p = str;
|
|
95
63
|
while (p.includes(fi))
|
|
96
64
|
p = p.replace(fi, tar);
|
|
97
65
|
return p;
|
|
98
66
|
};
|
|
99
|
-
/**
|
|
100
|
-
* Replace a string to environment string\
|
|
101
|
-
* * Include Expression calculation
|
|
102
|
-
* * Include Env string, boolean, number replacing
|
|
103
|
-
* @param text Input text
|
|
104
|
-
* @param paras The keyvalue list
|
|
105
|
-
* @returns The result string
|
|
106
|
-
*/
|
|
107
67
|
replacePara = (text) => {
|
|
108
68
|
let buffer = '';
|
|
109
69
|
let store = '';
|
|
@@ -121,7 +81,7 @@ export class Util_Parser {
|
|
|
121
81
|
ignore = -1;
|
|
122
82
|
if (v == ENV_CHARACTER && ignore == -1) {
|
|
123
83
|
state = !state;
|
|
124
|
-
if (!state) {
|
|
84
|
+
if (!state) {
|
|
125
85
|
if (useExp) {
|
|
126
86
|
buffer += this.parse(store);
|
|
127
87
|
}
|
|
@@ -141,12 +101,6 @@ export class Util_Parser {
|
|
|
141
101
|
}
|
|
142
102
|
return buffer;
|
|
143
103
|
};
|
|
144
|
-
/**
|
|
145
|
-
* Expression magic
|
|
146
|
-
* @param str Input string, the expression part of string only, not the entire sentence
|
|
147
|
-
* @param paras Keyvalue list
|
|
148
|
-
* @returns Result calculation
|
|
149
|
-
*/
|
|
150
104
|
parse = (str) => {
|
|
151
105
|
str = str.substring(1, str.length - 1);
|
|
152
106
|
const parser = init(formula, (term) => {
|
|
@@ -1,54 +1,16 @@
|
|
|
1
1
|
import { Libraries, WebsocketPack } from "../interface";
|
|
2
2
|
import { ExecuteManager_Runner } from "./execute/runner";
|
|
3
|
-
/**
|
|
4
|
-
* Cluster server calculation worker\
|
|
5
|
-
* The most important worker in the entire application
|
|
6
|
-
*/
|
|
7
3
|
export declare class ExecuteManager extends ExecuteManager_Runner {
|
|
8
|
-
/**
|
|
9
|
-
* The update function for let this worker start each iteration
|
|
10
|
-
*/
|
|
11
4
|
Update: () => void;
|
|
12
|
-
/**
|
|
13
|
-
* Pause has been called
|
|
14
|
-
*/
|
|
15
5
|
Stop: () => void;
|
|
16
|
-
/**
|
|
17
|
-
* Register projects to worker\
|
|
18
|
-
* If failed register, the buffer will remind empty
|
|
19
|
-
* @param projects Target
|
|
20
|
-
* @returns -1: register failed, 0: successfully
|
|
21
|
-
*/
|
|
22
6
|
Register: (lib?: Libraries) => number;
|
|
23
|
-
/**
|
|
24
|
-
* This will reset the state, and emppty all the buffer
|
|
25
|
-
*/
|
|
26
7
|
Clean: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* Tell clients release lib and database data
|
|
29
|
-
*/
|
|
30
8
|
Release: () => void;
|
|
31
|
-
/**
|
|
32
|
-
* When new connection (Node) has benn connected
|
|
33
|
-
* @param source Target
|
|
34
|
-
*/
|
|
35
9
|
NewConnection: (source: WebsocketPack) => void;
|
|
36
10
|
Disconnect: (source: WebsocketPack) => void;
|
|
37
11
|
ClearState: (task_index: number) => void;
|
|
38
|
-
/**
|
|
39
|
-
* When user trying to skip project
|
|
40
|
-
* @returns The index of the project
|
|
41
|
-
* -1: Skip to finish
|
|
42
|
-
* -2: Skip failed
|
|
43
|
-
*/
|
|
44
12
|
SkipProject: () => number;
|
|
45
13
|
PreviousProject: () => number;
|
|
46
|
-
/**
|
|
47
|
-
* When user trying to skip task
|
|
48
|
-
* @returns The index of the task
|
|
49
|
-
* -1: Skip to finish
|
|
50
|
-
* -2: Skip failed
|
|
51
|
-
*/
|
|
52
14
|
SkipTask: () => number;
|
|
53
15
|
PreviousTask: () => number;
|
|
54
16
|
SkipSubTask: (v: number) => number;
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { ExecuteState } from "../interface";
|
|
7
2
|
import { Region_Project } from "./execute/region_project";
|
|
8
3
|
import { Region_Task } from "./execute/region_task";
|
|
9
4
|
import { ExecuteManager_Runner } from "./execute/runner";
|
|
10
|
-
/**
|
|
11
|
-
* Cluster server calculation worker\
|
|
12
|
-
* The most important worker in the entire application
|
|
13
|
-
*/
|
|
14
5
|
export class ExecuteManager extends ExecuteManager_Runner {
|
|
15
|
-
/**
|
|
16
|
-
* The update function for let this worker start each iteration
|
|
17
|
-
*/
|
|
18
6
|
Update = () => {
|
|
19
|
-
// Only works when state is set to running
|
|
20
7
|
if (this.state != ExecuteState.RUNNING)
|
|
21
8
|
return;
|
|
22
9
|
else if (this.runner == undefined && this.current_projects.length > 0) {
|
|
@@ -31,9 +18,6 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
31
18
|
this.runner.RUN();
|
|
32
19
|
}
|
|
33
20
|
};
|
|
34
|
-
/**
|
|
35
|
-
* Pause has been called
|
|
36
|
-
*/
|
|
37
21
|
Stop = () => {
|
|
38
22
|
this.current_nodes.forEach(x => {
|
|
39
23
|
const h = {
|
|
@@ -46,12 +30,6 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
46
30
|
this.jobstack = 0;
|
|
47
31
|
this.current_nodes.forEach(x => x.current_job = []);
|
|
48
32
|
};
|
|
49
|
-
/**
|
|
50
|
-
* Register projects to worker\
|
|
51
|
-
* If failed register, the buffer will remind empty
|
|
52
|
-
* @param projects Target
|
|
53
|
-
* @returns -1: register failed, 0: successfully
|
|
54
|
-
*/
|
|
55
33
|
Register = (lib) => {
|
|
56
34
|
this.current_projects = this.record.projects;
|
|
57
35
|
this.current_nodes = [];
|
|
@@ -94,25 +72,15 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
94
72
|
}
|
|
95
73
|
return i;
|
|
96
74
|
};
|
|
97
|
-
/**
|
|
98
|
-
* This will reset the state, and emppty all the buffer
|
|
99
|
-
*/
|
|
100
75
|
Clean = () => {
|
|
101
76
|
this.current_projects = [];
|
|
102
77
|
this.runner = undefined;
|
|
103
78
|
this.current_nodes = [];
|
|
104
79
|
this.state = ExecuteState.NONE;
|
|
105
80
|
};
|
|
106
|
-
/**
|
|
107
|
-
* Tell clients release lib and database data
|
|
108
|
-
*/
|
|
109
81
|
Release = () => {
|
|
110
82
|
this.current_nodes.forEach(x => this.release(x));
|
|
111
83
|
};
|
|
112
|
-
/**
|
|
113
|
-
* When new connection (Node) has benn connected
|
|
114
|
-
* @param source Target
|
|
115
|
-
*/
|
|
116
84
|
NewConnection = (source) => {
|
|
117
85
|
if (this.state == ExecuteState.RUNNING && this.localPara != undefined) {
|
|
118
86
|
this.sync_para(this.localPara, source);
|
|
@@ -162,24 +130,12 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
162
130
|
this.proxy?.executeSubtaskUpdate([this.current_t, target.id - 1, '', ExecuteState.NONE]);
|
|
163
131
|
}
|
|
164
132
|
};
|
|
165
|
-
/**
|
|
166
|
-
* When user trying to skip project
|
|
167
|
-
* @returns The index of the project
|
|
168
|
-
* -1: Skip to finish
|
|
169
|
-
* -2: Skip failed
|
|
170
|
-
*/
|
|
171
133
|
SkipProject = () => {
|
|
172
134
|
return this.jumpProject(true);
|
|
173
135
|
};
|
|
174
136
|
PreviousProject = () => {
|
|
175
137
|
return this.jumpProject(false);
|
|
176
138
|
};
|
|
177
|
-
/**
|
|
178
|
-
* When user trying to skip task
|
|
179
|
-
* @returns The index of the task
|
|
180
|
-
* -1: Skip to finish
|
|
181
|
-
* -2: Skip failed
|
|
182
|
-
*/
|
|
183
139
|
SkipTask = () => {
|
|
184
140
|
return this.jumpTask(true);
|
|
185
141
|
};
|
|
@@ -213,26 +169,19 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
213
169
|
return -2;
|
|
214
170
|
}
|
|
215
171
|
if (this.current_p == undefined) {
|
|
216
|
-
// Not yet start
|
|
217
172
|
return forward ? this.skipProjectFirst() : -2;
|
|
218
173
|
}
|
|
219
174
|
else {
|
|
220
|
-
// When it's in the processing stage
|
|
221
|
-
// Let's find the current processing project, and increments it's index for it
|
|
222
175
|
return this._jumpProject(forward);
|
|
223
176
|
}
|
|
224
177
|
};
|
|
225
178
|
jumpTask = (forward) => {
|
|
226
|
-
// There is no project exists
|
|
227
179
|
if (this.current_p == undefined)
|
|
228
180
|
return -2;
|
|
229
181
|
if (this.current_t == undefined) {
|
|
230
|
-
// If we are in the start
|
|
231
182
|
return forward ? this.skipTaskFirst() : this.previousTaskFirst();
|
|
232
183
|
}
|
|
233
184
|
else {
|
|
234
|
-
// When it's in the processing stage
|
|
235
|
-
// Let's find the current processing task, and increments it's index for it
|
|
236
185
|
return forward ? this.skipTask() : this.previousTask();
|
|
237
186
|
}
|
|
238
187
|
};
|
|
@@ -249,7 +198,6 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
249
198
|
this.proxy?.executeProjectFinish([this.current_p, index]);
|
|
250
199
|
const atend = forward ? index == this.current_projects.length - 1 : index == 0;
|
|
251
200
|
if (atend) {
|
|
252
|
-
// If it's last project
|
|
253
201
|
if (forward) {
|
|
254
202
|
this.runner = undefined;
|
|
255
203
|
this.state = ExecuteState.FINISH;
|
|
@@ -296,7 +244,6 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
296
244
|
previousTaskFirst = () => {
|
|
297
245
|
const index = this.current_projects.findIndex(x => x.uuid == this.current_p.uuid);
|
|
298
246
|
if (index == 0 && this.runner != undefined) {
|
|
299
|
-
// If it's first task and first project
|
|
300
247
|
this.runner.runner = undefined;
|
|
301
248
|
}
|
|
302
249
|
else {
|
|
@@ -312,7 +259,6 @@ export class ExecuteManager extends ExecuteManager_Runner {
|
|
|
312
259
|
const index = this.current_p.tasks.findIndex(x => x.uuid == this.current_t.uuid);
|
|
313
260
|
if (this.runner) {
|
|
314
261
|
if (index == this.current_p.tasks.length - 1) {
|
|
315
|
-
// If it's last task
|
|
316
262
|
this.proxy?.executeTaskFinish(this.current_t);
|
|
317
263
|
this.runner.runner = undefined;
|
|
318
264
|
this.messager_log(`[Execute] Skip task to Finish !`);
|