@platforma-sdk/workflow-tengo 6.12.1 → 6.14.0

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 (48) hide show
  1. package/dist/tengo/lib/pt.lib.tengo +55 -7
  2. package/dist/tengo/lib/pt.sizing.lib.tengo +99 -18
  3. package/dist/tengo/tpl/annotations.compute.plj.gz +0 -0
  4. package/dist/tengo/tpl/anonymize.deanonymize.plj.gz +0 -0
  5. package/dist/tengo/tpl/anonymize.impl.plj.gz +0 -0
  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/check_network.workdir_type_name_extractor.plj.gz +0 -0
  13. package/dist/tengo/tpl/exec.conda.create-env.plj.gz +0 -0
  14. package/dist/tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz +0 -0
  15. package/dist/tengo/tpl/exec.exec-impl.plj.gz +0 -0
  16. package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
  17. package/dist/tengo/tpl/exec.load-software.impl.plj.gz +0 -0
  18. package/dist/tengo/tpl/exec.monetization_info.plj.gz +0 -0
  19. package/dist/tengo/tpl/exec.monetization_to_json.plj.gz +0 -0
  20. package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
  21. package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
  22. package/dist/tengo/tpl/exec.python.venv-bin-path.plj.gz +0 -0
  23. package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
  24. package/dist/tengo/tpl/pframes.build-table.plj.gz +0 -0
  25. package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
  26. package/dist/tengo/tpl/pframes.export-parquet-pcolumn-chunk.plj.gz +0 -0
  27. package/dist/tengo/tpl/pframes.export-pframe-for-ui.plj.gz +0 -0
  28. package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
  29. package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
  30. package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
  31. package/dist/tengo/tpl/pframes.merge-resource-maps.plj.gz +0 -0
  32. package/dist/tengo/tpl/pframes.parse-to-json.plj.gz +0 -0
  33. package/dist/tengo/tpl/pframes.process-pcolumn-batch-split.plj.gz +0 -0
  34. package/dist/tengo/tpl/pframes.process-pcolumn-batch.plj.gz +0 -0
  35. package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
  36. package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
  37. package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
  38. package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
  39. package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
  40. package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
  41. package/dist/tengo/tpl/pt.import-dir.plj.gz +0 -0
  42. package/dist/tengo/tpl/pt.workflow-run.plj.gz +0 -0
  43. package/dist/tengo/tpl/waiter.waiter.plj.gz +0 -0
  44. package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
  45. package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
  46. package/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
  47. package/dist/tengo/tpl/workflow.query-context-filter.plj.gz +0 -0
  48. package/package.json +4 -4
