verteilen-core 1.4.21 → 1.4.23
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 +0 -13
- 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 +0 -35
- 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
|
@@ -2,41 +2,13 @@ import { CronJobState, ExecuteProxy, ExecuteState, Job, Libraries, Messager, Dat
|
|
|
2
2
|
import { WebsocketManager } from "../socket_manager";
|
|
3
3
|
import { Util_Parser } from './util_parser';
|
|
4
4
|
import { Region_Project } from './region_project';
|
|
5
|
-
/**
|
|
6
|
-
* The base class of task scheduler, contain some basic funcationality
|
|
7
|
-
*/
|
|
8
5
|
export declare class ExecuteManager_Base {
|
|
9
|
-
/**
|
|
10
|
-
* The task scheduler UUID
|
|
11
|
-
*/
|
|
12
6
|
uuid: string;
|
|
13
7
|
name: string;
|
|
14
|
-
/**
|
|
15
|
-
* Register record\
|
|
16
|
-
* This record holds the project data you want to process
|
|
17
|
-
*/
|
|
18
8
|
record: Record;
|
|
19
|
-
/**
|
|
20
|
-
* The list of projects you want to process\
|
|
21
|
-
* Each project UUID should be unique by now\
|
|
22
|
-
* Prevent findIndex error, When there is repeat project source
|
|
23
|
-
*/
|
|
24
9
|
current_projects: Array<Project>;
|
|
25
|
-
/**
|
|
26
|
-
* The connection nodes list
|
|
27
|
-
*/
|
|
28
10
|
current_nodes: Array<WebsocketPack>;
|
|
29
|
-
/**
|
|
30
|
-
* * NONE: Not yet start
|
|
31
|
-
* * RUNNING: In the processing stage
|
|
32
|
-
* * FINISH: Everything is finish processing
|
|
33
|
-
*/
|
|
34
11
|
state: ExecuteState;
|
|
35
|
-
/**
|
|
36
|
-
* * NONE: Not yet start
|
|
37
|
-
* * RUNNING: In the processing stage
|
|
38
|
-
* * FINISH: Everything is finish processing
|
|
39
|
-
*/
|
|
40
12
|
t_state: ExecuteState;
|
|
41
13
|
jobstack: number;
|
|
42
14
|
first: boolean;
|
|
@@ -47,97 +19,29 @@ export declare class ExecuteManager_Base {
|
|
|
47
19
|
messager_log: Messager;
|
|
48
20
|
runner: Region_Project | undefined;
|
|
49
21
|
constructor(_name: string, _websocket_manager: WebsocketManager, _messager_log: Messager, _record: Record);
|
|
50
|
-
/**
|
|
51
|
-
* Current select project\
|
|
52
|
-
* If it's undefined, it means:
|
|
53
|
-
* * It's finish the current project
|
|
54
|
-
* * It has not start processing yet
|
|
55
|
-
*/
|
|
56
22
|
get current_p(): Project | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* Current select task\
|
|
59
|
-
* If it's undefined, it means:
|
|
60
|
-
* * It's finish the current task
|
|
61
|
-
* * It has not start processing yet
|
|
62
|
-
*/
|
|
63
23
|
get current_t(): Task | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Current execute task use multithread setting
|
|
66
|
-
*/
|
|
67
24
|
get current_multithread(): number;
|
|
68
25
|
get current_task_count(): number;
|
|
69
|
-
/**
|
|
70
|
-
* Cron job type execute record
|
|
71
|
-
*/
|
|
72
26
|
get current_cron(): Array<CronJobState>;
|
|
73
|
-
/**
|
|
74
|
-
* Single job type execute record
|
|
75
|
-
*/
|
|
76
27
|
get current_job(): Array<WorkState>;
|
|
77
|
-
/**
|
|
78
|
-
* This will let nodes update the database and lib
|
|
79
|
-
* @param target
|
|
80
|
-
*/
|
|
81
28
|
protected sync_local_para: (target: Database) => void;
|
|
82
29
|
protected sync_para: (target: Database, source: WebsocketPack) => void;
|
|
83
30
|
protected release: (source: WebsocketPack) => void;
|
|
84
|
-
/**
|
|
85
|
-
* Check all the cronjob is finish or not
|
|
86
|
-
*/
|
|
87
31
|
protected check_all_cron_end: () => boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Check input cronjob is finish or not
|
|
90
|
-
* @param cron target cronjob instance
|
|
91
|
-
*/
|
|
92
32
|
protected check_cron_end: (cron: CronJobState) => boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Check current single is finish or not
|
|
95
|
-
*/
|
|
96
33
|
protected check_single_end: () => boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Project format checking
|
|
99
|
-
* @param projects
|
|
100
|
-
* @returns
|
|
101
|
-
*/
|
|
102
34
|
protected validation: (projects: Array<Project>) => boolean;
|
|
103
35
|
protected filter_lib: (projects: Array<Project>, lib: Libraries) => Libraries;
|
|
104
|
-
/**
|
|
105
|
-
* Get the multi-core setting\
|
|
106
|
-
* Find in the database setting
|
|
107
|
-
* @param key The multi-core-key
|
|
108
|
-
* @returns
|
|
109
|
-
*/
|
|
110
36
|
protected get_task_multi_count: (t: Task) => number;
|
|
111
|
-
/**
|
|
112
|
-
* Get the task's cronjob count
|
|
113
|
-
*/
|
|
114
37
|
get_task_state_count(t: Task): number;
|
|
115
|
-
/**
|
|
116
|
-
* Find the number in the database, this include the expression phrasing
|
|
117
|
-
* @param key The name key
|
|
118
|
-
* @param p Project instance
|
|
119
|
-
* @returns The value, if key cannot be found, it will return -1
|
|
120
|
-
*/
|
|
121
38
|
protected get_number(key: string): number;
|
|
122
39
|
static get_number_global(key: string, localPara: Database | undefined): number;
|
|
123
|
-
/**
|
|
124
|
-
* Remove dups item in the list
|
|
125
|
-
* @param arr
|
|
126
|
-
* @returns
|
|
127
|
-
*/
|
|
128
40
|
protected removeDups: (arr: any[]) => any[];
|
|
129
|
-
/**
|
|
130
|
-
* Filter out the idle and connection open nodes
|
|
131
|
-
* @returns All idle and open connection nodes
|
|
132
|
-
*/
|
|
133
41
|
protected get_idle: () => Array<WebsocketPack>;
|
|
134
|
-
/**
|
|
135
|
-
* Filter out the connection open nodes
|
|
136
|
-
* @returns All open connection nodes
|
|
137
|
-
*/
|
|
138
42
|
protected get_idle_open: () => Array<WebsocketPack>;
|
|
139
|
-
protected check_socket_state: (target: WebsocketPack) =>
|
|
43
|
+
protected check_socket_state: (target: WebsocketPack) => ExecuteState.NONE | ExecuteState.RUNNING;
|
|
140
44
|
static string_args_transform: (task: Task, job: Job, messager_log: Messager, localPara: Database, n: number) => void;
|
|
141
45
|
static property_update: (task: Task, e: Util_Parser) => Util_Parser;
|
|
142
|
-
static database_update: (localPara: Database, n?: number) =>
|
|
46
|
+
static database_update: (localPara: Database, n?: number) => Util_Parser;
|
|
143
47
|
}
|
|
@@ -1,46 +1,13 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { v6 as uuid6 } from 'uuid';
|
|
7
2
|
import { DataType, ExecuteState, JobCategory, JobType, JobType2 } from "../../interface";
|
|
8
3
|
import { Util_Parser } from './util_parser';
|
|
9
|
-
/**
|
|
10
|
-
* The base class of task scheduler, contain some basic funcationality
|
|
11
|
-
*/
|
|
12
4
|
export class ExecuteManager_Base {
|
|
13
|
-
/**
|
|
14
|
-
* The task scheduler UUID
|
|
15
|
-
*/
|
|
16
5
|
uuid;
|
|
17
6
|
name;
|
|
18
|
-
/**
|
|
19
|
-
* Register record\
|
|
20
|
-
* This record holds the project data you want to process
|
|
21
|
-
*/
|
|
22
7
|
record;
|
|
23
|
-
/**
|
|
24
|
-
* The list of projects you want to process\
|
|
25
|
-
* Each project UUID should be unique by now\
|
|
26
|
-
* Prevent findIndex error, When there is repeat project source
|
|
27
|
-
*/
|
|
28
8
|
current_projects = [];
|
|
29
|
-
/**
|
|
30
|
-
* The connection nodes list
|
|
31
|
-
*/
|
|
32
9
|
current_nodes = [];
|
|
33
|
-
/**
|
|
34
|
-
* * NONE: Not yet start
|
|
35
|
-
* * RUNNING: In the processing stage
|
|
36
|
-
* * FINISH: Everything is finish processing
|
|
37
|
-
*/
|
|
38
10
|
state = ExecuteState.NONE;
|
|
39
|
-
/**
|
|
40
|
-
* * NONE: Not yet start
|
|
41
|
-
* * RUNNING: In the processing stage
|
|
42
|
-
* * FINISH: Everything is finish processing
|
|
43
|
-
*/
|
|
44
11
|
t_state = ExecuteState.NONE;
|
|
45
12
|
jobstack = 0;
|
|
46
13
|
first = false;
|
|
@@ -57,54 +24,28 @@ export class ExecuteManager_Base {
|
|
|
57
24
|
this.websocket_manager = _websocket_manager;
|
|
58
25
|
this.messager_log = _messager_log;
|
|
59
26
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Current select project\
|
|
62
|
-
* If it's undefined, it means:
|
|
63
|
-
* * It's finish the current project
|
|
64
|
-
* * It has not start processing yet
|
|
65
|
-
*/
|
|
66
27
|
get current_p() {
|
|
67
28
|
return this.runner?.project;
|
|
68
29
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Current select task\
|
|
71
|
-
* If it's undefined, it means:
|
|
72
|
-
* * It's finish the current task
|
|
73
|
-
* * It has not start processing yet
|
|
74
|
-
*/
|
|
75
30
|
get current_t() {
|
|
76
31
|
return this.runner?.runner?.task;
|
|
77
32
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Current execute task use multithread setting
|
|
80
|
-
*/
|
|
81
33
|
get current_multithread() {
|
|
82
34
|
return this.runner?.runner?.multithread ?? 1;
|
|
83
35
|
}
|
|
84
36
|
get current_task_count() {
|
|
85
37
|
return this.runner?.runner?.task_count ?? 0;
|
|
86
38
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Cron job type execute record
|
|
89
|
-
*/
|
|
90
39
|
get current_cron() {
|
|
91
40
|
return this.runner?.runner?.cron ?? [];
|
|
92
41
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Single job type execute record
|
|
95
|
-
*/
|
|
96
42
|
get current_job() {
|
|
97
43
|
return this.runner?.runner?.job ?? [];
|
|
98
44
|
}
|
|
99
|
-
/**
|
|
100
|
-
* This will let nodes update the database and lib
|
|
101
|
-
* @param target
|
|
102
|
-
*/
|
|
103
45
|
sync_local_para = (target) => {
|
|
104
46
|
this.current_nodes.forEach(x => this.sync_para(target, x));
|
|
105
47
|
this.proxy?.updateDatabase(target);
|
|
106
48
|
};
|
|
107
|
-
//#region Helper
|
|
108
49
|
sync_para = (target, source) => {
|
|
109
50
|
const h = {
|
|
110
51
|
name: 'set_database',
|
|
@@ -127,35 +68,18 @@ export class ExecuteManager_Base {
|
|
|
127
68
|
};
|
|
128
69
|
source.websocket.send(JSON.stringify(h));
|
|
129
70
|
};
|
|
130
|
-
/**
|
|
131
|
-
* Check all the cronjob is finish or not
|
|
132
|
-
*/
|
|
133
71
|
check_all_cron_end = () => {
|
|
134
72
|
return this.current_cron.filter(x => !this.check_cron_end(x)).length == 0;
|
|
135
73
|
};
|
|
136
|
-
/**
|
|
137
|
-
* Check input cronjob is finish or not
|
|
138
|
-
* @param cron target cronjob instance
|
|
139
|
-
*/
|
|
140
74
|
check_cron_end = (cron) => {
|
|
141
75
|
return cron.work.filter(x => x.state == ExecuteState.RUNNING || x.state == ExecuteState.NONE).length == 0;
|
|
142
76
|
};
|
|
143
|
-
/**
|
|
144
|
-
* Check current single is finish or not
|
|
145
|
-
*/
|
|
146
77
|
check_single_end = () => {
|
|
147
78
|
if (this.current_t == undefined)
|
|
148
79
|
return false;
|
|
149
80
|
return this.current_job.length == this.current_t.jobs.length &&
|
|
150
81
|
this.current_job.filter(y => y.state == ExecuteState.RUNNING || y.state == ExecuteState.NONE).length == 0;
|
|
151
82
|
};
|
|
152
|
-
//#endregion
|
|
153
|
-
//#region Utility
|
|
154
|
-
/**
|
|
155
|
-
* Project format checking
|
|
156
|
-
* @param projects
|
|
157
|
-
* @returns
|
|
158
|
-
*/
|
|
159
83
|
validation = (projects) => {
|
|
160
84
|
if (this.websocket_manager.targets.length == 0) {
|
|
161
85
|
this.messager_log(`[Execute State] The execute node does not exists`);
|
|
@@ -213,19 +137,10 @@ export class ExecuteManager_Base {
|
|
|
213
137
|
});
|
|
214
138
|
return JSON.parse(JSON.stringify(r));
|
|
215
139
|
};
|
|
216
|
-
/**
|
|
217
|
-
* Get the multi-core setting\
|
|
218
|
-
* Find in the database setting
|
|
219
|
-
* @param key The multi-core-key
|
|
220
|
-
* @returns
|
|
221
|
-
*/
|
|
222
140
|
get_task_multi_count = (t) => {
|
|
223
141
|
const r = this.get_number(t.multiKey);
|
|
224
142
|
return r == -1 ? 1 : r;
|
|
225
143
|
};
|
|
226
|
-
/**
|
|
227
|
-
* Get the task's cronjob count
|
|
228
|
-
*/
|
|
229
144
|
get_task_state_count(t) {
|
|
230
145
|
if (t.setupjob)
|
|
231
146
|
return this.current_nodes.length;
|
|
@@ -234,12 +149,6 @@ export class ExecuteManager_Base {
|
|
|
234
149
|
else
|
|
235
150
|
return 1;
|
|
236
151
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Find the number in the database, this include the expression phrasing
|
|
239
|
-
* @param key The name key
|
|
240
|
-
* @param p Project instance
|
|
241
|
-
* @returns The value, if key cannot be found, it will return -1
|
|
242
|
-
*/
|
|
243
152
|
get_number(key) {
|
|
244
153
|
return ExecuteManager_Base.get_number_global(key, this.localPara);
|
|
245
154
|
}
|
|
@@ -248,25 +157,12 @@ export class ExecuteManager_Base {
|
|
|
248
157
|
const a = e.replacePara(`%{${key}}%`);
|
|
249
158
|
return Number(a);
|
|
250
159
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Remove dups item in the list
|
|
253
|
-
* @param arr
|
|
254
|
-
* @returns
|
|
255
|
-
*/
|
|
256
160
|
removeDups = (arr) => {
|
|
257
161
|
return [...new Set(arr)];
|
|
258
162
|
};
|
|
259
|
-
/**
|
|
260
|
-
* Filter out the idle and connection open nodes
|
|
261
|
-
* @returns All idle and open connection nodes
|
|
262
|
-
*/
|
|
263
163
|
get_idle = () => {
|
|
264
164
|
return this.current_nodes.filter(x => this.check_socket_state(x) != ExecuteState.RUNNING && x.websocket.readyState == 1);
|
|
265
165
|
};
|
|
266
|
-
/**
|
|
267
|
-
* Filter out the connection open nodes
|
|
268
|
-
* @returns All open connection nodes
|
|
269
|
-
*/
|
|
270
166
|
get_idle_open = () => {
|
|
271
167
|
return this.current_nodes.filter(x => x.websocket.readyState == 1);
|
|
272
168
|
};
|
|
@@ -283,7 +179,6 @@ export class ExecuteManager_Base {
|
|
|
283
179
|
if (job.category == JobCategory.Execution && job.type == JobType.CREATE_FILE && i == 1)
|
|
284
180
|
continue;
|
|
285
181
|
job.string_args[i] = e.replacePara(job.string_args[i]);
|
|
286
|
-
//messager_log(`String replace: "${b}" -> "${job.string_args[i]}"`)
|
|
287
182
|
}
|
|
288
183
|
};
|
|
289
184
|
static property_update = (task, e) => {
|
|
@@ -1,46 +1,12 @@
|
|
|
1
1
|
import { BusAnalysis } from "../../interface";
|
|
2
2
|
import { ExecuteManager_Base } from "./base";
|
|
3
|
-
/**
|
|
4
|
-
* Recevied the information from the nodes\
|
|
5
|
-
* This include job feedback and error feedback and pong and other stuff
|
|
6
|
-
*/
|
|
7
3
|
export declare class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
8
|
-
/**
|
|
9
|
-
* The analysis method for decoding the information where the nodes is sending
|
|
10
|
-
* @param d Package info
|
|
11
|
-
*/
|
|
12
4
|
Analysis: (d: BusAnalysis) => void;
|
|
13
|
-
/**
|
|
14
|
-
* Print information, sended by the node worker
|
|
15
|
-
* @param data feedback data, any type
|
|
16
|
-
* @param source The node target
|
|
17
|
-
*/
|
|
18
5
|
private feedback_message;
|
|
19
|
-
/**
|
|
20
|
-
* The job has been finish executing, sended by the node worker
|
|
21
|
-
* @param data feedback data
|
|
22
|
-
* @param source The node target
|
|
23
|
-
*/
|
|
24
6
|
private feedback_job;
|
|
25
|
-
/**
|
|
26
|
-
* When one of the node decide to change the database of string value
|
|
27
|
-
* @param data The assigner
|
|
28
|
-
*/
|
|
29
7
|
private feedback_string;
|
|
30
|
-
/**
|
|
31
|
-
* When one of the node decide to change the database of number value
|
|
32
|
-
* @param data The assigner
|
|
33
|
-
*/
|
|
34
8
|
private feedback_number;
|
|
35
|
-
/**
|
|
36
|
-
* When one of the node decide to change the database of object value
|
|
37
|
-
* @param data The assigner
|
|
38
|
-
*/
|
|
39
9
|
private feedback_object;
|
|
40
|
-
/**
|
|
41
|
-
* When one of the node decide to change the database of boolean value
|
|
42
|
-
* @param data The assigner
|
|
43
|
-
*/
|
|
44
10
|
private feedback_boolean;
|
|
45
11
|
private GetCronAndWork;
|
|
46
12
|
}
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { DataType, ExecuteState } from "../../interface";
|
|
7
2
|
import { ExecuteManager_Base } from "./base";
|
|
8
|
-
/**
|
|
9
|
-
* Recevied the information from the nodes\
|
|
10
|
-
* This include job feedback and error feedback and pong and other stuff
|
|
11
|
-
*/
|
|
12
3
|
export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
13
|
-
/**
|
|
14
|
-
* The analysis method for decoding the information where the nodes is sending
|
|
15
|
-
* @param d Package info
|
|
16
|
-
*/
|
|
17
4
|
Analysis = (d) => {
|
|
18
5
|
const targetn = this.current_nodes.find(x => x.uuid == d.c?.uuid);
|
|
19
6
|
if (targetn == undefined) {
|
|
@@ -36,11 +23,6 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
36
23
|
this.messager_log(`[Source Data Analysis] Decode failed, Unknowed header, name: ${d.name}, meta: ${d.h.meta}`);
|
|
37
24
|
}
|
|
38
25
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Print information, sended by the node worker
|
|
41
|
-
* @param data feedback data, any type
|
|
42
|
-
* @param source The node target
|
|
43
|
-
*/
|
|
44
26
|
feedback_message = (data, source, meta) => {
|
|
45
27
|
if (source == undefined) {
|
|
46
28
|
this.messager_log("[Server Feedback Warn] source is none");
|
|
@@ -70,11 +52,6 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
70
52
|
};
|
|
71
53
|
this.proxy?.feedbackMessage(d);
|
|
72
54
|
};
|
|
73
|
-
/**
|
|
74
|
-
* The job has been finish executing, sended by the node worker
|
|
75
|
-
* @param data feedback data
|
|
76
|
-
* @param source The node target
|
|
77
|
-
*/
|
|
78
55
|
feedback_job = (data, source) => {
|
|
79
56
|
if (source == undefined)
|
|
80
57
|
return;
|
|
@@ -86,7 +63,6 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
86
63
|
return;
|
|
87
64
|
}
|
|
88
65
|
this.messager_log(`[Execute] Job Feedback: ${data.job_uuid} ${data.runtime_uuid} ${data.message} ${data.meta}`);
|
|
89
|
-
// If it's a single type work
|
|
90
66
|
if (this.current_job.length > 0) {
|
|
91
67
|
const work = this.current_job.find(x => x.uuid == source.uuid && x.state == ExecuteState.RUNNING);
|
|
92
68
|
if (work == undefined) {
|
|
@@ -101,7 +77,6 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
101
77
|
this.messager_log(`[Execute] Subtask finish: ${this.current_t.uuid}`);
|
|
102
78
|
}
|
|
103
79
|
}
|
|
104
|
-
// If it's a cronjob type work
|
|
105
80
|
else if (this.current_cron.length > 0) {
|
|
106
81
|
const r = this.GetCronAndWork(data.runtime_uuid, source);
|
|
107
82
|
const cron = r[0];
|
|
@@ -120,7 +95,6 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
120
95
|
cron.uuid = '';
|
|
121
96
|
}
|
|
122
97
|
}
|
|
123
|
-
// Reset the state of the node
|
|
124
98
|
const index = source.current_job.findIndex(x => x == data.runtime_uuid);
|
|
125
99
|
if (index == -1) {
|
|
126
100
|
this.messager_log(`[Execute] Cannot find runtime uuid: ${data.runtime_uuid} in websocket pack source: ${source.uuid}`);
|
|
@@ -131,10 +105,6 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
131
105
|
data.node_uuid = source.uuid;
|
|
132
106
|
this.proxy?.feedbackMessage(data);
|
|
133
107
|
};
|
|
134
|
-
/**
|
|
135
|
-
* When one of the node decide to change the database of string value
|
|
136
|
-
* @param data The assigner
|
|
137
|
-
*/
|
|
138
108
|
feedback_string = (data) => {
|
|
139
109
|
if (this.current_p == undefined)
|
|
140
110
|
return;
|
|
@@ -144,15 +114,10 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
144
114
|
else
|
|
145
115
|
this.localPara.containers.push({ name: data.key, value: data.value, type: DataType.String, hidden: true, runtimeOnly: true });
|
|
146
116
|
this.messager_log(`[String Feedback] ${data.key} = ${data.value}`);
|
|
147
|
-
// Sync to other
|
|
148
117
|
const d = { name: 'set_database', data: this.localPara };
|
|
149
118
|
this.current_nodes.forEach(x => x.websocket.send(JSON.stringify(d)));
|
|
150
119
|
this.proxy?.updateDatabase(this.localPara);
|
|
151
120
|
};
|
|
152
|
-
/**
|
|
153
|
-
* When one of the node decide to change the database of number value
|
|
154
|
-
* @param data The assigner
|
|
155
|
-
*/
|
|
156
121
|
feedback_number = (data) => {
|
|
157
122
|
if (this.current_p == undefined)
|
|
158
123
|
return;
|
|
@@ -162,15 +127,10 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
162
127
|
else
|
|
163
128
|
this.localPara.containers.push({ name: data.key, value: data.value, type: DataType.Number, hidden: true, runtimeOnly: true });
|
|
164
129
|
this.messager_log(`[Number Feedback] ${data.key} = ${data.value}`);
|
|
165
|
-
// Sync to other
|
|
166
130
|
const d = { name: 'set_database', data: this.localPara };
|
|
167
131
|
this.current_nodes.forEach(x => x.websocket.send(JSON.stringify(d)));
|
|
168
132
|
this.proxy?.updateDatabase(this.localPara);
|
|
169
133
|
};
|
|
170
|
-
/**
|
|
171
|
-
* When one of the node decide to change the database of object value
|
|
172
|
-
* @param data The assigner
|
|
173
|
-
*/
|
|
174
134
|
feedback_object = (data) => {
|
|
175
135
|
if (this.current_p == undefined)
|
|
176
136
|
return;
|
|
@@ -180,15 +140,10 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
180
140
|
else
|
|
181
141
|
this.localPara.containers.push({ name: data.key, value: data.value, type: DataType.Object, hidden: true, runtimeOnly: true });
|
|
182
142
|
this.messager_log(`[Object Feedback] ${data.key}`);
|
|
183
|
-
// Sync to other
|
|
184
143
|
const d = { name: 'set_database', data: this.localPara };
|
|
185
144
|
this.current_nodes.forEach(x => x.websocket.send(JSON.stringify(d)));
|
|
186
145
|
this.proxy?.updateDatabase(this.localPara);
|
|
187
146
|
};
|
|
188
|
-
/**
|
|
189
|
-
* When one of the node decide to change the database of boolean value
|
|
190
|
-
* @param data The assigner
|
|
191
|
-
*/
|
|
192
147
|
feedback_boolean = (data) => {
|
|
193
148
|
if (this.current_p == undefined)
|
|
194
149
|
return;
|
|
@@ -198,7 +153,6 @@ export class ExecuteManager_Feedback extends ExecuteManager_Base {
|
|
|
198
153
|
else
|
|
199
154
|
this.localPara.containers.push({ name: data.key, value: data.value, type: DataType.Boolean, hidden: true, runtimeOnly: true });
|
|
200
155
|
this.messager_log(`[Boolean Feedback] ${data.key} = ${data.value}`);
|
|
201
|
-
// Sync to other
|
|
202
156
|
const d = { name: 'set_database', data: this.localPara };
|
|
203
157
|
this.current_nodes.forEach(x => x.websocket.send(JSON.stringify(d)));
|
|
204
158
|
this.proxy?.updateDatabase(this.localPara);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { DataType, JobCategory, JobType } from "../../interface";
|
|
7
2
|
import { Util_Parser } from "./util_parser";
|
|
8
3
|
export class Region_Job {
|
|
@@ -41,7 +36,6 @@ export class Region_Job {
|
|
|
41
36
|
if (job.category == JobCategory.Execution && job.type == JobType.CREATE_FILE && i == 1)
|
|
42
37
|
continue;
|
|
43
38
|
job.string_args[i] = e.replacePara(job.string_args[i]);
|
|
44
|
-
//messager_log(`String replace: "${b}" -> "${job.string_args[i]}"`)
|
|
45
39
|
}
|
|
46
40
|
};
|
|
47
41
|
property_update = (task, e) => {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// ========================
|
|
2
|
-
//
|
|
3
|
-
// Share Codebase
|
|
4
|
-
//
|
|
5
|
-
// ========================
|
|
6
1
|
import { ExecuteState } from "../../interface";
|
|
7
2
|
import { Region_Task } from "./region_task";
|
|
8
3
|
export class Region_Project {
|
|
@@ -15,7 +10,6 @@ export class Region_Project {
|
|
|
15
10
|
}
|
|
16
11
|
RUN = () => {
|
|
17
12
|
if (this.runner == undefined && this.project.tasks.length > 0 && this.target.t_state != ExecuteState.FINISH) {
|
|
18
|
-
// When we are just start it, the project run
|
|
19
13
|
this.runner = new Region_Task(this.target, this.project.tasks[0]);
|
|
20
14
|
this.target.messager_log(`[Execute] Task Start ${this.runner.task.uuid}`);
|
|
21
15
|
this.target.messager_log(`[Execute] Task cron state: ${this.runner.task.cronjob}`);
|
|
@@ -23,22 +17,12 @@ export class Region_Project {
|
|
|
23
17
|
else if (this.project.tasks.length == 0) {
|
|
24
18
|
this.runner = undefined;
|
|
25
19
|
}
|
|
26
|
-
/**
|
|
27
|
-
* In any case, if the task has value, this mean we are in the task stage, so, just ignore everything.\
|
|
28
|
-
* Go for the task stage
|
|
29
|
-
*/
|
|
30
20
|
if (this.runner != undefined) {
|
|
31
21
|
this.runner.RUN();
|
|
32
22
|
}
|
|
33
23
|
else {
|
|
34
|
-
/**
|
|
35
|
-
* If we are here, task is none by this case. This can only be
|
|
36
|
-
* * A: We are finish all the tasks, And there is no next project, So just mark as finish for entire process
|
|
37
|
-
* * B: We are finish all the tasks, Go to next project
|
|
38
|
-
*/
|
|
39
24
|
const index = this.target.current_projects.findIndex(x => x.uuid == this.project.uuid);
|
|
40
25
|
if (index < this.target.current_projects.length - 1) {
|
|
41
|
-
// * Case A: Next project
|
|
42
26
|
this.target.messager_log(`[Execute] Project Finish ${this.project.uuid}`);
|
|
43
27
|
this.target.proxy?.executeProjectFinish([this.project, index]);
|
|
44
28
|
this.target.runner = new Region_Project(this.target, this.target.current_projects[index + 1]);
|
|
@@ -46,7 +30,6 @@ export class Region_Project {
|
|
|
46
30
|
this.target.t_state = ExecuteState.NONE;
|
|
47
31
|
}
|
|
48
32
|
else {
|
|
49
|
-
// * Case B: Finish entire thing
|
|
50
33
|
this.target.messager_log(`[Execute] Project Finish ${this.project.uuid}`);
|
|
51
34
|
this.target.proxy?.executeProjectFinish([this.project, index]);
|
|
52
35
|
this.target.runner = undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CronJobState, Database, Project, Task, WebsocketPack, WorkState } from "../../interface";
|
|
1
|
+
import { CronJobState, Database, ExecuteState, Project, Task, WebsocketPack, WorkState } from "../../interface";
|
|
2
2
|
import { ExecuteManager } from "../execute_manager";
|
|
3
3
|
import { Region_Job } from "./region_job";
|
|
4
4
|
import { Region_Project } from "./region_project";
|
|
5
5
|
import { Region_Subtask } from "./region_subtask";
|
|
6
|
+
import { Util_Parser } from "./util_parser";
|
|
6
7
|
export declare class Region_Task {
|
|
7
8
|
target: ExecuteManager;
|
|
8
9
|
task: Task;
|
|
@@ -16,59 +17,22 @@ export declare class Region_Task {
|
|
|
16
17
|
get project(): Project;
|
|
17
18
|
get parent(): Region_Project;
|
|
18
19
|
RUN: () => void;
|
|
19
|
-
/**
|
|
20
|
-
* It will spawn amounts of cronjob and send the tasks for assigned node to execute them one by one
|
|
21
|
-
* @param taskCount Should be equal to cronjob result
|
|
22
|
-
* @returns Is finish executing
|
|
23
|
-
*/
|
|
24
20
|
ExecuteTask_Cronjob(project: Project, task: Task, taskCount: number): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* There will be no CronTask be called, it will go straight to the Execute job section
|
|
27
|
-
* @param taskCount Must be 1
|
|
28
|
-
* @returns Is finish executing
|
|
29
|
-
*/
|
|
30
21
|
ExecuteTask_Single(project: Project, task: Task, taskCount: number): boolean;
|
|
31
22
|
ExecuteTask_Setup(project: Project, task: Task, taskCount: number): boolean;
|
|
32
23
|
ExecuteTask_AllFinish(project: Project, task: Task): void;
|
|
33
24
|
Init_CronContainer: (taskCount: number) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Filter out the idle and connection open nodes
|
|
36
|
-
* @returns All idle and open connection nodes
|
|
37
|
-
*/
|
|
38
25
|
get_idle: () => Array<WebsocketPack>;
|
|
39
|
-
check_socket_state: (target: WebsocketPack) =>
|
|
40
|
-
/**
|
|
41
|
-
* This will let nodes update the database and lib
|
|
42
|
-
* @param target
|
|
43
|
-
*/
|
|
26
|
+
check_socket_state: (target: WebsocketPack) => ExecuteState.NONE | ExecuteState.RUNNING;
|
|
44
27
|
sync_local_para: (target: Database) => void;
|
|
45
28
|
sync_para: (target: Database, source: WebsocketPack) => void;
|
|
46
29
|
get_idle_open: () => Array<WebsocketPack>;
|
|
47
|
-
/**
|
|
48
|
-
* Check all the cronjob is finish or not
|
|
49
|
-
*/
|
|
50
30
|
check_all_cron_end: () => boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Check input cronjob is finish or not
|
|
53
|
-
* @param cron target cronjob instance
|
|
54
|
-
*/
|
|
55
31
|
check_cron_end: (cron: CronJobState) => boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Check current single is finish or not
|
|
58
|
-
*/
|
|
59
32
|
check_single_end: () => boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Get the multi-core setting\
|
|
62
|
-
* Find in the database setting
|
|
63
|
-
* @param key The multi-core-key
|
|
64
|
-
* @returns
|
|
65
|
-
*/
|
|
66
33
|
get_task_multi_count: (t: Task) => number;
|
|
67
|
-
|
|
68
|
-
* Get the task's cronjob count
|
|
69
|
-
*/
|
|
70
|
-
get_task_state_count(t: Task): any;
|
|
34
|
+
get_task_state_count(t: Task): number;
|
|
71
35
|
get_number(key: string): number;
|
|
72
36
|
get_number_global(key: string, localPara: Database | undefined): number;
|
|
73
|
-
database_update: (localPara: Database, n?: number) =>
|
|
37
|
+
database_update: (localPara: Database, n?: number) => Util_Parser;
|
|
74
38
|
}
|