@platforma-sdk/workflow-tengo 4.7.3 → 4.7.5

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 (35) hide show
  1. package/dist/tengo/lib/exec.lib.tengo +45 -0
  2. package/dist/tengo/lib/pframes.lib.tengo +16 -0
  3. package/dist/tengo/lib/pframes.xsv-builder.lib.tengo +94 -7
  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/tpl/check_network.create_workdir_from_storage.plj.gz +0 -0
  7. package/dist/tengo/tpl/check_network.download_blob.plj.gz +0 -0
  8. package/dist/tengo/tpl/check_network.run_hello_world.plj.gz +0 -0
  9. package/dist/tengo/tpl/check_network.run_hello_world_py.plj.gz +0 -0
  10. package/dist/tengo/tpl/check_network.upload_blob.plj.gz +0 -0
  11. package/dist/tengo/tpl/check_network.upload_template.plj.gz +0 -0
  12. package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
  13. package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
  14. package/dist/tengo/tpl/exec.monetization_info.plj.gz +0 -0
  15. package/dist/tengo/tpl/exec.monetization_to_json.plj.gz +0 -0
  16. package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
  17. package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
  18. package/dist/tengo/tpl/exec.python.venv-bin-path.plj.gz +0 -0
  19. package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
  20. package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
  21. package/dist/tengo/tpl/pframes.export-pframe-for-ui.plj.gz +0 -0
  22. package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
  23. package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
  24. package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
  25. package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
  26. package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
  27. package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
  28. package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
  29. package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
  30. package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
  31. package/dist/tengo/tpl/waiter.waiter.plj.gz +0 -0
  32. package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
  33. package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
  34. package/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
  35. package/package.json +1 -1
@@ -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]
@@ -1,10 +1,12 @@
1
1
  ll := import("@platforma-sdk/workflow-tengo:ll")
2
2
  maps := import("@platforma-sdk/workflow-tengo:maps")
3
3
  strings := import("@platforma-sdk/workflow-tengo:strings")
4
+ text := import("text")
4
5
  pSpec := import("@platforma-sdk/workflow-tengo:pframes.spec")
5
6
  pBuilder := import("@platforma-sdk/workflow-tengo:pframes.builder")
6
7
  xsv := import("@platforma-sdk/workflow-tengo:pframes.xsv")
7
8
  canonical := import("@platforma-sdk/workflow-tengo:canonical")
9
+ execConstants := import("@platforma-sdk/workflow-tengo:exec.constants")
8
10
 
9
11
  xsvFileBuilder := func(xsvType) {
10
12
  ll.assert(xsvType == "csv" || xsvType == "tsv", "xsvType must be 'csv' or 'tsv'")
@@ -19,6 +21,10 @@ xsvFileBuilder := func(xsvType) {
19
21
  nextSequentialId := 1
20
22
  nextPFrameKeyIndex := 1
21
23
 
24
+ cpu := undefined
25
+ mem := undefined
26
+ queue := undefined
27
+
22
28
  getSpecDistiller := func() {
23
29
  if is_undefined(distiller) {
24
30
  columnsToDistill := []
@@ -39,15 +45,15 @@ xsvFileBuilder := func(xsvType) {
39
45
  processedBaseKeys := {}
40
46
 
41
47
  for key, value in flatFrame {
42
- if strings.has_suffix(key, ".spec") {
43
- baseKey := strings.trim_suffix(key, ".spec")
48
+ if text.has_suffix(key, ".spec") {
49
+ baseKey := text.trim_suffix(key, ".spec")
44
50
  if is_undefined(parsedColumns[baseKey]) {
45
51
  parsedColumns[baseKey] = { key: baseKey }
46
52
  }
47
53
  parsedColumns[baseKey].spec = value
48
54
  processedBaseKeys[baseKey] = true
49
- } else if strings.has_suffix(key, ".data") {
50
- baseKey := strings.trim_suffix(key, ".data")
55
+ } else if text.has_suffix(key, ".data") {
56
+ baseKey := text.trim_suffix(key, ".data")
51
57
  if is_undefined(parsedColumns[baseKey]) {
52
58
  parsedColumns[baseKey] = { key: baseKey }
53
59
  }
@@ -322,6 +328,64 @@ xsvFileBuilder := func(xsvType) {
322
328
 
323
329
 
324
330
 
331
+ inHeavyQueue: func() {
332
+ queue = execConstants.HEAVY_QUEUE
333
+ return self
334
+ },
335
+
336
+
337
+
338
+
339
+ inMediumQueue: func() {
340
+ queue = execConstants.MEDIUM_QUEUE
341
+ return self
342
+ },
343
+
344
+
345
+
346
+
347
+ inLightQueue: func() {
348
+ queue = execConstants.LIGHT_QUEUE
349
+ return self
350
+ },
351
+
352
+
353
+
354
+
355
+ inUiQueue: func() {
356
+ queue = execConstants.UI_TASKS_QUEUE
357
+ return self
358
+ },
359
+
360
+
361
+
362
+
363
+
364
+
365
+ cpu: func(amount) {
366
+ cpu = amount
367
+ return self
368
+ },
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+ mem: func(amount) {
382
+ mem = amount
383
+ return self
384
+ },
385
+
386
+
387
+
388
+
325
389
 
326
390
 
327
391
 
@@ -394,7 +458,7 @@ xsvFileBuilder := func(xsvType) {
394
458
 
395
459
  isFlatFrame := false
396
460
  for k, _ in item {
397
- if strings.has_suffix(k, ".spec") || strings.has_suffix(k, ".data") {
461
+ if text.has_suffix(k, ".spec") || text.has_suffix(k, ".data") {
398
462
  isFlatFrame = true
399
463
  break
400
464
  }
@@ -548,7 +612,19 @@ xsvFileBuilder := func(xsvType) {
548
612
  }
549
613
 
550
614
  pFrame := _constructPFrameAndDistillSpecs().pFrame
551
- return xsv.exportFrame(pFrame, xsvType, currentExportParams)
615
+
616
+ ops := {}
617
+ if !is_undefined(cpu) {
618
+ ops.cpu = cpu
619
+ }
620
+ if !is_undefined(mem) {
621
+ ops.mem = mem
622
+ }
623
+ if !is_undefined(queue) {
624
+ ops.queue = queue
625
+ }
626
+
627
+ return xsv.exportFrame(pFrame, xsvType, currentExportParams, ops)
552
628
  },
553
629
 
554
630
 
@@ -586,7 +662,18 @@ xsvFileBuilder := func(xsvType) {
586
662
  pFrame := buildOutput.pFrame
587
663
  uniqueAxes := buildOutput.uniqueAxes
588
664
 
589
- tableResource := xsv.exportFrame(pFrame, xsvType, finalExportParams)
665
+ ops := {}
666
+ if !is_undefined(cpu) {
667
+ ops.cpu = cpu
668
+ }
669
+ if !is_undefined(mem) {
670
+ ops.mem = mem
671
+ }
672
+ if !is_undefined(queue) {
673
+ ops.queue = queue
674
+ }
675
+
676
+ tableResource := xsv.exportFrame(pFrame, xsvType, finalExportParams, ops)
590
677
 
591
678
  schema := []
592
679
 
@@ -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
 
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.3",
3
+ "version": "4.7.5",
4
4
  "description": "Tengo SDK library",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",