|
1
|
|
|
from pystratum_mysql.StaticDataLayer import StaticDataLayer |
|
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
|
5
|
|
|
class DataLayer(StaticDataLayer): |
|
6
|
|
|
""" |
|
7
|
|
|
The stored routines wrappers. |
|
8
|
|
|
""" |
|
9
|
|
|
|
|
10
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
11
|
|
|
@staticmethod |
|
12
|
|
|
def enk_back_clean(p_sch_id, p_srv_id, p_run_id): |
|
13
|
|
|
""" |
|
14
|
|
|
Cleans obsolete data from the database. |
|
15
|
|
|
|
|
16
|
|
|
:param int p_sch_id: |
|
|
|
|
|
|
17
|
|
|
smallint(5) unsigned |
|
18
|
|
|
:param int p_srv_id: |
|
|
|
|
|
|
19
|
|
|
smallint(5) unsigned |
|
20
|
|
|
:param int p_run_id: |
|
|
|
|
|
|
21
|
|
|
int(10) unsigned |
|
22
|
|
|
|
|
23
|
|
|
:rtype: int |
|
24
|
|
|
""" |
|
25
|
|
|
return StaticDataLayer.execute_sp_log("call enk_back_clean(%s, %s, %s)", p_sch_id, p_srv_id, p_run_id) |
|
26
|
|
|
|
|
27
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
28
|
|
|
@staticmethod |
|
29
|
|
|
def enk_back_controller_init(): |
|
30
|
|
|
""" |
|
31
|
|
|
Sets the database in a predictable state. Must be called by the controller when the controller starts. |
|
32
|
|
|
|
|
33
|
|
|
:rtype: int |
|
34
|
|
|
""" |
|
35
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_controller_init()") |
|
36
|
|
|
|
|
37
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
38
|
|
|
@staticmethod |
|
39
|
|
|
def enk_back_counting_resource_update_consumpted(p_rsc_id, p_rsc_amount_consumpted): |
|
40
|
|
|
""" |
|
41
|
|
|
Updates the amount consumpted of a counting resource. |
|
42
|
|
|
|
|
43
|
|
|
:param int p_rsc_id: The ID of the counting resource. |
|
44
|
|
|
int(11) |
|
45
|
|
|
:param int p_rsc_amount_consumpted: The amount consumpted. |
|
46
|
|
|
bigint(20) |
|
47
|
|
|
|
|
48
|
|
|
:rtype: int |
|
49
|
|
|
""" |
|
50
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_counting_resource_update_consumpted(%s, %s)", p_rsc_id, p_rsc_amount_consumpted) |
|
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
53
|
|
|
@staticmethod |
|
54
|
|
|
def enk_back_get_host_resources(): |
|
55
|
|
|
""" |
|
56
|
|
|
Selects all host resources. |
|
57
|
|
|
|
|
58
|
|
|
:rtype: list[dict[str,*]] |
|
59
|
|
|
""" |
|
60
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_back_get_host_resources()") |
|
61
|
|
|
|
|
62
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
63
|
|
|
@staticmethod |
|
64
|
|
|
def enk_back_get_operators(): |
|
65
|
|
|
""" |
|
66
|
|
|
Selects all operators (with email addresses). |
|
67
|
|
|
|
|
68
|
|
|
:rtype: list[dict[str,*]] |
|
69
|
|
|
""" |
|
70
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_back_get_operators()") |
|
71
|
|
|
|
|
72
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
73
|
|
|
@staticmethod |
|
74
|
|
|
def enk_back_node_dynamic_add_dependencies(p_nod_id_outer_worker, p_nod_id_inner_worker): |
|
75
|
|
|
""" |
|
76
|
|
|
|
|
77
|
|
|
:param int p_nod_id_outer_worker: |
|
|
|
|
|
|
78
|
|
|
int(10) unsigned |
|
79
|
|
|
:param int p_nod_id_inner_worker: |
|
|
|
|
|
|
80
|
|
|
int(10) unsigned |
|
81
|
|
|
|
|
82
|
|
|
:rtype: int |
|
83
|
|
|
""" |
|
84
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_node_dynamic_add_dependencies(%s, %s)", p_nod_id_outer_worker, p_nod_id_inner_worker) |
|
|
|
|
|
|
85
|
|
|
|
|
86
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
87
|
|
|
@staticmethod |
|
88
|
|
|
def enk_back_node_get_sch_id_by_nod_id(p_nod_id): |
|
89
|
|
|
""" |
|
90
|
|
|
Selects the ID of a schedule of node. |
|
91
|
|
|
|
|
92
|
|
|
:param int p_nod_id: The ID of a node. |
|
93
|
|
|
int(10) unsigned |
|
94
|
|
|
|
|
95
|
|
|
:rtype: * |
|
96
|
|
|
""" |
|
97
|
|
|
return StaticDataLayer.execute_sp_singleton0("call enk_back_node_get_sch_id_by_nod_id(%s)", p_nod_id) |
|
98
|
|
|
|
|
99
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
100
|
|
|
@staticmethod |
|
101
|
|
|
def enk_back_read_write_lock_resource_update_consumpted(p_rsc_id, p_rws_id_consumpted): |
|
102
|
|
|
""" |
|
103
|
|
|
Updates the RW lock status of a RW lock resource. |
|
104
|
|
|
|
|
105
|
|
|
:param int p_rsc_id: The ID of the RW resource. |
|
106
|
|
|
int(11) |
|
107
|
|
|
:param int p_rws_id_consumpted: The ID of the consumption. |
|
108
|
|
|
tinyint(3) unsigned |
|
109
|
|
|
|
|
110
|
|
|
:rtype: int |
|
111
|
|
|
""" |
|
112
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_read_write_lock_resource_update_consumpted(%s, %s)", p_rsc_id, p_rws_id_consumpted) |
|
|
|
|
|
|
113
|
|
|
|
|
114
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
115
|
|
|
@staticmethod |
|
116
|
|
|
def enk_back_run_get_consumptions(p_run_id): |
|
117
|
|
|
""" |
|
118
|
|
|
Selects all consumptions of all nodes of schedule revision. |
|
119
|
|
|
|
|
120
|
|
|
:param int p_run_id: |
|
|
|
|
|
|
121
|
|
|
int(10) unsigned |
|
122
|
|
|
|
|
123
|
|
|
:rtype: dict |
|
124
|
|
|
""" |
|
125
|
|
|
ret = {} |
|
126
|
|
|
rows = StaticDataLayer.execute_sp_rows("call enk_back_run_get_consumptions(%s)", p_run_id) |
|
127
|
|
|
for row in rows: |
|
128
|
|
|
if row['rnd_id'] in ret: |
|
129
|
|
|
ret[row['rnd_id']].append(row) |
|
130
|
|
|
else: |
|
131
|
|
|
ret[row['rnd_id']] = [row] |
|
132
|
|
|
|
|
133
|
|
|
return ret |
|
134
|
|
|
|
|
135
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
136
|
|
|
@staticmethod |
|
137
|
|
|
def enk_back_run_get_dependants(p_srv_id): |
|
138
|
|
|
""" |
|
139
|
|
|
Selects all dependants of all ports of all nodes of a schedule revision. |
|
140
|
|
|
|
|
141
|
|
|
:param int p_srv_id: The Id of the schedule revision. |
|
142
|
|
|
smallint(5) unsigned |
|
143
|
|
|
|
|
144
|
|
|
:rtype: dict |
|
145
|
|
|
""" |
|
146
|
|
|
ret = {} |
|
147
|
|
|
rows = StaticDataLayer.execute_sp_rows("call enk_back_run_get_dependants(%s)", p_srv_id) |
|
148
|
|
|
for row in rows: |
|
149
|
|
|
if row['prt_id_predecessor'] in ret: |
|
150
|
|
|
ret[row['prt_id_predecessor']].append(row) |
|
151
|
|
|
else: |
|
152
|
|
|
ret[row['prt_id_predecessor']] = [row] |
|
153
|
|
|
|
|
154
|
|
|
return ret |
|
155
|
|
|
|
|
156
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
157
|
|
|
@staticmethod |
|
158
|
|
|
def enk_back_run_get_dependencies(p_srv_id): |
|
159
|
|
|
""" |
|
160
|
|
|
Selects all dependencies of all ports of all nodes of a schedule revision. |
|
161
|
|
|
|
|
162
|
|
|
:param int p_srv_id: The Id of the schedule revision. |
|
163
|
|
|
smallint(5) unsigned |
|
164
|
|
|
|
|
165
|
|
|
:rtype: dict |
|
166
|
|
|
""" |
|
167
|
|
|
ret = {} |
|
168
|
|
|
rows = StaticDataLayer.execute_sp_rows("call enk_back_run_get_dependencies(%s)", p_srv_id) |
|
169
|
|
|
for row in rows: |
|
170
|
|
|
if row['prt_id_dependant'] in ret: |
|
171
|
|
|
ret[row['prt_id_dependant']].append(row) |
|
172
|
|
|
else: |
|
173
|
|
|
ret[row['prt_id_dependant']] = [row] |
|
174
|
|
|
|
|
175
|
|
|
return ret |
|
176
|
|
|
|
|
177
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
178
|
|
|
@staticmethod |
|
179
|
|
|
def enk_back_run_get_ports1(p_run_id): |
|
180
|
|
|
""" |
|
181
|
|
|
Selects all ports of all nodes in a schedule revision. |
|
182
|
|
|
|
|
183
|
|
|
:param int p_run_id: The ID of the run. |
|
184
|
|
|
int(10) unsigned |
|
185
|
|
|
|
|
186
|
|
|
:rtype: dict |
|
187
|
|
|
""" |
|
188
|
|
|
ret = {} |
|
189
|
|
|
rows = StaticDataLayer.execute_sp_rows("call enk_back_run_get_ports1(%s)", p_run_id) |
|
190
|
|
|
for row in rows: |
|
191
|
|
|
if row['prt_id'] in ret: |
|
192
|
|
|
raise Exception('Duplicate key for %s.' % str((row['prt_id']))) |
|
193
|
|
|
else: |
|
194
|
|
|
ret[row['prt_id']] = row |
|
195
|
|
|
|
|
196
|
|
|
return ret |
|
197
|
|
|
|
|
198
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
199
|
|
|
@staticmethod |
|
200
|
|
|
def enk_back_run_get_ports2(p_run_id): |
|
201
|
|
|
""" |
|
202
|
|
|
Selects all ports of all nodes in a schedule revision. |
|
203
|
|
|
|
|
204
|
|
|
:param int p_run_id: The ID of the run. |
|
205
|
|
|
int(10) unsigned |
|
206
|
|
|
|
|
207
|
|
|
:rtype: dict |
|
208
|
|
|
""" |
|
209
|
|
|
ret = {} |
|
210
|
|
|
rows = StaticDataLayer.execute_sp_rows("call enk_back_run_get_ports2(%s)", p_run_id) |
|
211
|
|
|
for row in rows: |
|
212
|
|
|
if row['rnd_id'] in ret: |
|
213
|
|
|
ret[row['rnd_id']].append(row) |
|
214
|
|
|
else: |
|
215
|
|
|
ret[row['rnd_id']] = [row] |
|
216
|
|
|
|
|
217
|
|
|
return ret |
|
218
|
|
|
|
|
219
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
220
|
|
|
@staticmethod |
|
221
|
|
|
def enk_back_run_get_resources(p_run_id): |
|
222
|
|
|
""" |
|
223
|
|
|
Selects all resources of all nodes in a schedule revision. |
|
224
|
|
|
|
|
225
|
|
|
:param int p_run_id: The ID of the run. |
|
226
|
|
|
int(10) unsigned |
|
227
|
|
|
|
|
228
|
|
|
:rtype: dict |
|
229
|
|
|
""" |
|
230
|
|
|
ret = {} |
|
231
|
|
|
rows = StaticDataLayer.execute_sp_rows("call enk_back_run_get_resources(%s)", p_run_id) |
|
232
|
|
|
for row in rows: |
|
233
|
|
|
if row['rnd_id'] in ret: |
|
234
|
|
|
ret[row['rnd_id']].append(row) |
|
235
|
|
|
else: |
|
236
|
|
|
ret[row['rnd_id']] = [row] |
|
237
|
|
|
|
|
238
|
|
|
return ret |
|
239
|
|
|
|
|
240
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
241
|
|
|
@staticmethod |
|
242
|
|
|
def enk_back_run_get_run_nodes(p_run_id): |
|
243
|
|
|
""" |
|
244
|
|
|
Selects all current nodes in a schedule revision. |
|
245
|
|
|
|
|
246
|
|
|
:param int p_run_id: The ID of the run. |
|
247
|
|
|
int(10) unsigned |
|
248
|
|
|
|
|
249
|
|
|
:rtype: dict |
|
250
|
|
|
""" |
|
251
|
|
|
ret = {} |
|
252
|
|
|
rows = StaticDataLayer.execute_sp_rows("call enk_back_run_get_run_nodes(%s)", p_run_id) |
|
253
|
|
|
for row in rows: |
|
254
|
|
|
if row['rnd_id'] in ret: |
|
255
|
|
|
raise Exception('Duplicate key for %s.' % str((row['rnd_id']))) |
|
256
|
|
|
else: |
|
257
|
|
|
ret[row['rnd_id']] = row |
|
258
|
|
|
|
|
259
|
|
|
return ret |
|
260
|
|
|
|
|
261
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
262
|
|
|
@staticmethod |
|
263
|
|
|
def enk_back_run_node_find_by_uri(p_uri_uri): |
|
264
|
|
|
""" |
|
265
|
|
|
Selects a current run node based on the URI of the node. |
|
266
|
|
|
|
|
267
|
|
|
:param str p_uri_uri: The URI of the node. |
|
268
|
|
|
varchar(4000) character set ascii collation ascii_general_ci |
|
269
|
|
|
|
|
270
|
|
|
:rtype: None|dict[str,*] |
|
271
|
|
|
""" |
|
272
|
|
|
return StaticDataLayer.execute_sp_row0("call enk_back_run_node_find_by_uri(%s)", p_uri_uri) |
|
273
|
|
|
|
|
274
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
275
|
|
|
@staticmethod |
|
276
|
|
|
def enk_back_run_node_get_details(p_rnd_id): |
|
277
|
|
|
""" |
|
278
|
|
|
Selects the details of a run node. |
|
279
|
|
|
|
|
280
|
|
|
:param int p_rnd_id: The ID of the run node. |
|
281
|
|
|
int(11) |
|
282
|
|
|
|
|
283
|
|
|
:rtype: dict[str,*] |
|
284
|
|
|
""" |
|
285
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_back_run_node_get_details(%s)", p_rnd_id) |
|
286
|
|
|
|
|
287
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
288
|
|
|
@staticmethod |
|
289
|
|
|
def enk_back_run_node_get_dynamic_info_by_generator(p_rnd_id_generator): |
|
290
|
|
|
""" |
|
291
|
|
|
Selects data of a dynamic node by the node ID of its generator. |
|
292
|
|
|
|
|
293
|
|
|
:param int p_rnd_id_generator: The run node ID of the generator. |
|
294
|
|
|
int(11) |
|
295
|
|
|
|
|
296
|
|
|
:rtype: dict[str,*] |
|
297
|
|
|
""" |
|
298
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_back_run_node_get_dynamic_info_by_generator(%s)", p_rnd_id_generator) |
|
|
|
|
|
|
299
|
|
|
|
|
300
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
301
|
|
|
@staticmethod |
|
302
|
|
|
def enk_back_run_node_renew(p_rnd_id): |
|
303
|
|
|
""" |
|
304
|
|
|
xxx |
|
305
|
|
|
|
|
306
|
|
|
:param int p_rnd_id: |
|
|
|
|
|
|
307
|
|
|
int(11) |
|
308
|
|
|
|
|
309
|
|
|
:rtype: * |
|
310
|
|
|
""" |
|
311
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_back_run_node_renew(%s)", p_rnd_id) |
|
312
|
|
|
|
|
313
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
314
|
|
|
@staticmethod |
|
315
|
|
|
def enk_back_run_node_update_err(p_rnd_id, p_blb_id, p_rnd_size_err): |
|
316
|
|
|
""" |
|
317
|
|
|
Updates a node with metadata about the STDERR log. |
|
318
|
|
|
|
|
319
|
|
|
:param int p_rnd_id: The ID of the run node. |
|
320
|
|
|
int(11) |
|
321
|
|
|
:param int p_blb_id: The ID of the BLOB with the log. |
|
322
|
|
|
int(10) unsigned |
|
323
|
|
|
:param int p_rnd_size_err: The total log size. |
|
324
|
|
|
bigint(20) unsigned |
|
325
|
|
|
|
|
326
|
|
|
:rtype: int |
|
327
|
|
|
""" |
|
328
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_run_node_update_err(%s, %s, %s)", p_rnd_id, p_blb_id, p_rnd_size_err) |
|
|
|
|
|
|
329
|
|
|
|
|
330
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
331
|
|
|
@staticmethod |
|
332
|
|
|
def enk_back_run_node_update_log(p_rnd_id, p_blb_id, p_rnd_size_log): |
|
333
|
|
|
""" |
|
334
|
|
|
Updates a node with metadata about the STDOUT. |
|
335
|
|
|
|
|
336
|
|
|
:param int p_rnd_id: The ID of the run node. |
|
337
|
|
|
int(11) |
|
338
|
|
|
:param int p_blb_id: The ID of the BLOB with the log. |
|
339
|
|
|
int(10) unsigned |
|
340
|
|
|
:param int p_rnd_size_log: The total log size. |
|
341
|
|
|
bigint(20) unsigned |
|
342
|
|
|
|
|
343
|
|
|
:rtype: int |
|
344
|
|
|
""" |
|
345
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_run_node_update_log(%s, %s, %s)", p_rnd_id, p_blb_id, p_rnd_size_log) |
|
|
|
|
|
|
346
|
|
|
|
|
347
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
348
|
|
|
@staticmethod |
|
349
|
|
|
def enk_back_run_node_update_status(p_rnd_id, p_rst_id, p_rnd_datetime_start, p_rnd_datetime_stop, p_rnd_exit_status): |
|
|
|
|
|
|
350
|
|
|
""" |
|
351
|
|
|
Marks node @a p_rnd_id as stopped with status @a p_rst_id. |
|
352
|
|
|
|
|
353
|
|
|
:param int p_rnd_id: |
|
|
|
|
|
|
354
|
|
|
int(11) |
|
355
|
|
|
:param int p_rst_id: |
|
|
|
|
|
|
356
|
|
|
tinyint(3) unsigned |
|
357
|
|
|
:param str p_rnd_datetime_start: |
|
|
|
|
|
|
358
|
|
|
datetime |
|
359
|
|
|
:param str p_rnd_datetime_stop: |
|
|
|
|
|
|
360
|
|
|
datetime |
|
361
|
|
|
:param int p_rnd_exit_status: |
|
|
|
|
|
|
362
|
|
|
int(11) |
|
363
|
|
|
|
|
364
|
|
|
:rtype: int |
|
365
|
|
|
""" |
|
366
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_run_node_update_status(%s, %s, %s, %s, %s)", p_rnd_id, p_rst_id, p_rnd_datetime_start, p_rnd_datetime_stop, p_rnd_exit_status) |
|
|
|
|
|
|
367
|
|
|
|
|
368
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
369
|
|
|
@staticmethod |
|
370
|
|
|
def enk_back_run_update_status(p_run_id, p_run_datetime_start, p_run_datetime_stop): |
|
371
|
|
|
""" |
|
372
|
|
|
Update the status of a run. |
|
373
|
|
|
|
|
374
|
|
|
:param int p_run_id: The ID of the run. |
|
375
|
|
|
int(10) unsigned |
|
376
|
|
|
:param str p_run_datetime_start: The start datetime of the run. |
|
377
|
|
|
datetime |
|
378
|
|
|
:param str p_run_datetime_stop: The stop datetime of the run. |
|
379
|
|
|
datetime |
|
380
|
|
|
|
|
381
|
|
|
:rtype: int |
|
382
|
|
|
""" |
|
383
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_run_update_status(%s, %s, %s)", p_run_id, p_run_datetime_start, p_run_datetime_stop) |
|
|
|
|
|
|
384
|
|
|
|
|
385
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
386
|
|
|
@staticmethod |
|
387
|
|
|
def enk_back_schedule_delete(p_sch_id): |
|
388
|
|
|
""" |
|
389
|
|
|
Deletes an entire schedule. |
|
390
|
|
|
|
|
391
|
|
|
:param int p_sch_id: |
|
|
|
|
|
|
392
|
|
|
smallint(5) unsigned |
|
393
|
|
|
|
|
394
|
|
|
:rtype: int |
|
395
|
|
|
""" |
|
396
|
|
|
return StaticDataLayer.execute_sp_none("call enk_back_schedule_delete(%s)", p_sch_id) |
|
397
|
|
|
|
|
398
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
399
|
|
|
@staticmethod |
|
400
|
|
|
def enk_back_schedule_get_current_xml(p_sch_id): |
|
401
|
|
|
""" |
|
402
|
|
|
Selects the XML definition of the current version of a schedule. |
|
403
|
|
|
|
|
404
|
|
|
:param int p_sch_id: The ID of the schedule. |
|
405
|
|
|
smallint(5) unsigned |
|
406
|
|
|
|
|
407
|
|
|
:rtype: * |
|
408
|
|
|
""" |
|
409
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_back_schedule_get_current_xml(%s)", p_sch_id) |
|
410
|
|
|
|
|
411
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
412
|
|
|
@staticmethod |
|
413
|
|
|
def enk_back_schedule_get_schedule(p_sch_id): |
|
414
|
|
|
""" |
|
415
|
|
|
Selects data of a schedule. |
|
416
|
|
|
|
|
417
|
|
|
:param int p_sch_id: The ID of the schedule. |
|
418
|
|
|
smallint(5) unsigned |
|
419
|
|
|
|
|
420
|
|
|
:rtype: dict[str,*] |
|
421
|
|
|
""" |
|
422
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_back_schedule_get_schedule(%s)", p_sch_id) |
|
423
|
|
|
|
|
424
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
425
|
|
|
@staticmethod |
|
426
|
|
|
def enk_back_schedule_revision_create_run(p_srv_id): |
|
427
|
|
|
""" |
|
428
|
|
|
Creates a new run for schedule revision p_srv_id. |
|
429
|
|
|
|
|
430
|
|
|
:param int p_srv_id: |
|
|
|
|
|
|
431
|
|
|
smallint(5) unsigned |
|
432
|
|
|
|
|
433
|
|
|
:rtype: * |
|
434
|
|
|
""" |
|
435
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_back_schedule_revision_create_run(%s)", p_srv_id) |
|
436
|
|
|
|
|
437
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
438
|
|
|
@staticmethod |
|
439
|
|
|
def enk_back_schedule_trigger(p_sch_id): |
|
440
|
|
|
""" |
|
441
|
|
|
Triggers a schedule. |
|
442
|
|
|
|
|
443
|
|
|
:param int p_sch_id: |
|
|
|
|
|
|
444
|
|
|
smallint(5) unsigned |
|
445
|
|
|
|
|
446
|
|
|
:rtype: * |
|
447
|
|
|
""" |
|
448
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_back_schedule_trigger(%s)", p_sch_id) |
|
449
|
|
|
|
|
450
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
451
|
|
|
@staticmethod |
|
452
|
|
|
def enk_blob_get_blob(p_blb_id): |
|
453
|
|
|
""" |
|
454
|
|
|
Selects the data of a BLOB. |
|
455
|
|
|
|
|
456
|
|
|
:param int p_blb_id: The ID of the BLOB. |
|
457
|
|
|
int(10) unsigned |
|
458
|
|
|
|
|
459
|
|
|
:rtype: dict[str,*] |
|
460
|
|
|
""" |
|
461
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_blob_get_blob(%s)", p_blb_id) |
|
462
|
|
|
|
|
463
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
464
|
|
|
@staticmethod |
|
465
|
|
|
def enk_blob_get_details(p_blb_id): |
|
466
|
|
|
""" |
|
467
|
|
|
Selects the details of a BLOB (but not the data). |
|
468
|
|
|
|
|
469
|
|
|
:param int p_blb_id: The ID of the BLOB. |
|
470
|
|
|
int(10) unsigned |
|
471
|
|
|
|
|
472
|
|
|
:rtype: dict[str,*] |
|
473
|
|
|
""" |
|
474
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_blob_get_details(%s)", p_blb_id) |
|
475
|
|
|
|
|
476
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
477
|
|
|
@staticmethod |
|
478
|
|
|
def enk_blob_insert_blob(p_filename, p_mime_type, p_data): |
|
479
|
|
|
""" |
|
480
|
|
|
Inserts a BLOB and selects the ID of the BLOB. |
|
481
|
|
|
|
|
482
|
|
|
:param str p_filename: The filename associated with the BLOB. |
|
483
|
|
|
varchar(255) character set utf8 collation utf8_general_ci |
|
484
|
|
|
:param str p_mime_type: The mime type of the data. |
|
485
|
|
|
varchar(48) character set utf8 collation utf8_general_ci |
|
486
|
|
|
:param bytes p_data: The data of the BLOB. |
|
487
|
|
|
longblob |
|
488
|
|
|
|
|
489
|
|
|
:rtype: * |
|
490
|
|
|
""" |
|
491
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_blob_insert_blob(%s, %s, %s)", p_filename, p_mime_type, p_data) |
|
|
|
|
|
|
492
|
|
|
|
|
493
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
494
|
|
|
@staticmethod |
|
495
|
|
|
def enk_front_run_get_addendum(p_run_id): |
|
496
|
|
|
""" |
|
497
|
|
|
Selects the addendum of a schedule revision of a run. |
|
498
|
|
|
|
|
499
|
|
|
:param int p_run_id: The ID of the run. |
|
500
|
|
|
int(10) unsigned |
|
501
|
|
|
|
|
502
|
|
|
:rtype: dict[str,*] |
|
503
|
|
|
""" |
|
504
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_front_run_get_addendum(%s)", p_run_id) |
|
505
|
|
|
|
|
506
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
507
|
|
|
@staticmethod |
|
508
|
|
|
def enk_front_run_get_all_dependencies(p_srv_id): |
|
509
|
|
|
""" |
|
510
|
|
|
Selects all dependencies of all ports of all nodes of a schedule revision. |
|
511
|
|
|
|
|
512
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
513
|
|
|
smallint(5) unsigned |
|
514
|
|
|
|
|
515
|
|
|
:rtype: list[dict[str,*]] |
|
516
|
|
|
""" |
|
517
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_get_all_dependencies(%s)", p_srv_id) |
|
518
|
|
|
|
|
519
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
520
|
|
|
@staticmethod |
|
521
|
|
|
def enk_front_run_get_all_ports(p_run_id): |
|
522
|
|
|
""" |
|
523
|
|
|
Selects all ports of all nodes of a run. |
|
524
|
|
|
|
|
525
|
|
|
:param int p_run_id: The ID of the run |
|
526
|
|
|
int(10) unsigned |
|
527
|
|
|
|
|
528
|
|
|
:rtype: list[dict[str,*]] |
|
529
|
|
|
""" |
|
530
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_get_all_ports(%s)", p_run_id) |
|
531
|
|
|
|
|
532
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
533
|
|
|
@staticmethod |
|
534
|
|
|
def enk_front_run_get_all_run_nodes(p_run_id): |
|
535
|
|
|
""" |
|
536
|
|
|
Selects all nodes of a a run. |
|
537
|
|
|
|
|
538
|
|
|
:param int p_run_id: The ID of the run. |
|
539
|
|
|
int(10) unsigned |
|
540
|
|
|
|
|
541
|
|
|
:rtype: list[dict[str,*]] |
|
542
|
|
|
""" |
|
543
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_get_all_run_nodes(%s)", p_run_id) |
|
544
|
|
|
|
|
545
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
546
|
|
|
@staticmethod |
|
547
|
|
|
def enk_front_run_node_get_consumptions(p_rnd_id): |
|
548
|
|
|
""" |
|
549
|
|
|
Selects all consumptions of a run node. |
|
550
|
|
|
|
|
551
|
|
|
:param int p_rnd_id: |
|
|
|
|
|
|
552
|
|
|
int(11) |
|
553
|
|
|
|
|
554
|
|
|
:rtype: list[dict[str,*]] |
|
555
|
|
|
""" |
|
556
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_node_get_consumptions(%s)", p_rnd_id) |
|
557
|
|
|
|
|
558
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
559
|
|
|
@staticmethod |
|
560
|
|
|
def enk_front_run_node_get_logs(p_rnd_id): |
|
561
|
|
|
""" |
|
562
|
|
|
Selects all logs of a run node. |
|
563
|
|
|
|
|
564
|
|
|
:param int p_rnd_id: |
|
|
|
|
|
|
565
|
|
|
int(11) |
|
566
|
|
|
|
|
567
|
|
|
:rtype: list[dict[str,*]] |
|
568
|
|
|
""" |
|
569
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_node_get_logs(%s)", p_rnd_id) |
|
570
|
|
|
|
|
571
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
572
|
|
|
@staticmethod |
|
573
|
|
|
def enk_front_run_node_get_resources(p_rnd_id): |
|
574
|
|
|
""" |
|
575
|
|
|
Selects all resources of a node. |
|
576
|
|
|
|
|
577
|
|
|
:param int p_rnd_id: The ID of the node. |
|
578
|
|
|
int(11) |
|
579
|
|
|
|
|
580
|
|
|
:rtype: list[dict[str,*]] |
|
581
|
|
|
""" |
|
582
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_node_get_resources(%s)", p_rnd_id) |
|
583
|
|
|
|
|
584
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
585
|
|
|
@staticmethod |
|
586
|
|
|
def enk_front_run_node_get_status(p_rnd_id): |
|
587
|
|
|
""" |
|
588
|
|
|
Selects current status of a run node. |
|
589
|
|
|
|
|
590
|
|
|
:param int p_rnd_id: The ID of the run node. |
|
591
|
|
|
int(11) |
|
592
|
|
|
|
|
593
|
|
|
:rtype: dict[str,*] |
|
594
|
|
|
""" |
|
595
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_front_run_node_get_status(%s)", p_rnd_id) |
|
596
|
|
|
|
|
597
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
598
|
|
|
@staticmethod |
|
599
|
|
|
def enk_front_run_node_get_status_change(p_run_id, p_nsc_id): |
|
600
|
|
|
""" |
|
601
|
|
|
Selects all node status changes of a run after a run node status change. |
|
602
|
|
|
|
|
603
|
|
|
:param int p_run_id: The ID of the run. |
|
604
|
|
|
int(10) unsigned |
|
605
|
|
|
:param int p_nsc_id: The ID of the node status change. |
|
606
|
|
|
int(10) unsigned |
|
607
|
|
|
|
|
608
|
|
|
:rtype: list[dict[str,*]] |
|
609
|
|
|
""" |
|
610
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_node_get_status_change(%s, %s)", p_run_id, p_nsc_id) |
|
611
|
|
|
|
|
612
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
613
|
|
|
@staticmethod |
|
614
|
|
|
def enk_front_schedule_get_all(): |
|
615
|
|
|
""" |
|
616
|
|
|
Selects all schedules. |
|
617
|
|
|
|
|
618
|
|
|
:rtype: list[dict[str,*]] |
|
619
|
|
|
""" |
|
620
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_schedule_get_all()") |
|
621
|
|
|
|
|
622
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
623
|
|
|
@staticmethod |
|
624
|
|
|
def enk_front_schedule_get_all_runs(p_sch_id): |
|
625
|
|
|
""" |
|
626
|
|
|
Selects all runs of a schedule. |
|
627
|
|
|
|
|
628
|
|
|
:param int p_sch_id: The ID of the schedule. |
|
629
|
|
|
smallint(5) unsigned |
|
630
|
|
|
|
|
631
|
|
|
:rtype: list[dict[str,*]] |
|
632
|
|
|
""" |
|
633
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_schedule_get_all_runs(%s)", p_sch_id) |
|
634
|
|
|
|
|
635
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
636
|
|
|
@staticmethod |
|
637
|
|
|
def enk_misc_insert_uri(p_uri_uri): |
|
638
|
|
|
""" |
|
639
|
|
|
Selects the ID of an URI. If the URI doesn't exists it will be inserted. |
|
640
|
|
|
|
|
641
|
|
|
:param str p_uri_uri: The URI. |
|
642
|
|
|
varchar(4000) character set ascii collation ascii_general_ci |
|
643
|
|
|
|
|
644
|
|
|
:rtype: * |
|
645
|
|
|
""" |
|
646
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_misc_insert_uri(%s)", p_uri_uri) |
|
647
|
|
|
|
|
648
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
649
|
|
|
@staticmethod |
|
650
|
|
|
def enk_reader_consumption_store_counting_consumption(p_nod_id, p_rsc_id, p_uri_id, p_cns_amount): |
|
651
|
|
|
""" |
|
652
|
|
|
Stores a consumption of type "ReadWriteLockConsumption" and selects the @c cns_id of the new consumption. |
|
653
|
|
|
|
|
654
|
|
|
:param int p_nod_id: The ID of the node of that will make consumption. |
|
655
|
|
|
int(10) unsigned |
|
656
|
|
|
:param int p_rsc_id: The ID of the resource that will be consumpted. |
|
657
|
|
|
int(11) |
|
658
|
|
|
:param int p_uri_id: The ID of the URI of the consumption. |
|
659
|
|
|
int(10) unsigned |
|
660
|
|
|
:param int p_cns_amount: The amount that will be consumpted. |
|
661
|
|
|
bigint(20) |
|
662
|
|
|
|
|
663
|
|
|
:rtype: * |
|
664
|
|
|
""" |
|
665
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_consumption_store_counting_consumption(%s, %s, %s, %s)", p_nod_id, p_rsc_id, p_uri_id, p_cns_amount) |
|
|
|
|
|
|
666
|
|
|
|
|
667
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
668
|
|
|
@staticmethod |
|
669
|
|
|
def enk_reader_consumption_store_read_write_lock_consumption(p_nod_id, p_rsc_id, p_rws_id, p_uri_id): |
|
670
|
|
|
""" |
|
671
|
|
|
Stores a consumption of type "ReadWriteLockConsumption" and selects the ID of the new consumption. |
|
672
|
|
|
|
|
673
|
|
|
:param int p_nod_id: The ID of the node that will make consumption. |
|
674
|
|
|
int(10) unsigned |
|
675
|
|
|
:param int p_rsc_id: The ID of the resource that will be consumpted. |
|
676
|
|
|
int(11) |
|
677
|
|
|
:param int p_rws_id: The RW status of the consumption. |
|
678
|
|
|
tinyint(3) unsigned |
|
679
|
|
|
:param int p_uri_id: The ID of the URI of the consumption. |
|
680
|
|
|
int(10) unsigned |
|
681
|
|
|
|
|
682
|
|
|
:rtype: * |
|
683
|
|
|
""" |
|
684
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_consumption_store_read_write_lock_consumption(%s, %s, %s, %s)", p_nod_id, p_rsc_id, p_rws_id, p_uri_id) |
|
|
|
|
|
|
685
|
|
|
|
|
686
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
687
|
|
|
@staticmethod |
|
688
|
|
|
def enk_reader_dependency_store_dependency(p_prt_id_dependant, p_prt_id_predecessor): |
|
689
|
|
|
""" |
|
690
|
|
|
Stores a dependency between two ports. |
|
691
|
|
|
|
|
692
|
|
|
:param int p_prt_id_dependant: The ID of the dependant port |
|
693
|
|
|
int(10) unsigned |
|
694
|
|
|
:param int p_prt_id_predecessor: The ID of the predecessor port. |
|
695
|
|
|
int(10) unsigned |
|
696
|
|
|
|
|
697
|
|
|
:rtype: int |
|
698
|
|
|
""" |
|
699
|
|
|
return StaticDataLayer.execute_sp_none("call enk_reader_dependency_store_dependency(%s, %s)", p_prt_id_dependant, p_prt_id_predecessor) |
|
|
|
|
|
|
700
|
|
|
|
|
701
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
702
|
|
|
@staticmethod |
|
703
|
|
|
def enk_reader_host_load_host(p_hst_name): |
|
704
|
|
|
""" |
|
705
|
|
|
Selects the details of a host. |
|
706
|
|
|
|
|
707
|
|
|
:param str p_hst_name: The hostname. |
|
708
|
|
|
varchar(64) character set utf8 collation utf8_general_ci |
|
709
|
|
|
|
|
710
|
|
|
:rtype: dict[str,*] |
|
711
|
|
|
""" |
|
712
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_reader_host_load_host(%s)", p_hst_name) |
|
713
|
|
|
|
|
714
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
715
|
|
|
@staticmethod |
|
716
|
|
|
def enk_reader_host_load_resources(p_hst_id): |
|
717
|
|
|
""" |
|
718
|
|
|
Selects the resources of a host. |
|
719
|
|
|
|
|
720
|
|
|
:param int p_hst_id: The ID of the host. |
|
721
|
|
|
smallint(5) unsigned |
|
722
|
|
|
|
|
723
|
|
|
:rtype: list[dict[str,*]] |
|
724
|
|
|
""" |
|
725
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_reader_host_load_resources(%s)", p_hst_id) |
|
726
|
|
|
|
|
727
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
728
|
|
|
@staticmethod |
|
729
|
|
|
def enk_reader_host_store_host(p_hst_name): |
|
730
|
|
|
""" |
|
731
|
|
|
Stores a host and selects the IF of the host. |
|
732
|
|
|
|
|
733
|
|
|
:param str p_hst_name: The hostname. |
|
734
|
|
|
varchar(64) character set utf8 collation utf8_general_ci |
|
735
|
|
|
|
|
736
|
|
|
:rtype: * |
|
737
|
|
|
""" |
|
738
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_host_store_host(%s)", p_hst_name) |
|
739
|
|
|
|
|
740
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
741
|
|
|
@staticmethod |
|
742
|
|
|
def enk_reader_node_store_command_job(p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_user_name, p_nod_command, p_nod_master): |
|
|
|
|
|
|
743
|
|
|
""" |
|
744
|
|
|
Stores a node of type "command job" and selects the ID of the new node. |
|
745
|
|
|
|
|
746
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
747
|
|
|
smallint(5) unsigned |
|
748
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
749
|
|
|
int(10) unsigned |
|
750
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
|
751
|
|
|
int(10) unsigned |
|
752
|
|
|
:param str p_nod_name: The name of the node. |
|
753
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
754
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
|
755
|
|
|
int(11) |
|
756
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
|
|
757
|
|
|
int(11) |
|
758
|
|
|
:param str p_nod_user_name: The account under which the command must run. |
|
759
|
|
|
varchar(32) character set utf8 collation utf8_general_ci |
|
760
|
|
|
:param str p_nod_command: The command that must be executed (serialized array). |
|
761
|
|
|
varchar(1000) character set utf8 collation utf8_general_ci |
|
762
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
763
|
|
|
tinyint(1) |
|
764
|
|
|
|
|
765
|
|
|
:rtype: * |
|
766
|
|
|
""" |
|
767
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_command_job(%s, %s, %s, %s, %s, %s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_user_name, p_nod_command, p_nod_master) |
|
|
|
|
|
|
768
|
|
|
|
|
769
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
770
|
|
|
@staticmethod |
|
771
|
|
|
def enk_reader_node_store_compound_job(p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master): |
|
|
|
|
|
|
772
|
|
|
""" |
|
773
|
|
|
Stores a node of type "compound job" and selects the ID of the new node. |
|
774
|
|
|
|
|
775
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
776
|
|
|
smallint(5) unsigned |
|
777
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
778
|
|
|
int(10) unsigned |
|
779
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
|
780
|
|
|
int(10) unsigned |
|
781
|
|
|
:param str p_nod_name: The name of the node. |
|
782
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
783
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
|
784
|
|
|
int(11) |
|
785
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
|
|
786
|
|
|
int(11) |
|
787
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
788
|
|
|
tinyint(1) |
|
789
|
|
|
|
|
790
|
|
|
:rtype: * |
|
791
|
|
|
""" |
|
792
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_compound_job(%s, %s, %s, %s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master) |
|
|
|
|
|
|
793
|
|
|
|
|
794
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
795
|
|
|
@staticmethod |
|
796
|
|
|
def enk_reader_node_store_dynamic_inner_worker(p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master): |
|
|
|
|
|
|
797
|
|
|
""" |
|
798
|
|
|
Stores a node of type "dynamic inner worker" and selects the ID of the new node. |
|
799
|
|
|
|
|
800
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
801
|
|
|
smallint(5) unsigned |
|
802
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
803
|
|
|
int(10) unsigned |
|
804
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
|
805
|
|
|
int(10) unsigned |
|
806
|
|
|
:param str p_nod_name: The name of the node. |
|
807
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
808
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
|
809
|
|
|
int(11) |
|
810
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
|
|
811
|
|
|
int(11) |
|
812
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
813
|
|
|
tinyint(1) |
|
814
|
|
|
|
|
815
|
|
|
:rtype: * |
|
816
|
|
|
""" |
|
817
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_dynamic_inner_worker(%s, %s, %s, %s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master) |
|
|
|
|
|
|
818
|
|
|
|
|
819
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
820
|
|
|
@staticmethod |
|
821
|
|
|
def enk_reader_node_store_dynamic_job(p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master): |
|
|
|
|
|
|
822
|
|
|
""" |
|
823
|
|
|
Stores a node of type "dynamic job" and selects the ID of the new node. |
|
824
|
|
|
|
|
825
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
826
|
|
|
smallint(5) unsigned |
|
827
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
828
|
|
|
int(10) unsigned |
|
829
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
|
830
|
|
|
int(10) unsigned |
|
831
|
|
|
:param str p_nod_name: The name of the node. |
|
832
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
833
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
|
834
|
|
|
int(11) |
|
835
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
|
|
836
|
|
|
int(11) |
|
837
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
838
|
|
|
tinyint(1) |
|
839
|
|
|
|
|
840
|
|
|
:rtype: * |
|
841
|
|
|
""" |
|
842
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_dynamic_job(%s, %s, %s, %s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master) |
|
|
|
|
|
|
843
|
|
|
|
|
844
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
845
|
|
|
@staticmethod |
|
846
|
|
|
def enk_reader_node_store_dynamic_outer_worker(p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master): |
|
|
|
|
|
|
847
|
|
|
""" |
|
848
|
|
|
Stores a node of type "dynamic outer worker" and selects the ID of the new node. |
|
849
|
|
|
|
|
850
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
851
|
|
|
smallint(5) unsigned |
|
852
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
853
|
|
|
int(10) unsigned |
|
854
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
|
855
|
|
|
int(10) unsigned |
|
856
|
|
|
:param str p_nod_name: The name of the node. |
|
857
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
858
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
|
859
|
|
|
int(11) |
|
860
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
|
|
861
|
|
|
int(11) |
|
862
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
863
|
|
|
tinyint(1) |
|
864
|
|
|
|
|
865
|
|
|
:rtype: * |
|
866
|
|
|
""" |
|
867
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_dynamic_outer_worker(%s, %s, %s, %s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master) |
|
|
|
|
|
|
868
|
|
|
|
|
869
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
870
|
|
|
@staticmethod |
|
871
|
|
|
def enk_reader_node_store_manual_trigger(p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master): |
|
|
|
|
|
|
872
|
|
|
""" |
|
873
|
|
|
Stores a node of type "manual trigger" and selects the ID of the new node. |
|
874
|
|
|
|
|
875
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
876
|
|
|
smallint(5) unsigned |
|
877
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
878
|
|
|
int(10) unsigned |
|
879
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
|
880
|
|
|
int(10) unsigned |
|
881
|
|
|
:param str p_nod_name: The name of the node. |
|
882
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
883
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
|
884
|
|
|
int(11) |
|
885
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
|
|
886
|
|
|
int(11) |
|
887
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
888
|
|
|
tinyint(1) |
|
889
|
|
|
|
|
890
|
|
|
:rtype: * |
|
891
|
|
|
""" |
|
892
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_manual_trigger(%s, %s, %s, %s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master) |
|
|
|
|
|
|
893
|
|
|
|
|
894
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
895
|
|
|
@staticmethod |
|
896
|
|
|
def enk_reader_node_store_schedule(p_srv_id, p_uri_id, p_nod_name, p_nod_master): |
|
897
|
|
|
""" |
|
898
|
|
|
Stores a node of type "schedule" and selects the ID of the new node. |
|
899
|
|
|
|
|
900
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
901
|
|
|
smallint(5) unsigned |
|
902
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
903
|
|
|
int(10) unsigned |
|
904
|
|
|
:param str p_nod_name: The name of the node. |
|
905
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
906
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
907
|
|
|
tinyint(1) |
|
908
|
|
|
|
|
909
|
|
|
:rtype: * |
|
910
|
|
|
""" |
|
911
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_schedule(%s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_name, p_nod_master) |
|
|
|
|
|
|
912
|
|
|
|
|
913
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
914
|
|
|
@staticmethod |
|
915
|
|
|
def enk_reader_node_store_schedule_addendum(p_srv_id, p_nod_id_activate, p_nod_id_arrest, p_nod_id_schedule): |
|
916
|
|
|
""" |
|
917
|
|
|
Stores additional information of a schedule revision and selects the ID of the new node. |
|
918
|
|
|
|
|
919
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
920
|
|
|
smallint(5) unsigned |
|
921
|
|
|
:param int p_nod_id_activate: The ID of the activate node of the schedule. |
|
922
|
|
|
int(10) unsigned |
|
923
|
|
|
:param int p_nod_id_arrest: The ID of the arrest node of the schedule. |
|
924
|
|
|
int(10) unsigned |
|
925
|
|
|
:param int p_nod_id_schedule: The ID of the schedule node it self. |
|
926
|
|
|
int(10) unsigned |
|
927
|
|
|
|
|
928
|
|
|
:rtype: int |
|
929
|
|
|
""" |
|
930
|
|
|
return StaticDataLayer.execute_sp_none("call enk_reader_node_store_schedule_addendum(%s, %s, %s, %s)", p_srv_id, p_nod_id_activate, p_nod_id_arrest, p_nod_id_schedule) |
|
|
|
|
|
|
931
|
|
|
|
|
932
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
933
|
|
|
@staticmethod |
|
934
|
|
|
def enk_reader_node_store_terminator(p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master): |
|
|
|
|
|
|
935
|
|
|
""" |
|
936
|
|
|
Stores a node of type "terminator" and selects the ID of the new node. |
|
937
|
|
|
|
|
938
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
|
939
|
|
|
smallint(5) unsigned |
|
940
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
|
941
|
|
|
int(10) unsigned |
|
942
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
|
943
|
|
|
int(10) unsigned |
|
944
|
|
|
:param str p_nod_name: The name of the node. |
|
945
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
946
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
|
947
|
|
|
int(11) |
|
948
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
|
|
949
|
|
|
int(11) |
|
950
|
|
|
:param int p_nod_master: |
|
|
|
|
|
|
951
|
|
|
tinyint(1) |
|
952
|
|
|
|
|
953
|
|
|
:rtype: * |
|
954
|
|
|
""" |
|
955
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_node_store_terminator(%s, %s, %s, %s, %s, %s, %s)", p_srv_id, p_uri_id, p_nod_id_parent, p_nod_name, p_nod_recursion_level, p_nod_dependency_level, p_nod_master) |
|
|
|
|
|
|
956
|
|
|
|
|
957
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
958
|
|
|
@staticmethod |
|
959
|
|
|
def enk_reader_port_store_input_port(p_nod_id, p_uri_id, p_prt_name): |
|
960
|
|
|
""" |
|
961
|
|
|
Stores a port of type "InputPort" and selects the ID of the new port. |
|
962
|
|
|
|
|
963
|
|
|
:param int p_nod_id: The ID of the node of the node of the input port. |
|
964
|
|
|
int(10) unsigned |
|
965
|
|
|
:param int p_uri_id: The ID of the URI of the input port. |
|
966
|
|
|
int(10) unsigned |
|
967
|
|
|
:param str p_prt_name: The name of the input port. |
|
968
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
969
|
|
|
|
|
970
|
|
|
:rtype: * |
|
971
|
|
|
""" |
|
972
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_port_store_input_port(%s, %s, %s)", p_nod_id, p_uri_id, p_prt_name) |
|
|
|
|
|
|
973
|
|
|
|
|
974
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
975
|
|
|
@staticmethod |
|
976
|
|
|
def enk_reader_port_store_output_port(p_nod_id, p_uri_id, p_prt_name): |
|
977
|
|
|
""" |
|
978
|
|
|
Stores a port of type "OutputPort" and selects the ID of the new port. |
|
979
|
|
|
|
|
980
|
|
|
:param int p_nod_id: The ID of the node of the node of the output port. |
|
981
|
|
|
int(10) unsigned |
|
982
|
|
|
:param int p_uri_id: The ID of the URI of the output port. |
|
983
|
|
|
int(10) unsigned |
|
984
|
|
|
:param str p_prt_name: The name of the output port. |
|
985
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
986
|
|
|
|
|
987
|
|
|
:rtype: * |
|
988
|
|
|
""" |
|
989
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_port_store_output_port(%s, %s, %s)", p_nod_id, p_uri_id, p_prt_name) |
|
|
|
|
|
|
990
|
|
|
|
|
991
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
992
|
|
|
@staticmethod |
|
993
|
|
|
def enk_reader_resource_load_resource(p_rsc_id): |
|
994
|
|
|
""" |
|
995
|
|
|
Selects the details of a resource. |
|
996
|
|
|
|
|
997
|
|
|
:param int p_rsc_id: The ID of the resource. |
|
998
|
|
|
int(11) |
|
999
|
|
|
|
|
1000
|
|
|
:rtype: dict[str,*] |
|
1001
|
|
|
""" |
|
1002
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_reader_resource_load_resource(%s)", p_rsc_id) |
|
1003
|
|
|
|
|
1004
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
1005
|
|
|
@staticmethod |
|
1006
|
|
|
def enk_reader_resource_store_counting_resource(p_hst_id, p_nod_id, p_uri_id, p_rsc_name, p_rsc_amount): |
|
1007
|
|
|
""" |
|
1008
|
|
|
Stores a resource of type "CountingResource" and selects the ID of the new resource. |
|
1009
|
|
|
|
|
1010
|
|
|
:param int p_hst_id: The ID of the host of the resource. |
|
1011
|
|
|
smallint(5) unsigned |
|
1012
|
|
|
:param int p_nod_id: The ID of the node of the resource. |
|
1013
|
|
|
int(10) unsigned |
|
1014
|
|
|
:param int p_uri_id: The ID of the URI of the resource. |
|
1015
|
|
|
int(10) unsigned |
|
1016
|
|
|
:param str p_rsc_name: The name of the resource. |
|
1017
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
1018
|
|
|
:param int p_rsc_amount: The total available amount of this resource. |
|
1019
|
|
|
bigint(20) |
|
1020
|
|
|
|
|
1021
|
|
|
:rtype: * |
|
1022
|
|
|
""" |
|
1023
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_resource_store_counting_resource(%s, %s, %s, %s, %s)", p_hst_id, p_nod_id, p_uri_id, p_rsc_name, p_rsc_amount) |
|
|
|
|
|
|
1024
|
|
|
|
|
1025
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
1026
|
|
|
@staticmethod |
|
1027
|
|
|
def enk_reader_resource_store_read_write_lock_resource(p_hst_id, p_nod_id, p_uri_id, p_rsc_name): |
|
1028
|
|
|
""" |
|
1029
|
|
|
Stores a resource of type "ReadWriteLockResource" and selects the ID of the new resource. |
|
1030
|
|
|
|
|
1031
|
|
|
:param int p_hst_id: The ID of the host of the resource. |
|
1032
|
|
|
smallint(5) unsigned |
|
1033
|
|
|
:param int p_nod_id: The ID of the node of the resource. |
|
1034
|
|
|
int(10) unsigned |
|
1035
|
|
|
:param int p_uri_id: The ID of the URI of the resource. |
|
1036
|
|
|
int(10) unsigned |
|
1037
|
|
|
:param str p_rsc_name: The name of the resource. |
|
1038
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
1039
|
|
|
|
|
1040
|
|
|
:rtype: * |
|
1041
|
|
|
""" |
|
1042
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_resource_store_read_write_lock_resource(%s, %s, %s, %s)", p_hst_id, p_nod_id, p_uri_id, p_rsc_name) |
|
|
|
|
|
|
1043
|
|
|
|
|
1044
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
1045
|
|
|
@staticmethod |
|
1046
|
|
|
def enk_reader_schedule_create_revision(p_blb_id, p_node_name): |
|
1047
|
|
|
""" |
|
1048
|
|
|
Stores a node of type "schedule" and selects the ID of the new schedule revision. |
|
1049
|
|
|
If the schedule revision in ID is already loaded and up-to-date NULL is selected. |
|
1050
|
|
|
|
|
1051
|
|
|
:param int p_blb_id: The ID of the blob of the XML definition of the schedule. |
|
1052
|
|
|
int(10) unsigned |
|
1053
|
|
|
:param str p_node_name: The name of the schedule. |
|
1054
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
|
1055
|
|
|
|
|
1056
|
|
|
:rtype: * |
|
1057
|
|
|
""" |
|
1058
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_schedule_create_revision(%s, %s)", p_blb_id, p_node_name) |
|
|
|
|
|
|
1059
|
|
|
|
|
1060
|
|
|
|
|
1061
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
|
1062
|
|
|
|
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.