@platforma-sdk/workflow-tengo 4.7.2 → 4.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/tengo/lib/exec.lib.tengo +23 -3
  2. package/dist/tengo/lib/pframes.lib.tengo +16 -0
  3. package/dist/tengo/lib/pframes.xsv-builder.lib.tengo +88 -2
  4. package/dist/tengo/lib/pframes.xsv-import-file.lib.tengo +54 -6
  5. package/dist/tengo/lib/pframes.xsv.lib.tengo +24 -1
  6. package/dist/tengo/lib/pt.lib.tengo +72 -1
  7. package/dist/tengo/tpl/check_network.create_workdir_from_storage.plj.gz +0 -0
  8. package/dist/tengo/tpl/check_network.download_blob.plj.gz +0 -0
  9. package/dist/tengo/tpl/check_network.run_hello_world.plj.gz +0 -0
  10. package/dist/tengo/tpl/check_network.run_hello_world_py.plj.gz +0 -0
  11. package/dist/tengo/tpl/check_network.upload_blob.plj.gz +0 -0
  12. package/dist/tengo/tpl/check_network.upload_template.plj.gz +0 -0
  13. package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
  14. package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
  15. package/dist/tengo/tpl/exec.monetization_info.plj.gz +0 -0
  16. package/dist/tengo/tpl/exec.monetization_to_json.plj.gz +0 -0
  17. package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
  18. package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
  19. package/dist/tengo/tpl/exec.python.venv-bin-path.plj.gz +0 -0
  20. package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
  21. package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
  22. package/dist/tengo/tpl/pframes.export-pframe-for-ui.plj.gz +0 -0
  23. package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
  24. package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
  25. package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
  26. package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
  27. package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
  28. package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
  29. package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
  30. package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
  31. package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
  32. package/dist/tengo/tpl/waiter.waiter.plj.gz +0 -0
  33. package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
  34. package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
  35. package/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
  36. package/package.json +2 -2
