verteilen-core 1.2.4 → 1.2.6
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/index.d.ts +3 -0
- package/dist/jest.config.d.ts +2 -0
- package/dist/src/client/analysis.d.ts +35 -0
- package/dist/src/client/analysis.js +318 -319
- package/dist/src/client/client.d.ts +25 -0
- package/dist/src/client/client.js +162 -168
- package/dist/src/client/cluster.d.ts +1 -0
- package/dist/src/client/cluster.js +1 -2
- package/dist/src/client/database.d.ts +13 -0
- package/dist/src/client/database.js +28 -27
- package/dist/src/client/execute.d.ts +24 -0
- package/dist/src/client/execute.js +61 -51
- package/dist/src/client/http.d.ts +7 -0
- package/dist/src/client/http.js +29 -26
- package/dist/src/client/javascript.d.ts +47 -0
- package/dist/src/client/javascript.js +110 -136
- package/dist/src/client/job_database.d.ts +10 -0
- package/dist/src/client/job_database.js +27 -29
- package/dist/src/client/job_execute.d.ts +20 -0
- package/dist/src/client/job_execute.js +148 -146
- package/dist/src/client/os.d.ts +29 -0
- package/dist/src/client/os.js +131 -136
- package/dist/src/client/resource.d.ts +7 -0
- package/dist/src/client/resource.js +93 -104
- package/dist/src/client/shell.d.ts +16 -0
- package/dist/src/client/shell.js +102 -98
- package/dist/src/computed.d.ts +13 -0
- package/dist/src/interface/base.d.ts +70 -0
- package/dist/src/interface/bus.d.ts +90 -0
- package/dist/src/interface/enum.d.ts +143 -0
- package/dist/src/interface/execute.d.ts +20 -0
- package/dist/src/interface/record.d.ts +93 -0
- package/dist/src/interface/server.d.ts +76 -0
- package/dist/src/interface/struct.d.ts +182 -0
- package/dist/src/interface/table.d.ts +20 -0
- package/dist/src/interface/ui.d.ts +29 -0
- package/dist/src/interface.d.ts +29 -0
- package/dist/src/plugins/i18n.d.ts +1666 -0
- package/dist/src/script/console_manager.d.ts +18 -0
- package/dist/src/script/console_manager.js +97 -91
- package/dist/src/script/console_server_manager.d.ts +13 -0
- package/dist/src/script/console_server_manager.js +29 -26
- package/dist/src/script/execute/base.d.ts +45 -0
- package/dist/src/script/execute/base.js +165 -162
- package/dist/src/script/execute/feedback.d.ts +12 -0
- package/dist/src/script/execute/feedback.js +162 -171
- package/dist/src/script/execute/interface.d.ts +8 -0
- package/dist/src/script/execute/region_job.d.ts +5 -0
- package/dist/src/script/execute/region_job.js +1 -0
- package/dist/src/script/execute/region_project.d.ts +10 -0
- package/dist/src/script/execute/region_project.js +4 -0
- package/dist/src/script/execute/region_subtask.d.ts +5 -0
- package/dist/src/script/execute/region_subtask.js +1 -0
- package/dist/src/script/execute/region_task.d.ts +10 -0
- package/dist/src/script/execute/region_task.js +4 -0
- package/dist/src/script/execute/runner.d.ts +14 -0
- package/dist/src/script/execute/runner.js +129 -139
- package/dist/src/script/execute/util_parser.d.ts +14 -0
- package/dist/src/script/execute/util_parser.js +119 -121
- package/dist/src/script/execute_manager.d.ts +25 -0
- package/dist/src/script/execute_manager.js +266 -278
- package/dist/src/script/socket_manager.d.ts +31 -0
- package/dist/src/script/socket_manager.js +196 -193
- package/dist/src/script/webhook_manager.d.ts +3 -0
- package/dist/src/script/webhook_server_manager.d.ts +13 -0
- package/dist/src/script/webhook_server_manager.js +79 -86
- package/dist/src/server/detail.d.ts +72 -0
- package/dist/src/server/detail.js +401 -378
- package/dist/src/server/io.d.ts +46 -0
- package/dist/src/server/io.js +42 -51
- package/dist/src/server/plugin.d.ts +18 -0
- package/dist/src/server/plugin.js +45 -54
- package/dist/src/server/server.d.ts +27 -0
- package/dist/src/server/server.js +38 -36
- package/dist/src/server.d.ts +4 -0
- package/dist/src/util/console_handle.d.ts +20 -0
- package/dist/src/util/console_handle.js +214 -218
- package/dist/src/util/log_handle.d.ts +23 -0
- package/dist/src/util/log_handle.js +158 -164
- package/dist/test/TEST.d.ts +1 -0
- package/dist/test/TEST.js +37 -54
- package/dist/test/client/execute.test.d.ts +1 -0
- package/dist/test/client/execute.test.js +6 -15
- package/dist/test/client/javascript.test.d.ts +1 -0
- package/dist/test/client/javascript.test.js +21 -30
- package/dist/test/client/server.test.d.ts +1 -0
- package/dist/test/client/task.test.d.ts +1 -0
- package/dist/test/client/task.test.js +1 -1
- package/dist/test/script/parser.test.d.ts +1 -0
- package/dist/test/script/socket.test.d.ts +1 -0
- package/package.json +1 -1
- package/tsconfig.json +5 -3
|
@@ -3,229 +3,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Util_Server_Console_Proxy = exports.Util_Server_Console = void 0;
|
|
4
4
|
const interface_1 = require("../interface");
|
|
5
5
|
class Util_Server_Console {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
6
|
+
receivedPack = (model, record) => {
|
|
7
|
+
const pass = model.manager.Register();
|
|
8
|
+
if (pass == -1) {
|
|
9
|
+
model.record.running = false;
|
|
10
|
+
model.record.stop = true;
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
model.record.projects = record.projects;
|
|
14
|
+
model.record.nodes = record.nodes;
|
|
15
|
+
model.record.project_state = model.record.projects.map(x => {
|
|
16
|
+
return {
|
|
17
|
+
uuid: x.uuid,
|
|
18
|
+
state: interface_1.ExecuteState.NONE
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
model.record.project_index = pass;
|
|
22
|
+
model.record.project = record.projects[pass].uuid;
|
|
23
|
+
model.record.task_index = 0;
|
|
24
|
+
model.record.task_state = model.record.projects[0].task.map(x => {
|
|
25
|
+
return {
|
|
26
|
+
uuid: x.uuid,
|
|
27
|
+
state: interface_1.ExecuteState.NONE
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
model.record.task_state[0].state = interface_1.ExecuteState.RUNNING;
|
|
31
|
+
model.record.task_detail = [];
|
|
32
|
+
const task = model.record.projects[model.record.project_index]?.task[model.record.task_index];
|
|
33
|
+
const count = task.cronjob ? (task?.jobs.length ?? 0) : 1;
|
|
34
|
+
for (let i = 0; i < count; i++) {
|
|
35
|
+
model.record.task_detail.push({
|
|
36
|
+
index: i,
|
|
37
|
+
node: "",
|
|
38
|
+
message: [],
|
|
39
|
+
state: interface_1.ExecuteState.NONE
|
|
31
40
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
for (let i = 0; i < count; i++) {
|
|
37
|
-
model.record.task_detail.push({
|
|
38
|
-
index: i,
|
|
39
|
-
node: "",
|
|
40
|
-
message: [],
|
|
41
|
-
state: interface_1.ExecuteState.NONE
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
model.manager.Update();
|
|
45
|
-
return true;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
41
|
+
}
|
|
42
|
+
model.manager.Update();
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
48
45
|
}
|
|
49
46
|
exports.Util_Server_Console = Util_Server_Console;
|
|
50
47
|
class Util_Server_Console_Proxy {
|
|
48
|
+
model;
|
|
51
49
|
constructor(_model) {
|
|
52
|
-
this.execute_project_start = (d) => {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
const index = d[1];
|
|
55
|
-
if (index == -1)
|
|
56
|
-
return;
|
|
57
|
-
this.model.record.project = d[0].uuid;
|
|
58
|
-
this.model.record.project_index = index;
|
|
59
|
-
this.model.record.project_state[index].state = interface_1.ExecuteState.RUNNING;
|
|
60
|
-
this.model.record.task_state = this.model.record.projects[index].task.map(x => {
|
|
61
|
-
return {
|
|
62
|
-
uuid: x.uuid,
|
|
63
|
-
state: interface_1.ExecuteState.NONE
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
this.model.record.task_detail = [];
|
|
67
|
-
const task = (_a = this.model.record.projects[this.model.record.project_index]) === null || _a === void 0 ? void 0 : _a.task[this.model.record.task_index];
|
|
68
|
-
const count = task.cronjob ? ((_b = task === null || task === void 0 ? void 0 : task.jobs.length) !== null && _b !== void 0 ? _b : 0) : 1;
|
|
69
|
-
for (let i = 0; i < count; i++) {
|
|
70
|
-
this.model.record.task_detail.push({
|
|
71
|
-
index: i,
|
|
72
|
-
node: "",
|
|
73
|
-
message: [],
|
|
74
|
-
state: interface_1.ExecuteState.NONE
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
console.log("project start: ", this.model.record.projects.length, index);
|
|
78
|
-
};
|
|
79
|
-
this.execute_project_finish = (d) => {
|
|
80
|
-
if (this.model.record.process_type >= 1) {
|
|
81
|
-
this.model.record.running = false;
|
|
82
|
-
this.model.record.stop = true;
|
|
83
|
-
}
|
|
84
|
-
const index = d[1];
|
|
85
|
-
const size = this.model.record.projects.length;
|
|
86
|
-
if (index == -1)
|
|
87
|
-
return;
|
|
88
|
-
this.model.record.project = "";
|
|
89
|
-
this.model.record.project_state[index].state = interface_1.ExecuteState.FINISH;
|
|
90
|
-
this.model.record.para = undefined;
|
|
91
|
-
console.log("project finish: ", this.model.record.projects.length, index);
|
|
92
|
-
if (index == size - 1) {
|
|
93
|
-
this.model.record.command.push(['clean']);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
this.execute_task_start = (d) => {
|
|
97
|
-
if (this.model.record.project_index == -1)
|
|
98
|
-
return;
|
|
99
|
-
const index = this.model.record.projects[this.model.record.project_index].task.findIndex(x => x.uuid == d[0].uuid);
|
|
100
|
-
if (index == -1)
|
|
101
|
-
return;
|
|
102
|
-
this.model.record.useCron = d[0].cronjob;
|
|
103
|
-
this.model.record.task = d[0].uuid;
|
|
104
|
-
this.model.record.task_index = index;
|
|
105
|
-
this.model.record.task_state[index].state = interface_1.ExecuteState.RUNNING;
|
|
106
|
-
for (let i = 0; i < index; i++)
|
|
107
|
-
this.model.record.task_state[i].state = interface_1.ExecuteState.FINISH;
|
|
108
|
-
for (let i = index + 1; i < this.model.record.task_state.length; i++)
|
|
109
|
-
this.model.record.task_state[i].state = interface_1.ExecuteState.NONE;
|
|
110
|
-
this.model.record.task_detail = [];
|
|
111
|
-
const p = this.model.record.projects[this.model.record.project_index];
|
|
112
|
-
const t = p.task[this.model.record.task_index];
|
|
113
|
-
const count = this.model.manager.get_task_state_count(t);
|
|
114
|
-
for (let i = 0; i < count; i++) {
|
|
115
|
-
this.model.record.task_detail.push({
|
|
116
|
-
index: i,
|
|
117
|
-
node: "",
|
|
118
|
-
message: [],
|
|
119
|
-
state: interface_1.ExecuteState.NONE
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
this.execute_task_finish = (d) => {
|
|
124
|
-
if (this.model.record.process_type == 2) {
|
|
125
|
-
this.model.record.running = false;
|
|
126
|
-
this.model.record.stop = true;
|
|
127
|
-
}
|
|
128
|
-
if (this.model.record.project_index == -1)
|
|
129
|
-
return;
|
|
130
|
-
const index = this.model.record.projects[this.model.record.project_index].task.findIndex(x => x.uuid == d.uuid);
|
|
131
|
-
if (index == -1)
|
|
132
|
-
return;
|
|
133
|
-
this.model.record.useCron = false;
|
|
134
|
-
this.model.record.task = "";
|
|
135
|
-
this.model.record.task_state[index].state = interface_1.ExecuteState.FINISH;
|
|
136
|
-
if (index + 1 < this.model.record.task_state.length - 1) {
|
|
137
|
-
this.model.record.task_state[index + 1].state = interface_1.ExecuteState.RUNNING;
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
this.execute_subtask_start = (d) => {
|
|
141
|
-
var _a;
|
|
142
|
-
try {
|
|
143
|
-
this.model.record.task_detail[d[1]].node = (_a = d[2]) !== null && _a !== void 0 ? _a : '';
|
|
144
|
-
this.model.record.task_detail[d[1]].state = interface_1.ExecuteState.RUNNING;
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
console.error(`execute_subtask_start`, error.message);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
this.execute_subtask_update = (d) => {
|
|
151
|
-
if (this.model.record.task_detail.length > d[1]) {
|
|
152
|
-
this.model.record.task_detail[d[1]].node = d[2];
|
|
153
|
-
this.model.record.task_detail[d[1]].state = d[3];
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
console.error(`subtask_start ${d[1]} is out of range: ${this.model.record.task_detail.length}`);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
this.execute_subtask_end = (d) => {
|
|
160
|
-
try {
|
|
161
|
-
this.model.record.task_detail[d[1]].state = interface_1.ExecuteState.FINISH;
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
console.error(`execute_subtask_end`, error.message);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
this.execute_job_start = (d) => {
|
|
168
|
-
if (this.model.record.project_index == -1)
|
|
169
|
-
return;
|
|
170
|
-
if (!this.model.record.useCron) {
|
|
171
|
-
this.model.record.task_detail[0].node = d[2];
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
this.execute_job_finish = (d) => {
|
|
175
|
-
if (d[3] == 1) {
|
|
176
|
-
const task = this.model.record.projects[this.model.record.project_index].task[this.model.record.task_index];
|
|
177
|
-
const index = task.jobs.findIndex(x => x.uuid == d[0].uuid);
|
|
178
|
-
if (index != -1 && task.jobs[index].category == interface_1.JobCategory.Condition) {
|
|
179
|
-
const cr = task.jobs[index].number_args[0];
|
|
180
|
-
if (cr == interface_1.ConditionResult.None)
|
|
181
|
-
return;
|
|
182
|
-
this.model.record.command.push(['stop']);
|
|
183
|
-
let timer;
|
|
184
|
-
timer = setInterval(() => {
|
|
185
|
-
if (this.model.record.running == false) {
|
|
186
|
-
clearInterval(timer);
|
|
187
|
-
const state = (cr == interface_1.ConditionResult.ThrowTask || cr == interface_1.ConditionResult.ThrowProject) ? interface_1.ExecuteState.ERROR : interface_1.ExecuteState.SKIP;
|
|
188
|
-
const target = this.model.record.task_detail[d[1]];
|
|
189
|
-
if (target != undefined) {
|
|
190
|
-
target.state = state;
|
|
191
|
-
}
|
|
192
|
-
if (cr == interface_1.ConditionResult.Pause)
|
|
193
|
-
return;
|
|
194
|
-
if (cr == interface_1.ConditionResult.SkipProject || cr == interface_1.ConditionResult.ThrowProject) {
|
|
195
|
-
this.model.record.command.push(['skip', 0, state]);
|
|
196
|
-
if (this.model.record.project.length > 0) {
|
|
197
|
-
if (this.model.record.process_type == 0) {
|
|
198
|
-
this.model.record.command.push(['execute', this.model.record.process_type]);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
else if (cr == interface_1.ConditionResult.SkipTask || cr == interface_1.ConditionResult.ThrowTask) {
|
|
203
|
-
this.model.record.command.push(['skip', 1, state]);
|
|
204
|
-
if (this.model.record.project.length > 0) {
|
|
205
|
-
if (this.model.record.process_type == 0) {
|
|
206
|
-
this.model.record.command.push(['execute', this.model.record.process_type]);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}, 1000);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
this.feedback_message = (d) => {
|
|
216
|
-
if (d.index == undefined || d.index == -1)
|
|
217
|
-
return;
|
|
218
|
-
const container = this.model.record.task_detail[d.index];
|
|
219
|
-
if (container != undefined) {
|
|
220
|
-
container.message.push(d.message);
|
|
221
|
-
if (container.message.length > interface_1.MESSAGE_LIMIT) {
|
|
222
|
-
container.message.shift();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
this.update_runtime_database = (d) => {
|
|
227
|
-
this.model.record.para = d;
|
|
228
|
-
};
|
|
229
50
|
this.model = _model;
|
|
230
51
|
}
|
|
231
52
|
get execute_proxy() {
|
|
@@ -244,5 +65,180 @@ class Util_Server_Console_Proxy {
|
|
|
244
65
|
};
|
|
245
66
|
return d;
|
|
246
67
|
}
|
|
68
|
+
execute_project_start = (d) => {
|
|
69
|
+
const index = d[1];
|
|
70
|
+
if (index == -1)
|
|
71
|
+
return;
|
|
72
|
+
this.model.record.project = d[0].uuid;
|
|
73
|
+
this.model.record.project_index = index;
|
|
74
|
+
this.model.record.project_state[index].state = interface_1.ExecuteState.RUNNING;
|
|
75
|
+
this.model.record.task_state = this.model.record.projects[index].task.map(x => {
|
|
76
|
+
return {
|
|
77
|
+
uuid: x.uuid,
|
|
78
|
+
state: interface_1.ExecuteState.NONE
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
this.model.record.task_detail = [];
|
|
82
|
+
const task = this.model.record.projects[this.model.record.project_index]?.task[this.model.record.task_index];
|
|
83
|
+
const count = task.cronjob ? (task?.jobs.length ?? 0) : 1;
|
|
84
|
+
for (let i = 0; i < count; i++) {
|
|
85
|
+
this.model.record.task_detail.push({
|
|
86
|
+
index: i,
|
|
87
|
+
node: "",
|
|
88
|
+
message: [],
|
|
89
|
+
state: interface_1.ExecuteState.NONE
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
console.log("project start: ", this.model.record.projects.length, index);
|
|
93
|
+
};
|
|
94
|
+
execute_project_finish = (d) => {
|
|
95
|
+
if (this.model.record.process_type >= 1) {
|
|
96
|
+
this.model.record.running = false;
|
|
97
|
+
this.model.record.stop = true;
|
|
98
|
+
}
|
|
99
|
+
const index = d[1];
|
|
100
|
+
const size = this.model.record.projects.length;
|
|
101
|
+
if (index == -1)
|
|
102
|
+
return;
|
|
103
|
+
this.model.record.project = "";
|
|
104
|
+
this.model.record.project_state[index].state = interface_1.ExecuteState.FINISH;
|
|
105
|
+
this.model.record.para = undefined;
|
|
106
|
+
console.log("project finish: ", this.model.record.projects.length, index);
|
|
107
|
+
if (index == size - 1) {
|
|
108
|
+
this.model.record.command.push(['clean']);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
execute_task_start = (d) => {
|
|
112
|
+
if (this.model.record.project_index == -1)
|
|
113
|
+
return;
|
|
114
|
+
const index = this.model.record.projects[this.model.record.project_index].task.findIndex(x => x.uuid == d[0].uuid);
|
|
115
|
+
if (index == -1)
|
|
116
|
+
return;
|
|
117
|
+
this.model.record.useCron = d[0].cronjob;
|
|
118
|
+
this.model.record.task = d[0].uuid;
|
|
119
|
+
this.model.record.task_index = index;
|
|
120
|
+
this.model.record.task_state[index].state = interface_1.ExecuteState.RUNNING;
|
|
121
|
+
for (let i = 0; i < index; i++)
|
|
122
|
+
this.model.record.task_state[i].state = interface_1.ExecuteState.FINISH;
|
|
123
|
+
for (let i = index + 1; i < this.model.record.task_state.length; i++)
|
|
124
|
+
this.model.record.task_state[i].state = interface_1.ExecuteState.NONE;
|
|
125
|
+
this.model.record.task_detail = [];
|
|
126
|
+
const p = this.model.record.projects[this.model.record.project_index];
|
|
127
|
+
const t = p.task[this.model.record.task_index];
|
|
128
|
+
const count = this.model.manager.get_task_state_count(t);
|
|
129
|
+
for (let i = 0; i < count; i++) {
|
|
130
|
+
this.model.record.task_detail.push({
|
|
131
|
+
index: i,
|
|
132
|
+
node: "",
|
|
133
|
+
message: [],
|
|
134
|
+
state: interface_1.ExecuteState.NONE
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
execute_task_finish = (d) => {
|
|
139
|
+
if (this.model.record.process_type == 2) {
|
|
140
|
+
this.model.record.running = false;
|
|
141
|
+
this.model.record.stop = true;
|
|
142
|
+
}
|
|
143
|
+
if (this.model.record.project_index == -1)
|
|
144
|
+
return;
|
|
145
|
+
const index = this.model.record.projects[this.model.record.project_index].task.findIndex(x => x.uuid == d.uuid);
|
|
146
|
+
if (index == -1)
|
|
147
|
+
return;
|
|
148
|
+
this.model.record.useCron = false;
|
|
149
|
+
this.model.record.task = "";
|
|
150
|
+
this.model.record.task_state[index].state = interface_1.ExecuteState.FINISH;
|
|
151
|
+
if (index + 1 < this.model.record.task_state.length - 1) {
|
|
152
|
+
this.model.record.task_state[index + 1].state = interface_1.ExecuteState.RUNNING;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
execute_subtask_start = (d) => {
|
|
156
|
+
try {
|
|
157
|
+
this.model.record.task_detail[d[1]].node = d[2] ?? '';
|
|
158
|
+
this.model.record.task_detail[d[1]].state = interface_1.ExecuteState.RUNNING;
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error(`execute_subtask_start`, error.message);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
execute_subtask_update = (d) => {
|
|
165
|
+
if (this.model.record.task_detail.length > d[1]) {
|
|
166
|
+
this.model.record.task_detail[d[1]].node = d[2];
|
|
167
|
+
this.model.record.task_detail[d[1]].state = d[3];
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
console.error(`subtask_start ${d[1]} is out of range: ${this.model.record.task_detail.length}`);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
execute_subtask_end = (d) => {
|
|
174
|
+
try {
|
|
175
|
+
this.model.record.task_detail[d[1]].state = interface_1.ExecuteState.FINISH;
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
console.error(`execute_subtask_end`, error.message);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
execute_job_start = (d) => {
|
|
182
|
+
if (this.model.record.project_index == -1)
|
|
183
|
+
return;
|
|
184
|
+
if (!this.model.record.useCron) {
|
|
185
|
+
this.model.record.task_detail[0].node = d[2];
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
execute_job_finish = (d) => {
|
|
189
|
+
if (d[3] == 1) {
|
|
190
|
+
const task = this.model.record.projects[this.model.record.project_index].task[this.model.record.task_index];
|
|
191
|
+
const index = task.jobs.findIndex(x => x.uuid == d[0].uuid);
|
|
192
|
+
if (index != -1 && task.jobs[index].category == interface_1.JobCategory.Condition) {
|
|
193
|
+
const cr = task.jobs[index].number_args[0];
|
|
194
|
+
if (cr == interface_1.ConditionResult.None)
|
|
195
|
+
return;
|
|
196
|
+
this.model.record.command.push(['stop']);
|
|
197
|
+
let timer;
|
|
198
|
+
timer = setInterval(() => {
|
|
199
|
+
if (this.model.record.running == false) {
|
|
200
|
+
clearInterval(timer);
|
|
201
|
+
const state = (cr == interface_1.ConditionResult.ThrowTask || cr == interface_1.ConditionResult.ThrowProject) ? interface_1.ExecuteState.ERROR : interface_1.ExecuteState.SKIP;
|
|
202
|
+
const target = this.model.record.task_detail[d[1]];
|
|
203
|
+
if (target != undefined) {
|
|
204
|
+
target.state = state;
|
|
205
|
+
}
|
|
206
|
+
if (cr == interface_1.ConditionResult.Pause)
|
|
207
|
+
return;
|
|
208
|
+
if (cr == interface_1.ConditionResult.SkipProject || cr == interface_1.ConditionResult.ThrowProject) {
|
|
209
|
+
this.model.record.command.push(['skip', 0, state]);
|
|
210
|
+
if (this.model.record.project.length > 0) {
|
|
211
|
+
if (this.model.record.process_type == 0) {
|
|
212
|
+
this.model.record.command.push(['execute', this.model.record.process_type]);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else if (cr == interface_1.ConditionResult.SkipTask || cr == interface_1.ConditionResult.ThrowTask) {
|
|
217
|
+
this.model.record.command.push(['skip', 1, state]);
|
|
218
|
+
if (this.model.record.project.length > 0) {
|
|
219
|
+
if (this.model.record.process_type == 0) {
|
|
220
|
+
this.model.record.command.push(['execute', this.model.record.process_type]);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}, 1000);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
feedback_message = (d) => {
|
|
230
|
+
if (d.index == undefined || d.index == -1)
|
|
231
|
+
return;
|
|
232
|
+
const container = this.model.record.task_detail[d.index];
|
|
233
|
+
if (container != undefined) {
|
|
234
|
+
container.message.push(d.message);
|
|
235
|
+
if (container.message.length > interface_1.MESSAGE_LIMIT) {
|
|
236
|
+
container.message.shift();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
update_runtime_database = (d) => {
|
|
241
|
+
this.model.record.para = d;
|
|
242
|
+
};
|
|
247
243
|
}
|
|
248
244
|
exports.Util_Server_Console_Proxy = Util_Server_Console_Proxy;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ExecutePair, ExecuteProxy, ExecuteState, FeedBack, Job, Log, Database, Preference, Project, Task } from "../interface";
|
|
2
|
+
export declare class Util_Server_Log_Proxy {
|
|
3
|
+
model: ExecutePair;
|
|
4
|
+
logs: Log;
|
|
5
|
+
preference: Preference;
|
|
6
|
+
private task_index;
|
|
7
|
+
private uuid;
|
|
8
|
+
private get target_log();
|
|
9
|
+
constructor(_model: ExecutePair, _log: Log, _preference: Preference);
|
|
10
|
+
get execute_proxy(): ExecuteProxy;
|
|
11
|
+
execute_project_start: (d: [Project, number]) => Promise<void>;
|
|
12
|
+
execute_project_finish: (d: [Project, number]) => void;
|
|
13
|
+
execute_task_start: (d: [Task, number]) => void;
|
|
14
|
+
execute_task_finish: (d: Task) => void;
|
|
15
|
+
execute_subtask_start: (d: [Task, number, string]) => void;
|
|
16
|
+
execute_subtask_update: (d: [Task, number, string, ExecuteState]) => void;
|
|
17
|
+
execute_subtask_end: (d: [Task, number, string]) => void;
|
|
18
|
+
execute_job_start: (d: [Job, number, string]) => void;
|
|
19
|
+
execute_job_finish: (d: [Job, number, string, number]) => void;
|
|
20
|
+
feedback_message: (d: FeedBack) => void;
|
|
21
|
+
update_runtime_database: (d: Database) => void;
|
|
22
|
+
getnewname: (name: string) => Promise<string>;
|
|
23
|
+
}
|