@platforma-sdk/workflow-tengo 6.14.0 → 6.15.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 +74 -0
  2. package/dist/tengo/lib/pt.sizing.lib.tengo +87 -4
  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 +1 -1
@@ -410,6 +410,10 @@ workflow := func() {
410
410
  pframeCounter := 0
411
411
 
412
412
  cpu := undefined
413
+ cpuFloor := undefined
414
+ cpuIntercept := undefined
415
+ cpuSlope := undefined
416
+ cpuCeiling := undefined
413
417
  mem := undefined
414
418
  memFloor := undefined
415
419
  memSlope := undefined
@@ -872,6 +876,17 @@ workflow := func() {
872
876
 
873
877
 
874
878
 
879
+
880
+
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+
889
+
875
890
  cpu: func(amount) {
876
891
  cpu = amount
877
892
  return self
@@ -884,6 +899,61 @@ workflow := func() {
884
899
 
885
900
 
886
901
 
902
+ cpuFloor: func(cores) {
903
+ sizing.assertCpuCores(cores, "cpuFloor")
904
+ cpuFloor = cores
905
+ return self
906
+ },
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+ cpuIntercept: func(cores) {
916
+ sizing.assertCpuCores(cores, "cpuIntercept")
917
+ cpuIntercept = cores
918
+ return self
919
+ },
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+ cpuSlope: func(slope) {
931
+ sizing.assertCpuSlope(slope)
932
+ cpuSlope = slope
933
+ return self
934
+ },
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+ cpuCeiling: func(cores) {
945
+ sizing.assertCpuCores(cores, "cpuCeiling")
946
+ cpuCeiling = cores
947
+ return self
948
+ },
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
887
957
 
888
958
 
889
959
 
@@ -1094,6 +1164,10 @@ workflow := func() {
1094
1164
  runMetaInputs := {
1095
1165
  queue: queue,
1096
1166
  cpu: cpu,
1167
+ cpuFloor: cpuFloor,
1168
+ cpuIntercept: cpuIntercept,
1169
+ cpuSlope: cpuSlope,
1170
+ cpuCeiling: cpuCeiling,
1097
1171
  mem: mem,
1098
1172
  memFloor: memFloor,
1099
1173
  memSlope: memSlope,
@@ -55,6 +55,7 @@
55
55
 
56
56
 
57
57
 
58
+
58
59
 
59
60
 
60
61
  f := import("@platforma-sdk/workflow-tengo:exec.formula")
@@ -176,10 +177,90 @@ ramFormula := func(opts) {
176
177
 
177
178
 
178
179
 
179
- cpuFormula := func() {
180
- return f.size({ default: 0 }).dividedByFloor(f.gib(CPU_GIB_PER_CORE)).plus(f.const(CPU_MIN)).
181
- between(f.const(CPU_MIN), f.const(CPU_MAX)).
182
- staticFallback(CPU_MIN)
180
+ assertCpuCores := func(cores, name) {
181
+ ll.assert(is_int(cores) && cores >= 1,
182
+ "pt.sizing: %s must be an integer of at least 1, got %v", name, cores)
183
+ }
184
+
185
+
186
+
187
+
188
+
189
+
190
+ assertCpuSlope := func(slope) {
191
+ ll.assert((is_int(slope) || is_float(slope)) && slope >= 0,
192
+ "pt.sizing: cpuSlope must be a number of at least 0, got %v", slope)
193
+ }
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+ cpuSlopeHundredths := func(slope) {
204
+ assertCpuSlope(slope)
205
+ return int(float(slope) * 100 + 0.000001)
206
+ }
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ cpuFormula := func(...args) {
226
+ ll.assert(len(args) <= 1, "pt.sizing.cpuFormula: expected at most one options map")
227
+ opts := len(args) == 1 && !is_undefined(args[0]) ? args[0] : {}
228
+ ll.assert(is_map(opts), "pt.sizing.cpuFormula: expected an options map, got %v", opts)
229
+
230
+ floor := is_undefined(opts.floor) ? CPU_MIN : opts.floor
231
+ intercept := is_undefined(opts.intercept) ? CPU_MIN : opts.intercept
232
+ assertCpuCores(floor, "cpuFloor")
233
+ assertCpuCores(intercept, "cpuIntercept")
234
+
235
+
236
+
237
+ slopeTerm := f.size({ default: 0 }).dividedByFloor(f.gib(CPU_GIB_PER_CORE))
238
+ if !is_undefined(opts.slope) {
239
+ slopeTerm = f.size({ default: 0 }).times(cpuSlopeHundredths(opts.slope)).dividedByFloor(f.gib(100))
240
+ }
241
+ curve := slopeTerm.plus(f.const(intercept))
242
+ defaultCurve := is_undefined(opts.slope) && is_undefined(opts.intercept)
243
+
244
+ ceiling := undefined
245
+ if !is_undefined(opts.ceiling) {
246
+ assertCpuCores(opts.ceiling, "cpuCeiling")
247
+ ll.assert(opts.ceiling >= floor,
248
+ "pt.sizing: cpuCeiling (%d) must not be less than cpuFloor (%d)", opts.ceiling, floor)
249
+ ceiling = opts.ceiling
250
+ } else if defaultCurve {
251
+ ceiling = floor > CPU_MAX ? floor : CPU_MAX
252
+ }
253
+
254
+
255
+ fallback := intercept > floor ? intercept : floor
256
+ if !is_undefined(ceiling) && fallback > ceiling {
257
+ fallback = ceiling
258
+ }
259
+
260
+ if is_undefined(ceiling) {
261
+ return curve.atLeast(f.const(floor)).staticFallback(fallback)
262
+ }
263
+ return curve.between(f.const(floor), f.const(ceiling)).staticFallback(fallback)
183
264
  }
184
265
 
185
266
 
@@ -206,6 +287,8 @@ export {
206
287
  assertRamIntercept: assertRamIntercept,
207
288
  assertRamFloor: assertRamFloor,
208
289
  cpuFormula: cpuFormula,
290
+ assertCpuCores: assertCpuCores,
291
+ assertCpuSlope: assertCpuSlope,
209
292
  scratchFormula: scratchFormula,
210
293
  polarsMaxThreadsExpr: polarsMaxThreadsExpr,
211
294
  assertPolarsMaxThreads: assertPolarsMaxThreads,
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.14.0",
3
+ "version": "6.15.0",
4
4
  "description": "Tengo SDK library",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",