@@ -219,6 +219,16 @@ builder := func() {
219
219
 
220
220
 
221
221
 
222
+
223
+
224
+ setQueue: func(newQueue) {
225
+ queue = newQueue
226
+ return self
227
+ },
228
+
229
+
230
+
231
+
222
232
  inHeavyQueue: func() {
223
233
  queue = execConstants.HEAVY_QUEUE
224
234
  return self
@@ -272,9 +282,9 @@ builder := func() {
272
282
 
273
283
 
274
284
 
275
- ram: func(amount) {
276
- validation.assertType(amount, ["or", "number", "string"], "exec.builder.ram: RAM amount should be a number or string")
277
- ll.assert(is_string(amount) || amount > 0, "exec.builder.ram: amount in bytes should be greater than 0")
285
+ mem: func(amount) {
286
+ validation.assertType(amount, ["or", "number", "string"], "exec.builder.mem: RAM amount should be a number or string")
287
+ ll.assert(is_string(amount) || amount > 0, "exec.builder.mem: amount in bytes should be greater than 0")
278
288
  ramRequest = amount
279
289
 
280
290
  return self
@@ -285,6 +295,16 @@ builder := func() {
285
295
 
286
296
 
287
297
 
298
+ ram: func(amount) {
299
+ self.mem(amount)
300
+ return self
301
+ },
302
+
303
+
304
+
305
+
306
+
307
+
288
308
 
289
309
  cache: func(time) {
290
310
  ll.assert(
@@ -174,6 +174,12 @@ __primitiveValueTypes := { "Int": true, "Long": true, "Float": true, "Double": t
174
174
 
175
175
 
176
176
 
177
+
178
+
179
+
180
+
181
+
182
+
177
183
 
178
184
 
179
185
 
@@ -236,6 +242,16 @@ processColumn := func(input, bodyTpl, outputs, ...opts) {
236
242
  passKey: opts.passKey
237
243
  }
238
244
 
245
+ if !is_undefined(opts.cpu) {
246
+ processTemplateParams.cpu = opts.cpu
247
+ }
248
+ if !is_undefined(opts.mem) {
249
+ processTemplateParams.mem = opts.mem
250
+ }
251
+ if !is_undefined(opts.queue) {
252
+ processTemplateParams.queue = opts.queue
253
+ }
254
+
239
255
 
240
256
 
241
257
  isPotentiallyPartitioned := __primitiveValueTypes[input.spec.valueType]
@@ -5,6 +5,7 @@ pSpec := import("@platforma-sdk/workflow-tengo:pframes.spec")
5
5
  pBuilder := import("@platforma-sdk/workflow-tengo:pframes.builder")
6
6
  xsv := import("@platforma-sdk/workflow-tengo:pframes.xsv")
7
7
  canonical := import("@platforma-sdk/workflow-tengo:canonical")
8
+ execConstants := import("@platforma-sdk/workflow-tengo:exec.constants")
8
9
 
9
10
  xsvFileBuilder := func(xsvType) {
10
11
  ll.assert(xsvType == "csv" || xsvType == "tsv", "xsvType must be 'csv' or 'tsv'")
@@ -19,6 +20,10 @@ xsvFileBuilder := func(xsvType) {
19
20
  nextSequentialId := 1
20
21
  nextPFrameKeyIndex := 1
21
22
 
23
+ cpu := undefined
24
+ mem := undefined
25
+ queue := undefined
26
+
22
27
  getSpecDistiller := func() {
23
28
  if is_undefined(distiller) {
24
29
  columnsToDistill := []
@@ -322,6 +327,64 @@ xsvFileBuilder := func(xsvType) {
322
327
 
323
328
 
324
329
 
330
+ inHeavyQueue: func() {
331
+ queue = execConstants.HEAVY_QUEUE
332
+ return self
333
+ },
334
+
335
+
336
+
337
+
338
+ inMediumQueue: func() {
339
+ queue = execConstants.MEDIUM_QUEUE
340
+ return self
341
+ },
342
+
343
+
344
+
345
+
346
+ inLightQueue: func() {
347
+ queue = execConstants.LIGHT_QUEUE
348
+ return self
349
+ },
350
+
351
+
352
+
353
+
354
+ inUiQueue: func() {
355
+ queue = execConstants.UI_TASKS_QUEUE
356
+ return self
357
+ },
358
+
359
+
360
+
361
+
362
+
363
+
364
+ cpu: func(amount) {
365
+ cpu = amount
366
+ return self
367
+ },
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+ mem: func(amount) {
381
+ mem = amount
382
+ return self
383
+ },
384
+
385
+
386
+
387
+
325
388
 
326
389
 
327
390
 
@@ -548,7 +611,19 @@ xsvFileBuilder := func(xsvType) {
548
611
  }
549
612
 
550
613
  pFrame := _constructPFrameAndDistillSpecs().pFrame
551
- return xsv.exportFrame(pFrame, xsvType, currentExportParams)
614
+
615
+ ops := {}
616
+ if !is_undefined(cpu) {
617
+ ops.cpu = cpu
618
+ }
619
+ if !is_undefined(mem) {
620
+ ops.mem = mem
621
+ }
622
+ if !is_undefined(queue) {
623
+ ops.queue = queue
624
+ }
625
+
626
+ return xsv.exportFrame(pFrame, xsvType, currentExportParams, ops)
552
627
  },
553
628
 
554
629
 
@@ -586,7 +661,18 @@ xsvFileBuilder := func(xsvType) {
586
661
  pFrame := buildOutput.pFrame
587
662
  uniqueAxes := buildOutput.uniqueAxes
588
663
 
589
- tableResource := xsv.exportFrame(pFrame, xsvType, finalExportParams)
664
+ ops := {}
665
+ if !is_undefined(cpu) {
666
+ ops.cpu = cpu
667
+ }
668
+ if !is_undefined(mem) {
669
+ ops.mem = mem
670
+ }
671
+ if !is_undefined(queue) {
672
+ ops.queue = queue
673
+ }
674
+
675
+ tableResource := xsv.exportFrame(pFrame, xsvType, finalExportParams, ops)
590
676
 
591
677
  schema := []
592
678
 
@@ -6,6 +6,7 @@ objects := import("@platforma-sdk/workflow-tengo:objects")
6
6
  util := import("@platforma-sdk/workflow-tengo:pframes.util")
7
7
  json := import("json")
8
8
  constants := import("@platforma-sdk/workflow-tengo:pframes.constants")
9
+ execConstants := import("@platforma-sdk/workflow-tengo:exec.constants")
9
10
 
10
11
  transposeXsvSw := assets.importSoftware("@platforma-open/milaboratories.software-small-binaries:table-converter")
11
12
  pfconvSw := assets.importSoftware("@milaboratories/software-pframes-conv:main")
@@ -52,6 +53,34 @@ getColumnSpec := func(axesSpec, col) {
52
53
 
53
54
 
54
55
 
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
55
84
  importFile := func(xsvFile, xsvType, spec, ...ops) {
56
85
  ll.assert(xsvType == "csv" || xsvType == "tsv", "expected one of [tsv, csv] types, found: " + xsvType)
57
86
 
@@ -67,7 +96,7 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
67
96
 
68
97
  xsvFileName := "file." + xsvType
69
98
 
70
- ops := renderOps({ dataOnly: false, splitDataAndSpec: false }, ops...)
99
+ ops := renderOps({ dataOnly: false, splitDataAndSpec: false, queue: execConstants.LIGHT_QUEUE }, ops...)
71
100
 
72
101
  if ops.transpose != undefined {
73
102
 
@@ -78,8 +107,17 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
78
107
 
79
108
  transposeXsv := exec.builder().
80
109
  software(transposeXsvSw).
81
- printErrStreamToStdout().
82
- inLightQueue()
110
+ printErrStreamToStdout()
111
+
112
+ if ops.queue != undefined {
113
+ transposeXsv.setQueue(ops.queue)
114
+ }
115
+ if ops.cpu != undefined {
116
+ transposeXsv.cpu(ops.cpu)
117
+ }
118
+ if ops.mem != undefined {
119
+ transposeXsv.mem(ops.mem)
120
+ }
83
121
 
84
122
  if (tops.separator != undefined) {
85
123
  transposeXsv = transposeXsv.arg("-input-separator").arg(tops.separator)
@@ -126,15 +164,25 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
126
164
  pfconv := exec.builder().
127
165
  software(pfconvSw).
128
166
  printErrStreamToStdout().
129
- inLightQueue().
130
167
  arg("importCsv").
131
168
  arg(xsvFileName).
132
169
  arg("-p").arg("spec.json").
133
170
  arg("-o").arg("out").
134
171
  addFile(xsvFileName, xsvFile).
135
172
  writeFile("spec.json", json.encode(pureSpec)).
136
- processWorkdir("pf", importDirTpl, pureSpec).
137
- run()
173
+ processWorkdir("pf", importDirTpl, pureSpec)
174
+
175
+ if ops.queue != undefined {
176
+ pfconv.setQueue(ops.queue)
177
+ }
178
+ if ops.cpu != undefined {
179
+ pfconv.cpu(ops.cpu)
180
+ }
181
+ if ops.mem != undefined {
182
+ pfconv.mem(ops.mem)
183
+ }
184
+
185
+ pfconv = pfconv.run()
138
186
 
139
187
 
140
188
  pf := pfconv.getProcessorResult("pf")
@@ -80,6 +80,9 @@ getColumnSpec := func(axesSpec, col) {
80
80
 
81
81
 
82
82
 
83
+
84
+
85
+
83
86
 
84
87
 
85
88
 
@@ -133,6 +136,9 @@ importFile := func(xsvFile, xsvType, spec, ...ops) {
133
136
 
134
137
 
135
138
 
139
+
140
+
141
+
136
142
 
137
143
 
138
144
 
@@ -153,11 +159,25 @@ importFileMap := func(xsvMap, xsvType, spec, ...ops) {
153
159
  pureSpec := decomposedSpec.purifiedCfg
154
160
  columnsSpec := decomposedSpec.columnsSpec
155
161
 
162
+ templateOps := {
163
+ dataOnly: true,
164
+ transpose: ops.transpose
165
+ }
166
+ if !is_undefined(ops.cpu) {
167
+ templateOps.cpu = ops.cpu
168
+ }
169
+ if !is_undefined(ops.mem) {
170
+ templateOps.mem = ops.mem
171
+ }
172
+ if !is_undefined(ops.queue) {
173
+ templateOps.queue = ops.queue
174
+ }
175
+
156
176
  r := render.createEphemeral(importXsvMapTpl, {
157
177
  xsvMap: xsvMap,
158
178
  xsvType: xsvType,
159
179
  spec: pureSpec,
160
- ops: { dataOnly: true, transpose: ops.transpose }
180
+ ops: templateOps
161
181
  })
162
182
 
163
183
  if ops.dataOnly && ops.splitDataAndSpec {
@@ -257,6 +277,9 @@ isStructuredPfMap := func(pf) {
257
277
 
258
278
 
259
279
 
280
+
281
+
282
+
260
283
 
261
284
 
262
285
 
@@ -6,6 +6,7 @@ exec := import("@platforma-sdk/workflow-tengo:exec")
6
6
  json := import("json")
7
7
  text := import("text")
8
8
  slices := import("@platforma-sdk/workflow-tengo:slices")
9
+ execConstants := import("@platforma-sdk/workflow-tengo:exec.constants")
9
10
 
10
11
 
11
12
 
@@ -67,6 +68,10 @@ workflow := func() {
67
68
  anonymousFilesCounter := 0
68
69
  anonymousDFCounter := 0
69
70
 
71
+ cpu := undefined
72
+ mem := undefined
73
+ queue := execConstants.MEDIUM_QUEUE
74
+
70
75
  self := undefined
71
76
 
72
77
  id := workflowCounter
@@ -266,13 +271,71 @@ workflow := func() {
266
271
 
267
272
 
268
273
 
274
+ inHeavyQueue: func() {
275
+ queue = execConstants.HEAVY_QUEUE
276
+ return self
277
+ },
278
+
279
+
280
+
281
+
282
+ inMediumQueue: func() {
283
+ queue = execConstants.MEDIUM_QUEUE
284
+ return self
285
+ },
286
+
287
+
288
+
289
+
290
+ inLightQueue: func() {
291
+ queue = execConstants.LIGHT_QUEUE
292
+ return self
293
+ },
294
+
295
+
296
+
297
+
298
+ inUiQueue: func() {
299
+ queue = execConstants.UI_TASKS_QUEUE
300
+ return self
301
+ },
302
+
303
+
304
+
305
+
306
+
307
+
308
+ cpu: func(amount) {
309
+ cpu = amount
310
+ return self
311
+ },
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+ mem: func(amount) {
325
+ mem = amount
326
+ return self
327
+ },
328
+
329
+
330
+
331
+
269
332
 
270
333
 
271
334
 
272
335
  run: func() {
273
336
  ptablerSw := assets.importSoftware("@platforma-open/milaboratories.software-ptabler:main")
274
337
  ptablerCmdBuilder := exec.builder().
275
- inMediumQueue().
338
+ setQueue(queue).
276
339
  printErrStreamToStdout().
277
340
  dontSaveStdoutOrStderr().
278
341
  software(ptablerSw).
@@ -281,6 +344,14 @@ workflow := func() {
281
344
  workflow: steps
282
345
  }));
283
346
 
347
+ if !is_undefined(cpu) {
348
+ ptablerCmdBuilder.cpu(cpu)
349
+ }
350
+
351
+ if !is_undefined(mem) {
352
+ ptablerCmdBuilder.mem(mem)
353
+ }
354
+
284
355
  for inFile in inFiles {
285
356
  if !is_undefined(inFile.file) {
286
357
  ptablerCmdBuilder.addFile(inFile.name, inFile.file)
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/workflow-tengo",
3
- "version": "4.7.2",
3
+ "version": "4.7.4",
4
4
  "description": "Tengo SDK library",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "@platforma-open/milaboratories.software-ptabler": "1.6.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@platforma-sdk/tengo-builder": "^2.1.8"
24
+ "@platforma-sdk/tengo-builder": "^2.1.10"
25
25
  },
26
26
  "scripts": {
27
27
  "type-check": "pl-tengo check",