@@ -412,6 +412,9 @@ workflow := func() {
412
412
  cpu := undefined
413
413
  mem := undefined
414
414
  memFloor := undefined
415
+ memSlope := undefined
416
+ memIntercept := undefined
417
+ polarsMaxThreads := undefined
415
418
  scratchFreeSpace := undefined
416
419
  inputCache := undefined
417
420
  queue := execConstants.MEDIUM_QUEUE
@@ -888,8 +891,9 @@ workflow := func() {
888
891
 
889
892
 
890
893
 
891
- mem: func(amount) {
892
- mem = amount
894
+ polarsMaxThreads: func(threads) {
895
+ sizing.assertPolarsMaxThreads(threads)
896
+ polarsMaxThreads = threads
893
897
  return self
894
898
  },
895
899
 
@@ -912,13 +916,26 @@ workflow := func() {
912
916
 
913
917
 
914
918
 
919
+ mem: func(amount) {
920
+ mem = amount
921
+ return self
922
+ },
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+
935
+
915
936
 
916
937
  memFloor: func(amount) {
917
- ll.assert(is_int(amount) && amount > 0,
918
- "pt.workflow.memFloor: expected a positive number of bytes, got %v", amount)
919
- ll.assert(amount <= sizing.RAM_CAP_GIB * units.GiB,
920
- "pt.workflow.memFloor: floor of %v bytes exceeds the %d GiB ceiling of the auto-sized request. Use .mem() for a fixed request above the ceiling.",
921
- amount, sizing.RAM_CAP_GIB)
938
+ sizing.assertRamFloor(amount)
922
939
  memFloor = amount
923
940
  return self
924
941
  },
@@ -932,6 +949,34 @@ workflow := func() {
932
949
 
933
950
 
934
951
 
952
+ memSlope: func(slope) {
953
+ sizing.assertRamSlope(slope)
954
+ memSlope = slope
955
+ return self
956
+ },
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+ memIntercept: func(amount) {
966
+ sizing.assertRamIntercept(amount)
967
+ memIntercept = amount
968
+ return self
969
+ },
970
+
971
+
972
+
973
+
974
+
975
+
976
+
977
+
978
+
979
+
935
980
 
936
981
 
937
982
 
@@ -1051,6 +1096,9 @@ workflow := func() {
1051
1096
  cpu: cpu,
1052
1097
  mem: mem,
1053
1098
  memFloor: memFloor,
1099
+ memSlope: memSlope,
1100
+ memIntercept: memIntercept,
1101
+ polarsMaxThreads: polarsMaxThreads,
1054
1102
  scratchFreeSpace: scratchFreeSpace,
1055
1103
  inputCache: inputCache
1056
1104
  }
@@ -38,6 +38,15 @@
38
38
 
39
39
 
40
40
 
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
41
50
 
42
51
 
43
52
 
@@ -52,11 +61,11 @@ f := import("@platforma-sdk/workflow-tengo:exec.formula")
52
61
  ll := import("@platforma-sdk/workflow-tengo:ll")
53
62
  units := import("@platforma-sdk/workflow-tengo:units")
54
63
 
55
- RAM_INTERCEPT_GIB := 2
56
- RAM_SLOPE := 6
57
- RAM_FLOOR_GIB := 2
58
- RAM_CAP_GIB := 256
59
- RAM_STATIC_FALLBACK := "4GiB"
64
+ RAM_INTERCEPT_GIB := 4
65
+ RAM_INTERCEPT_MIN_GIB := 4
66
+ RAM_SLOPE := 10
67
+ RAM_SLOPE_MIN := 0
68
+ RAM_FLOOR_GIB := 4
60
69
 
61
70
  SCRATCH_PER_READ_FRAME := 16
62
71
  SCRATCH_SORT := 16
@@ -67,33 +76,97 @@ CPU_MIN := 2
67
76
  CPU_MAX := 8
68
77
  CPU_GIB_PER_CORE := 16
69
78
 
79
+ POLARS_THREADS_MIN := 2
80
+ POLARS_THREADS_DEFAULT := 8
81
+ POLARS_THREADS_GRANTED := "granted"
82
+
70
83
 
71
- POLARS_MAX_THREADS_EXPR := format("{min(%d,max(%d,system.cpu))}", CPU_MAX, CPU_MIN)
84
+ POLARS_MAX_THREADS_EXPR := format("{min(%d,max(%d,system.cpu))}", POLARS_THREADS_DEFAULT, POLARS_THREADS_MIN)
72
85
 
73
86
 
74
87
 
75
88
 
76
89
 
77
90
 
91
+ assertPolarsMaxThreads := func(threads) {
92
+ ll.assert((is_int(threads) && threads >= POLARS_THREADS_MIN) || threads == POLARS_THREADS_GRANTED,
93
+ "pt.sizing: polarsMaxThreads must be an integer of at least %d or %q, got %v",
94
+ POLARS_THREADS_MIN, POLARS_THREADS_GRANTED, threads)
95
+ }
96
+
97
+
78
98
 
79
99
 
80
- ramFormula := func(memFloor) {
81
- floor := f.gib(RAM_FLOOR_GIB)
82
- cap := f.gib(RAM_CAP_GIB)
83
- fallback := RAM_STATIC_FALLBACK
84
100
 
85
- if !is_undefined(memFloor) {
86
101
 
87
102
 
88
103
 
89
- ll.assert(memFloor <= RAM_CAP_GIB * units.GiB,
90
- "pt.sizing: memFloor (%v bytes) must not exceed the %d GiB ceiling", memFloor, RAM_CAP_GIB)
91
- floor = f.const(memFloor)
92
- fallback = memFloor
104
+ polarsMaxThreadsExpr := func(threads) {
105
+ if is_undefined(threads) {
106
+ return POLARS_MAX_THREADS_EXPR
93
107
  }
108
+ assertPolarsMaxThreads(threads)
109
+ if threads == POLARS_THREADS_GRANTED {
110
+ return format("{max(%d,system.cpu)}", POLARS_THREADS_MIN)
111
+ }
112
+ return format("{min(%d,max(%d,system.cpu))}", threads, POLARS_THREADS_MIN)
113
+ }
114
+
115
+
116
+
117
+
118
+
119
+
120
+ assertRamSlope := func(slope) {
121
+ ll.assert(is_int(slope) && slope >= RAM_SLOPE_MIN,
122
+ "pt.sizing: memory slope must be an integer of at least %d, got %v", RAM_SLOPE_MIN, slope)
123
+ }
124
+
125
+
126
+
127
+
128
+
129
+
130
+ assertRamIntercept := func(intercept) {
131
+ ll.assert(is_int(intercept) && intercept >= RAM_INTERCEPT_MIN_GIB * units.GiB,
132
+ "pt.sizing: memory intercept must be an integer number of bytes of at least %d GiB, got %v", RAM_INTERCEPT_MIN_GIB, intercept)
133
+ }
134
+
135
+
136
+
137
+
138
+
139
+
140
+ assertRamFloor := func(floor) {
141
+ ll.assert(is_int(floor) && floor > 0,
142
+ "pt.sizing: memory floor must be a positive integer number of bytes, got %v", floor)
143
+ }
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+ ramFormula := func(opts) {
155
+ ll.assert(is_map(opts), "pt.sizing.ramFormula: expected an options map, got %v", opts)
156
+
157
+ floor := is_undefined(opts.floor) ? RAM_FLOOR_GIB * units.GiB : opts.floor
158
+ slope := is_undefined(opts.slope) ? RAM_SLOPE : opts.slope
159
+ intercept := is_undefined(opts.intercept) ? RAM_INTERCEPT_GIB * units.GiB : opts.intercept
160
+ assertRamFloor(floor)
161
+ assertRamSlope(slope)
162
+ assertRamIntercept(intercept)
163
+
164
+
165
+
166
+ fallback := intercept > floor ? intercept : floor
94
167
 
95
- return f.size({ default: 0 }).times(RAM_SLOPE).plus(f.gib(RAM_INTERCEPT_GIB)).
96
- between(floor, cap).
168
+ return f.size({ default: 0 }).times(slope).plus(f.const(intercept)).
169
+ atLeast(f.const(floor)).
97
170
  staticFallback(fallback)
98
171
  }
99
172
 
@@ -129,16 +202,24 @@ scratchFormula := func(readFrames, writeFrames) {
129
202
 
130
203
  export {
131
204
  ramFormula: ramFormula,
205
+ assertRamSlope: assertRamSlope,
206
+ assertRamIntercept: assertRamIntercept,
207
+ assertRamFloor: assertRamFloor,
132
208
  cpuFormula: cpuFormula,
133
209
  scratchFormula: scratchFormula,
210
+ polarsMaxThreadsExpr: polarsMaxThreadsExpr,
211
+ assertPolarsMaxThreads: assertPolarsMaxThreads,
134
212
 
135
213
  POLARS_MAX_THREADS_EXPR: POLARS_MAX_THREADS_EXPR,
214
+ POLARS_THREADS_MIN: POLARS_THREADS_MIN,
215
+ POLARS_THREADS_DEFAULT: POLARS_THREADS_DEFAULT,
136
216
 
137
217
 
138
218
  RAM_INTERCEPT_GIB: RAM_INTERCEPT_GIB,
219
+ RAM_INTERCEPT_MIN_GIB: RAM_INTERCEPT_MIN_GIB,
139
220
  RAM_SLOPE: RAM_SLOPE,
221
+ RAM_SLOPE_MIN: RAM_SLOPE_MIN,
140
222
  RAM_FLOOR_GIB: RAM_FLOOR_GIB,
141
- RAM_CAP_GIB: RAM_CAP_GIB,
142
223
  CPU_MIN: CPU_MIN,
143
224
  CPU_MAX: CPU_MAX,
144
225
  SCRATCH_PER_READ_FRAME: SCRATCH_PER_READ_FRAME,
Binary 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": "6.12.1",
3
+ "version": "6.14.0",
4
4
  "description": "Tengo SDK library",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -19,11 +19,11 @@
19
19
  "@milaboratories/pframes-rs-wasip2": "1.1.61",
20
20
  "@milaboratories/software-pframes-conv": "2.2.9",
21
21
  "@platforma-open/milaboratories.software-small-binaries": "^2.1.1",
22
- "@platforma-open/milaboratories.software-ptexter": "1.2.6",
23
- "@platforma-open/milaboratories.software-ptabler": "2.1.14"
22
+ "@platforma-open/milaboratories.software-ptabler": "2.1.14",
23
+ "@platforma-open/milaboratories.software-ptexter": "1.2.6"
24
24
  },
25
25
  "devDependencies": {
26
- "@platforma-sdk/tengo-builder": "4.1.2"
26
+ "@platforma-sdk/tengo-builder": "4.1.9"
27
27
  },
28
28
  "scripts": {
29
29
  "types:check": "pl-tengo imports && pl-tengo check",