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_get_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: dict[str,*] |
271
|
|
|
""" |
272
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_back_run_node_get_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_get_current_xml(p_sch_id): |
388
|
|
|
""" |
389
|
|
|
Selects the XML definition of the current version of a schedule. |
390
|
|
|
|
391
|
|
|
:param int p_sch_id: The ID of the schedule. |
392
|
|
|
smallint(5) unsigned |
393
|
|
|
|
394
|
|
|
:rtype: * |
395
|
|
|
""" |
396
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_back_schedule_get_current_xml(%s)", p_sch_id) |
397
|
|
|
|
398
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
399
|
|
|
@staticmethod |
400
|
|
|
def enk_back_schedule_get_schedule(p_sch_id): |
401
|
|
|
""" |
402
|
|
|
Selects data of a schedule. |
403
|
|
|
|
404
|
|
|
:param int p_sch_id: The ID of the schedule. |
405
|
|
|
smallint(5) unsigned |
406
|
|
|
|
407
|
|
|
:rtype: dict[str,*] |
408
|
|
|
""" |
409
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_back_schedule_get_schedule(%s)", p_sch_id) |
410
|
|
|
|
411
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
412
|
|
|
@staticmethod |
413
|
|
|
def enk_back_schedule_revision_create_run(p_srv_id): |
414
|
|
|
""" |
415
|
|
|
Creates a new run for schedule revision p_srv_id. |
416
|
|
|
|
417
|
|
|
:param int p_srv_id: |
|
|
|
|
418
|
|
|
smallint(5) unsigned |
419
|
|
|
|
420
|
|
|
:rtype: * |
421
|
|
|
""" |
422
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_back_schedule_revision_create_run(%s)", p_srv_id) |
423
|
|
|
|
424
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
425
|
|
|
@staticmethod |
426
|
|
|
def enk_back_schedule_trigger(p_sch_id): |
427
|
|
|
""" |
428
|
|
|
Triggers a schedule. |
429
|
|
|
|
430
|
|
|
:param int p_sch_id: |
|
|
|
|
431
|
|
|
smallint(5) unsigned |
432
|
|
|
|
433
|
|
|
:rtype: * |
434
|
|
|
""" |
435
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_back_schedule_trigger(%s)", p_sch_id) |
436
|
|
|
|
437
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
438
|
|
|
@staticmethod |
439
|
|
|
def enk_blob_get_blob(p_blb_id): |
440
|
|
|
""" |
441
|
|
|
Selects the data of a BLOB. |
442
|
|
|
|
443
|
|
|
:param int p_blb_id: The ID of the BLOB. |
444
|
|
|
int(10) unsigned |
445
|
|
|
|
446
|
|
|
:rtype: dict[str,*] |
447
|
|
|
""" |
448
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_blob_get_blob(%s)", p_blb_id) |
449
|
|
|
|
450
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
451
|
|
|
@staticmethod |
452
|
|
|
def enk_blob_get_details(p_blb_id): |
453
|
|
|
""" |
454
|
|
|
Selects the details of a BLOB (but not the data). |
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_details(%s)", p_blb_id) |
462
|
|
|
|
463
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
464
|
|
|
@staticmethod |
465
|
|
|
def enk_blob_insert_blob(p_filename, p_mime_type, p_data): |
466
|
|
|
""" |
467
|
|
|
Inserts a BLOB and selects the ID of the BLOB. |
468
|
|
|
|
469
|
|
|
:param str p_filename: The filename associated with the BLOB. |
470
|
|
|
varchar(255) character set utf8 collation utf8_general_ci |
471
|
|
|
:param str p_mime_type: The mime type of the data. |
472
|
|
|
varchar(48) character set utf8 collation utf8_general_ci |
473
|
|
|
:param bytes p_data: The data of the BLOB. |
474
|
|
|
longblob |
475
|
|
|
|
476
|
|
|
:rtype: * |
477
|
|
|
""" |
478
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_blob_insert_blob(%s, %s, %s)", p_filename, p_mime_type, p_data) |
|
|
|
|
479
|
|
|
|
480
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
481
|
|
|
@staticmethod |
482
|
|
|
def enk_front_run_get_addendum(p_run_id): |
483
|
|
|
""" |
484
|
|
|
Selects the addendum of a schedule revision of a run. |
485
|
|
|
|
486
|
|
|
:param int p_run_id: The ID of the run. |
487
|
|
|
int(10) unsigned |
488
|
|
|
|
489
|
|
|
:rtype: dict[str,*] |
490
|
|
|
""" |
491
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_front_run_get_addendum(%s)", p_run_id) |
492
|
|
|
|
493
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
494
|
|
|
@staticmethod |
495
|
|
|
def enk_front_run_get_all_dependencies(p_srv_id): |
496
|
|
|
""" |
497
|
|
|
Selects all dependencies of all ports of all nodes of a schedule revision. |
498
|
|
|
|
499
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
500
|
|
|
smallint(5) unsigned |
501
|
|
|
|
502
|
|
|
:rtype: list[dict[str,*]] |
503
|
|
|
""" |
504
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_get_all_dependencies(%s)", p_srv_id) |
505
|
|
|
|
506
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
507
|
|
|
@staticmethod |
508
|
|
|
def enk_front_run_get_all_ports(p_run_id): |
509
|
|
|
""" |
510
|
|
|
Selects all ports of all nodes of a run. |
511
|
|
|
|
512
|
|
|
:param int p_run_id: The ID of the run |
513
|
|
|
int(10) unsigned |
514
|
|
|
|
515
|
|
|
:rtype: list[dict[str,*]] |
516
|
|
|
""" |
517
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_get_all_ports(%s)", p_run_id) |
518
|
|
|
|
519
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
520
|
|
|
@staticmethod |
521
|
|
|
def enk_front_run_get_all_run_nodes(p_run_id): |
522
|
|
|
""" |
523
|
|
|
Selects all nodes of a 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_run_nodes(%s)", p_run_id) |
531
|
|
|
|
532
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
533
|
|
|
@staticmethod |
534
|
|
|
def enk_front_run_node_get_consumptions(p_rnd_id): |
535
|
|
|
""" |
536
|
|
|
Selects all consumptions of a run node. |
537
|
|
|
|
538
|
|
|
:param int p_rnd_id: |
|
|
|
|
539
|
|
|
int(11) |
540
|
|
|
|
541
|
|
|
:rtype: list[dict[str,*]] |
542
|
|
|
""" |
543
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_node_get_consumptions(%s)", p_rnd_id) |
544
|
|
|
|
545
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
546
|
|
|
@staticmethod |
547
|
|
|
def enk_front_run_node_get_logs(p_rnd_id): |
548
|
|
|
""" |
549
|
|
|
Selects all logs 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_logs(%s)", p_rnd_id) |
557
|
|
|
|
558
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
559
|
|
|
@staticmethod |
560
|
|
|
def enk_front_run_node_get_resources(p_rnd_id): |
561
|
|
|
""" |
562
|
|
|
Selects all resources of a node. |
563
|
|
|
|
564
|
|
|
:param int p_rnd_id: The ID of the node. |
565
|
|
|
int(11) |
566
|
|
|
|
567
|
|
|
:rtype: list[dict[str,*]] |
568
|
|
|
""" |
569
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_node_get_resources(%s)", p_rnd_id) |
570
|
|
|
|
571
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
572
|
|
|
@staticmethod |
573
|
|
|
def enk_front_run_node_get_status(p_rnd_id): |
574
|
|
|
""" |
575
|
|
|
Selects current status of a run node. |
576
|
|
|
|
577
|
|
|
:param int p_rnd_id: The ID of the run node. |
578
|
|
|
int(11) |
579
|
|
|
|
580
|
|
|
:rtype: dict[str,*] |
581
|
|
|
""" |
582
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_front_run_node_get_status(%s)", p_rnd_id) |
583
|
|
|
|
584
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
585
|
|
|
@staticmethod |
586
|
|
|
def enk_front_run_node_get_status_change(p_run_id, p_nsc_id): |
587
|
|
|
""" |
588
|
|
|
Selects all node status changes of a run after a run node status change. |
589
|
|
|
|
590
|
|
|
:param int p_run_id: The ID of the run. |
591
|
|
|
int(10) unsigned |
592
|
|
|
:param int p_nsc_id: The ID of the node status change. |
593
|
|
|
int(10) unsigned |
594
|
|
|
|
595
|
|
|
:rtype: list[dict[str,*]] |
596
|
|
|
""" |
597
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_run_node_get_status_change(%s, %s)", p_run_id, p_nsc_id) |
598
|
|
|
|
599
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
600
|
|
|
@staticmethod |
601
|
|
|
def enk_front_schedule_get_all(): |
602
|
|
|
""" |
603
|
|
|
Selects all schedules. |
604
|
|
|
|
605
|
|
|
:rtype: list[dict[str,*]] |
606
|
|
|
""" |
607
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_schedule_get_all()") |
608
|
|
|
|
609
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
610
|
|
|
@staticmethod |
611
|
|
|
def enk_front_schedule_get_all_runs(p_sch_id): |
612
|
|
|
""" |
613
|
|
|
Selects all runs of a schedule. |
614
|
|
|
|
615
|
|
|
:param int p_sch_id: The ID of the schedule. |
616
|
|
|
smallint(5) unsigned |
617
|
|
|
|
618
|
|
|
:rtype: list[dict[str,*]] |
619
|
|
|
""" |
620
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_front_schedule_get_all_runs(%s)", p_sch_id) |
621
|
|
|
|
622
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
623
|
|
|
@staticmethod |
624
|
|
|
def enk_misc_insert_uri(p_uri_uri): |
625
|
|
|
""" |
626
|
|
|
Selects the ID of an URI. If the URI doesn't exists it will be inserted. |
627
|
|
|
|
628
|
|
|
:param str p_uri_uri: The URI. |
629
|
|
|
varchar(4000) character set ascii collation ascii_general_ci |
630
|
|
|
|
631
|
|
|
:rtype: * |
632
|
|
|
""" |
633
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_misc_insert_uri(%s)", p_uri_uri) |
634
|
|
|
|
635
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
636
|
|
|
@staticmethod |
637
|
|
|
def enk_reader_consumption_store_counting_consumption(p_nod_id, p_rsc_id, p_uri_id, p_cns_amount): |
638
|
|
|
""" |
639
|
|
|
Stores a consumption of type "ReadWriteLockConsumption" and selects the @c cns_id of the new consumption. |
640
|
|
|
|
641
|
|
|
:param int p_nod_id: The ID of the node of that will make consumption. |
642
|
|
|
int(10) unsigned |
643
|
|
|
:param int p_rsc_id: The ID of the resource that will be consumpted. |
644
|
|
|
int(11) |
645
|
|
|
:param int p_uri_id: The ID of the URI of the consumption. |
646
|
|
|
int(10) unsigned |
647
|
|
|
:param int p_cns_amount: The amount that will be consumpted. |
648
|
|
|
bigint(20) |
649
|
|
|
|
650
|
|
|
:rtype: * |
651
|
|
|
""" |
652
|
|
|
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) |
|
|
|
|
653
|
|
|
|
654
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
655
|
|
|
@staticmethod |
656
|
|
|
def enk_reader_consumption_store_read_write_lock_consumption(p_nod_id, p_rsc_id, p_rws_id, p_uri_id): |
657
|
|
|
""" |
658
|
|
|
Stores a consumption of type "ReadWriteLockConsumption" and selects the ID of the new consumption. |
659
|
|
|
|
660
|
|
|
:param int p_nod_id: The ID of the node that will make consumption. |
661
|
|
|
int(10) unsigned |
662
|
|
|
:param int p_rsc_id: The ID of the resource that will be consumpted. |
663
|
|
|
int(11) |
664
|
|
|
:param int p_rws_id: The RW status of the consumption. |
665
|
|
|
tinyint(3) unsigned |
666
|
|
|
:param int p_uri_id: The ID of the URI of the consumption. |
667
|
|
|
int(10) unsigned |
668
|
|
|
|
669
|
|
|
:rtype: * |
670
|
|
|
""" |
671
|
|
|
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) |
|
|
|
|
672
|
|
|
|
673
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
674
|
|
|
@staticmethod |
675
|
|
|
def enk_reader_dependency_store_dependency(p_prt_id_dependant, p_prt_id_predecessor): |
676
|
|
|
""" |
677
|
|
|
Stores a dependency between two ports. |
678
|
|
|
|
679
|
|
|
:param int p_prt_id_dependant: The ID of the dependant port |
680
|
|
|
int(10) unsigned |
681
|
|
|
:param int p_prt_id_predecessor: The ID of the predecessor port. |
682
|
|
|
int(10) unsigned |
683
|
|
|
|
684
|
|
|
:rtype: int |
685
|
|
|
""" |
686
|
|
|
return StaticDataLayer.execute_sp_none("call enk_reader_dependency_store_dependency(%s, %s)", p_prt_id_dependant, p_prt_id_predecessor) |
|
|
|
|
687
|
|
|
|
688
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
689
|
|
|
@staticmethod |
690
|
|
|
def enk_reader_host_load_host(p_hst_name): |
691
|
|
|
""" |
692
|
|
|
Selects the details of a host. |
693
|
|
|
|
694
|
|
|
:param str p_hst_name: The hostname. |
695
|
|
|
varchar(64) character set utf8 collation utf8_general_ci |
696
|
|
|
|
697
|
|
|
:rtype: dict[str,*] |
698
|
|
|
""" |
699
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_reader_host_load_host(%s)", p_hst_name) |
700
|
|
|
|
701
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
702
|
|
|
@staticmethod |
703
|
|
|
def enk_reader_host_load_resources(p_hst_id): |
704
|
|
|
""" |
705
|
|
|
Selects the resources of a host. |
706
|
|
|
|
707
|
|
|
:param int p_hst_id: The ID of the host. |
708
|
|
|
smallint(5) unsigned |
709
|
|
|
|
710
|
|
|
:rtype: list[dict[str,*]] |
711
|
|
|
""" |
712
|
|
|
return StaticDataLayer.execute_sp_rows("call enk_reader_host_load_resources(%s)", p_hst_id) |
713
|
|
|
|
714
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
715
|
|
|
@staticmethod |
716
|
|
|
def enk_reader_host_store_host(p_hst_name): |
717
|
|
|
""" |
718
|
|
|
Stores a host and selects the IF of the host. |
719
|
|
|
|
720
|
|
|
:param str p_hst_name: The hostname. |
721
|
|
|
varchar(64) character set utf8 collation utf8_general_ci |
722
|
|
|
|
723
|
|
|
:rtype: * |
724
|
|
|
""" |
725
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_host_store_host(%s)", p_hst_name) |
726
|
|
|
|
727
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
728
|
|
|
@staticmethod |
729
|
|
|
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): |
|
|
|
|
730
|
|
|
""" |
731
|
|
|
Stores a node of type "command job" and selects the ID of the new node. |
732
|
|
|
|
733
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
734
|
|
|
smallint(5) unsigned |
735
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
736
|
|
|
int(10) unsigned |
737
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
738
|
|
|
int(10) unsigned |
739
|
|
|
:param str p_nod_name: The name of the node. |
740
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
741
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
742
|
|
|
int(11) |
743
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
744
|
|
|
int(11) |
745
|
|
|
:param str p_nod_user_name: The account under which the command must run. |
746
|
|
|
varchar(32) character set utf8 collation utf8_general_ci |
747
|
|
|
:param str p_nod_command: The command that must be executed (serialized array). |
748
|
|
|
varchar(1000) character set utf8 collation utf8_general_ci |
749
|
|
|
:param int p_nod_master: |
|
|
|
|
750
|
|
|
tinyint(1) |
751
|
|
|
|
752
|
|
|
:rtype: * |
753
|
|
|
""" |
754
|
|
|
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) |
|
|
|
|
755
|
|
|
|
756
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
757
|
|
|
@staticmethod |
758
|
|
|
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): |
|
|
|
|
759
|
|
|
""" |
760
|
|
|
Stores a node of type "compound job" and selects the ID of the new node. |
761
|
|
|
|
762
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
763
|
|
|
smallint(5) unsigned |
764
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
765
|
|
|
int(10) unsigned |
766
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
767
|
|
|
int(10) unsigned |
768
|
|
|
:param str p_nod_name: The name of the node. |
769
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
770
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
771
|
|
|
int(11) |
772
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
773
|
|
|
int(11) |
774
|
|
|
:param int p_nod_master: |
|
|
|
|
775
|
|
|
tinyint(1) |
776
|
|
|
|
777
|
|
|
:rtype: * |
778
|
|
|
""" |
779
|
|
|
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) |
|
|
|
|
780
|
|
|
|
781
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
782
|
|
|
@staticmethod |
783
|
|
|
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): |
|
|
|
|
784
|
|
|
""" |
785
|
|
|
Stores a node of type "dynamic inner worker" and selects the ID of the new node. |
786
|
|
|
|
787
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
788
|
|
|
smallint(5) unsigned |
789
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
790
|
|
|
int(10) unsigned |
791
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
792
|
|
|
int(10) unsigned |
793
|
|
|
:param str p_nod_name: The name of the node. |
794
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
795
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
796
|
|
|
int(11) |
797
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
798
|
|
|
int(11) |
799
|
|
|
:param int p_nod_master: |
|
|
|
|
800
|
|
|
tinyint(1) |
801
|
|
|
|
802
|
|
|
:rtype: * |
803
|
|
|
""" |
804
|
|
|
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) |
|
|
|
|
805
|
|
|
|
806
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
807
|
|
|
@staticmethod |
808
|
|
|
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): |
|
|
|
|
809
|
|
|
""" |
810
|
|
|
Stores a node of type "dynamic job" and selects the ID of the new node. |
811
|
|
|
|
812
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
813
|
|
|
smallint(5) unsigned |
814
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
815
|
|
|
int(10) unsigned |
816
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
817
|
|
|
int(10) unsigned |
818
|
|
|
:param str p_nod_name: The name of the node. |
819
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
820
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
821
|
|
|
int(11) |
822
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
823
|
|
|
int(11) |
824
|
|
|
:param int p_nod_master: |
|
|
|
|
825
|
|
|
tinyint(1) |
826
|
|
|
|
827
|
|
|
:rtype: * |
828
|
|
|
""" |
829
|
|
|
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) |
|
|
|
|
830
|
|
|
|
831
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
832
|
|
|
@staticmethod |
833
|
|
|
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): |
|
|
|
|
834
|
|
|
""" |
835
|
|
|
Stores a node of type "dynamic outer worker" and selects the ID of the new node. |
836
|
|
|
|
837
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
838
|
|
|
smallint(5) unsigned |
839
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
840
|
|
|
int(10) unsigned |
841
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
842
|
|
|
int(10) unsigned |
843
|
|
|
:param str p_nod_name: The name of the node. |
844
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
845
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
846
|
|
|
int(11) |
847
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
848
|
|
|
int(11) |
849
|
|
|
:param int p_nod_master: |
|
|
|
|
850
|
|
|
tinyint(1) |
851
|
|
|
|
852
|
|
|
:rtype: * |
853
|
|
|
""" |
854
|
|
|
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) |
|
|
|
|
855
|
|
|
|
856
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
857
|
|
|
@staticmethod |
858
|
|
|
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): |
|
|
|
|
859
|
|
|
""" |
860
|
|
|
Stores a node of type "manual trigger" and selects the ID of the new node. |
861
|
|
|
|
862
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
863
|
|
|
smallint(5) unsigned |
864
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
865
|
|
|
int(10) unsigned |
866
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
867
|
|
|
int(10) unsigned |
868
|
|
|
:param str p_nod_name: The name of the node. |
869
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
870
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
871
|
|
|
int(11) |
872
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
873
|
|
|
int(11) |
874
|
|
|
:param int p_nod_master: |
|
|
|
|
875
|
|
|
tinyint(1) |
876
|
|
|
|
877
|
|
|
:rtype: * |
878
|
|
|
""" |
879
|
|
|
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) |
|
|
|
|
880
|
|
|
|
881
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
882
|
|
|
@staticmethod |
883
|
|
|
def enk_reader_node_store_schedule(p_srv_id, p_uri_id, p_nod_name, p_nod_master): |
884
|
|
|
""" |
885
|
|
|
Stores a node of type "schedule" and selects the ID of the new node. |
886
|
|
|
|
887
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
888
|
|
|
smallint(5) unsigned |
889
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
890
|
|
|
int(10) unsigned |
891
|
|
|
:param str p_nod_name: The name of the node. |
892
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
893
|
|
|
:param int p_nod_master: |
|
|
|
|
894
|
|
|
tinyint(1) |
895
|
|
|
|
896
|
|
|
:rtype: * |
897
|
|
|
""" |
898
|
|
|
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) |
|
|
|
|
899
|
|
|
|
900
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
901
|
|
|
@staticmethod |
902
|
|
|
def enk_reader_node_store_schedule_addendum(p_srv_id, p_nod_id_activate, p_nod_id_arrest, p_nod_id_schedule): |
903
|
|
|
""" |
904
|
|
|
Stores additional information of a schedule revision and selects the ID of the new node. |
905
|
|
|
|
906
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
907
|
|
|
smallint(5) unsigned |
908
|
|
|
:param int p_nod_id_activate: The ID of the activate node of the schedule. |
909
|
|
|
int(10) unsigned |
910
|
|
|
:param int p_nod_id_arrest: The ID of the arrest node of the schedule. |
911
|
|
|
int(10) unsigned |
912
|
|
|
:param int p_nod_id_schedule: The ID of the schedule node it self. |
913
|
|
|
int(10) unsigned |
914
|
|
|
|
915
|
|
|
:rtype: int |
916
|
|
|
""" |
917
|
|
|
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) |
|
|
|
|
918
|
|
|
|
919
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
920
|
|
|
@staticmethod |
921
|
|
|
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): |
|
|
|
|
922
|
|
|
""" |
923
|
|
|
Stores a node of type "terminator" and selects the ID of the new node. |
924
|
|
|
|
925
|
|
|
:param int p_srv_id: The ID of the schedule revision. |
926
|
|
|
smallint(5) unsigned |
927
|
|
|
:param int p_uri_id: The ID of the URI of the node. |
928
|
|
|
int(10) unsigned |
929
|
|
|
:param int p_nod_id_parent: The ID of parent node of the node. |
930
|
|
|
int(10) unsigned |
931
|
|
|
:param str p_nod_name: The name of the node. |
932
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
933
|
|
|
:param int p_nod_recursion_level: The recursion level (i.e. the number of parents). |
934
|
|
|
int(11) |
935
|
|
|
:param int p_nod_dependency_level: The dependency level (i.e. the number of dependencies from the parent input ports). |
|
|
|
|
936
|
|
|
int(11) |
937
|
|
|
:param int p_nod_master: |
|
|
|
|
938
|
|
|
tinyint(1) |
939
|
|
|
|
940
|
|
|
:rtype: * |
941
|
|
|
""" |
942
|
|
|
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) |
|
|
|
|
943
|
|
|
|
944
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
945
|
|
|
@staticmethod |
946
|
|
|
def enk_reader_port_store_input_port(p_nod_id, p_uri_id, p_prt_name): |
947
|
|
|
""" |
948
|
|
|
Stores a port of type "InputPort" and selects the ID of the new port. |
949
|
|
|
|
950
|
|
|
:param int p_nod_id: The ID of the node of the node of the input port. |
951
|
|
|
int(10) unsigned |
952
|
|
|
:param int p_uri_id: The ID of the URI of the input port. |
953
|
|
|
int(10) unsigned |
954
|
|
|
:param str p_prt_name: The name of the input port. |
955
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
956
|
|
|
|
957
|
|
|
:rtype: * |
958
|
|
|
""" |
959
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_port_store_input_port(%s, %s, %s)", p_nod_id, p_uri_id, p_prt_name) |
|
|
|
|
960
|
|
|
|
961
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
962
|
|
|
@staticmethod |
963
|
|
|
def enk_reader_port_store_output_port(p_nod_id, p_uri_id, p_prt_name): |
964
|
|
|
""" |
965
|
|
|
Stores a port of type "OutputPort" and selects the ID of the new port. |
966
|
|
|
|
967
|
|
|
:param int p_nod_id: The ID of the node of the node of the output port. |
968
|
|
|
int(10) unsigned |
969
|
|
|
:param int p_uri_id: The ID of the URI of the output port. |
970
|
|
|
int(10) unsigned |
971
|
|
|
:param str p_prt_name: The name of the output port. |
972
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
973
|
|
|
|
974
|
|
|
:rtype: * |
975
|
|
|
""" |
976
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_port_store_output_port(%s, %s, %s)", p_nod_id, p_uri_id, p_prt_name) |
|
|
|
|
977
|
|
|
|
978
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
979
|
|
|
@staticmethod |
980
|
|
|
def enk_reader_resource_load_resource(p_rsc_id): |
981
|
|
|
""" |
982
|
|
|
Selects the details of a resource. |
983
|
|
|
|
984
|
|
|
:param int p_rsc_id: The ID of the resource. |
985
|
|
|
int(11) |
986
|
|
|
|
987
|
|
|
:rtype: dict[str,*] |
988
|
|
|
""" |
989
|
|
|
return StaticDataLayer.execute_sp_row1("call enk_reader_resource_load_resource(%s)", p_rsc_id) |
990
|
|
|
|
991
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
992
|
|
|
@staticmethod |
993
|
|
|
def enk_reader_resource_store_counting_resource(p_hst_id, p_nod_id, p_uri_id, p_rsc_name, p_rsc_amount): |
994
|
|
|
""" |
995
|
|
|
Stores a resource of type "CountingResource" and selects the ID of the new resource. |
996
|
|
|
|
997
|
|
|
:param int p_hst_id: The ID of the host of the resource. |
998
|
|
|
smallint(5) unsigned |
999
|
|
|
:param int p_nod_id: The ID of the node of the resource. |
1000
|
|
|
int(10) unsigned |
1001
|
|
|
:param int p_uri_id: The ID of the URI of the resource. |
1002
|
|
|
int(10) unsigned |
1003
|
|
|
:param str p_rsc_name: The name of the resource. |
1004
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
1005
|
|
|
:param int p_rsc_amount: The total available amount of this resource. |
1006
|
|
|
bigint(20) |
1007
|
|
|
|
1008
|
|
|
:rtype: * |
1009
|
|
|
""" |
1010
|
|
|
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) |
|
|
|
|
1011
|
|
|
|
1012
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
1013
|
|
|
@staticmethod |
1014
|
|
|
def enk_reader_resource_store_read_write_lock_resource(p_hst_id, p_nod_id, p_uri_id, p_rsc_name): |
1015
|
|
|
""" |
1016
|
|
|
Stores a resource of type "ReadWriteLockResource" and selects the ID of the new resource. |
1017
|
|
|
|
1018
|
|
|
:param int p_hst_id: The ID of the host of the resource. |
1019
|
|
|
smallint(5) unsigned |
1020
|
|
|
:param int p_nod_id: The ID of the node of the resource. |
1021
|
|
|
int(10) unsigned |
1022
|
|
|
:param int p_uri_id: The ID of the URI of the resource. |
1023
|
|
|
int(10) unsigned |
1024
|
|
|
:param str p_rsc_name: The name of the resource. |
1025
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
1026
|
|
|
|
1027
|
|
|
:rtype: * |
1028
|
|
|
""" |
1029
|
|
|
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) |
|
|
|
|
1030
|
|
|
|
1031
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
1032
|
|
|
@staticmethod |
1033
|
|
|
def enk_reader_schedule_create_revision(p_blb_id, p_node_name): |
1034
|
|
|
""" |
1035
|
|
|
Stores a node of type "schedule" and selects the ID of the new schedule revision. |
1036
|
|
|
If the schedule revision in ID is already loaded and up-to-date NULL is selected. |
1037
|
|
|
|
1038
|
|
|
:param int p_blb_id: The ID of the blob of the XML definition of the schedule. |
1039
|
|
|
int(10) unsigned |
1040
|
|
|
:param str p_node_name: The name of the schedule. |
1041
|
|
|
varchar(64) character set ascii collation ascii_general_ci |
1042
|
|
|
|
1043
|
|
|
:rtype: * |
1044
|
|
|
""" |
1045
|
|
|
return StaticDataLayer.execute_sp_singleton1("call enk_reader_schedule_create_revision(%s, %s)", p_blb_id, p_node_name) |
|
|
|
|
1046
|
|
|
|
1047
|
|
|
|
1048
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
1049
|
|
|
|
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.