@platforma-sdk/workflow-tengo 3.1.0 → 3.2.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.
- package/dist/tengo/lib/exec.lib.tengo +4 -7
- package/dist/tengo/lib/exec.limits.lib.tengo +63 -1
- package/dist/tengo/lib/exec.runcmd.lib.tengo +47 -7
- package/dist/tengo/lib/feats.lib.tengo +5 -4
- package/dist/tengo/lib/workdir.lib.tengo +1 -1
- package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
- package/dist/tengo/tpl/exec.monetization_info.plj.gz +0 -0
- package/dist/tengo/tpl/exec.monetization_to_json.plj.gz +0 -0
- package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
- package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
- package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-pframe-for-ui.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
- package/dist/tengo/tpl/waiter.waiter.plj.gz +0 -0
- package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
- package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
- package/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
6
|
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
7
|
+
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
7
8
|
|
|
8
9
|
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
9
10
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
@@ -15,7 +16,6 @@ path := import("@platforma-sdk/workflow-tengo:path")
|
|
|
15
16
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
16
17
|
enum := import("enum")
|
|
17
18
|
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
18
|
-
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
19
19
|
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
20
20
|
limits := import("@platforma-sdk/workflow-tengo:exec.limits")
|
|
21
21
|
monetization := import("@platforma-sdk/workflow-tengo:exec.monetization_internal")
|
|
@@ -50,7 +50,6 @@ builder := func() {
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
queue := execConstants.HEAVY_QUEUE
|
|
53
|
-
hasLimits := false
|
|
54
53
|
cpuRequest := undefined
|
|
55
54
|
ramRequest := undefined
|
|
56
55
|
|
|
@@ -254,7 +253,6 @@ builder := func() {
|
|
|
254
253
|
cpu: func(amount) {
|
|
255
254
|
validation.assertType(amount, "number", "exec.builder.cpu: amount of cores must be a number")
|
|
256
255
|
ll.assert(amount > 0, "exec.builder.cpu: amount of cores should be greater than 0")
|
|
257
|
-
hasLimits = true
|
|
258
256
|
cpuRequest = amount
|
|
259
257
|
|
|
260
258
|
return self
|
|
@@ -274,7 +272,6 @@ builder := func() {
|
|
|
274
272
|
ram: func(amount) {
|
|
275
273
|
validation.assertType(amount, ["or", "number", "string"], "exec.builder.ram: RAM amount should be a number or string")
|
|
276
274
|
ll.assert(is_string(amount) || amount > 0, "exec.builder.ram: amount in bytes should be greater than 0")
|
|
277
|
-
hasLimits = true
|
|
278
275
|
ramRequest = amount
|
|
279
276
|
|
|
280
277
|
return self
|
|
@@ -728,11 +725,11 @@ builder := func() {
|
|
|
728
725
|
}
|
|
729
726
|
|
|
730
727
|
serviceExecInputs := {}
|
|
731
|
-
if
|
|
728
|
+
if feats.workdirLimits || feats.computeLimits {
|
|
732
729
|
serviceExecInputs.quota = limits.quotaBuilder().
|
|
733
730
|
queue(queue).
|
|
734
|
-
cpu(cpuRequest).
|
|
735
|
-
ram(ramRequest).
|
|
731
|
+
cpu(cpuRequest). // 'undefined' value is OK and makes runner to apply default queue limits
|
|
732
|
+
ram(ramRequest). // 'undefined' value is OK and makes runner to apply default queue limits
|
|
736
733
|
build()
|
|
737
734
|
}
|
|
738
735
|
|
|
@@ -143,7 +143,69 @@ storageSpaceRequestBuilder := func() {
|
|
|
143
143
|
return self
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
_RTYPE_COMPUTE_REQUEST := func(executor) { return { Name: "ComputeRequest/" + executor, Version: "1" } }
|
|
147
|
+
_CR_DEFAULT_EXECUTOR_ID := "executor"
|
|
148
|
+
_CR_FIELD_REQUEST := "request" // input
|
|
149
|
+
_CR_FIELD_ALLOCATION := "allocation" // output
|
|
150
|
+
|
|
151
|
+
computeRequestBuilder := func() {
|
|
152
|
+
self := undefined
|
|
153
|
+
|
|
154
|
+
quota := undefined
|
|
155
|
+
executor := _CR_DEFAULT_EXECUTOR_ID
|
|
156
|
+
|
|
157
|
+
self = ll.toStrict({
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
quota: func(ref) {
|
|
165
|
+
validation.assertType(ref, validation.reference, "exec.limits.quota: quota must be a valid reference to Quota resource")
|
|
166
|
+
quota = ref
|
|
167
|
+
|
|
168
|
+
return self
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
executor: func(execID) {
|
|
178
|
+
validation.assertType(execID, "string", "exec.limits.executor: executor ID should be a string")
|
|
179
|
+
executor = execID
|
|
180
|
+
|
|
181
|
+
return self
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
build: func() {
|
|
190
|
+
ll.assert(smart.isReference(quota), "exec.limits.build: quota of ComputeRequest must be a valid reference")
|
|
191
|
+
|
|
192
|
+
rType := _RTYPE_COMPUTE_REQUEST(executor)
|
|
193
|
+
requestBuilder := smart.ephemeralBuilder(rType)
|
|
194
|
+
requestBuilder.getField(_CR_FIELD_REQUEST).set(quota)
|
|
195
|
+
|
|
196
|
+
return ll.toStrict(
|
|
197
|
+
oop.inherit(requestBuilder, {
|
|
198
|
+
allocation: requestBuilder.getField(_CR_FIELD_ALLOCATION)
|
|
199
|
+
})
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
return self
|
|
205
|
+
}
|
|
206
|
+
|
|
146
207
|
export ll.toStrict({
|
|
147
208
|
quotaBuilder: quotaBuilder,
|
|
148
|
-
storageSpaceRequestBuilder: storageSpaceRequestBuilder
|
|
209
|
+
storageSpaceRequestBuilder: storageSpaceRequestBuilder,
|
|
210
|
+
computeRequestBuilder: computeRequestBuilder
|
|
149
211
|
})
|
|
@@ -3,22 +3,33 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
6
|
+
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
6
7
|
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
8
|
+
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
7
9
|
|
|
8
10
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
9
|
-
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
10
11
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
11
12
|
json := import("json")
|
|
12
13
|
constants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
13
14
|
slices := import("@platforma-sdk/workflow-tengo:slices")
|
|
15
|
+
limits := import("@platforma-sdk/workflow-tengo:exec.limits")
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
_RTYPE_RUN_COMMAND_V1 := { Name: "RunCommand/executor", Version: "1" }
|
|
18
|
+
_RTYPE_RUN_COMMAND_V2 := { Name: "RunCommand/executor", Version: "2" }
|
|
16
19
|
_RTYPE_RUN_COMMAND_CMD := { Name: "RunCommandCmd", Version: "1" }
|
|
17
20
|
_RTYPE_RUN_COMMAND_ARGS := { Name: "RunCommandArgs", Version: "1" }
|
|
18
21
|
_RTYPE_RUN_COMMAND_OPTIONS := { Name: "run-command/options", Version: "1" }
|
|
19
22
|
_RTYPE_RUN_COMMAND_REFS := { Name: "RunCommandRefs", Version: "1" }
|
|
20
23
|
|
|
24
|
+
|
|
25
|
+
_FIELD_ALLOCATION := "allocation" // not in v1
|
|
26
|
+
_FIELD_REFS := "refs"
|
|
27
|
+
_FIELD_CMD := "cmd"
|
|
28
|
+
_FIELD_ARGS := "args"
|
|
29
|
+
_FIELD_OPTIONS := "options"
|
|
21
30
|
_FIELD_WORKDIR_IN := "workdirIn"
|
|
31
|
+
|
|
32
|
+
|
|
22
33
|
_FIELD_WORKDIR_OUT := "workdirOut"
|
|
23
34
|
|
|
24
35
|
|
|
@@ -66,7 +77,14 @@ _createExpressionArg := func(argTpl) {
|
|
|
66
77
|
|
|
67
78
|
|
|
68
79
|
builder := func(workdir) {
|
|
69
|
-
res :=
|
|
80
|
+
res := undefined
|
|
81
|
+
|
|
82
|
+
if feats.computeLimits {
|
|
83
|
+
res = smart.ephemeralBuilder(_RTYPE_RUN_COMMAND_V2)
|
|
84
|
+
} else {
|
|
85
|
+
res = smart.ephemeralBuilder(_RTYPE_RUN_COMMAND_V1)
|
|
86
|
+
}
|
|
87
|
+
|
|
70
88
|
res.getField(_FIELD_WORKDIR_IN).set(workdir)
|
|
71
89
|
|
|
72
90
|
self := undefined
|
|
@@ -76,6 +94,7 @@ builder := func(workdir) {
|
|
|
76
94
|
envs := {}
|
|
77
95
|
queue := ""
|
|
78
96
|
refs := {}
|
|
97
|
+
_allocation := undefined
|
|
79
98
|
|
|
80
99
|
substRules := {}
|
|
81
100
|
hasPatternArgs := false // TODO: deprecated, remove after a month of expressionRefs in prod.
|
|
@@ -92,6 +111,17 @@ builder := func(workdir) {
|
|
|
92
111
|
|
|
93
112
|
|
|
94
113
|
|
|
114
|
+
allocation: func(allocation) {
|
|
115
|
+
validation.assertType(allocation, validation.reference, "runcmd.builder: allocation should be a valid reference")
|
|
116
|
+
_allocation = allocation
|
|
117
|
+
return self
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
95
125
|
cmd: func(commandName) {
|
|
96
126
|
cmd = _createSimpleArg(commandName)
|
|
97
127
|
return self
|
|
@@ -366,11 +396,21 @@ builder := func(workdir) {
|
|
|
366
396
|
"runcmd.builder().build: expression arguments must be enabled only if platforma backend supports expressions, found: %v",
|
|
367
397
|
hasExpressionArgs)
|
|
368
398
|
|
|
399
|
+
if feats.computeLimits {
|
|
400
|
+
if !smart.isReference(_allocation) {
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
_quota := limits.quotaBuilder().queue(queue).build()
|
|
404
|
+
_allocation = limits.computeRequestBuilder().quota(_quota).build().allocation
|
|
405
|
+
}
|
|
406
|
+
self.getField(_FIELD_ALLOCATION).set(_allocation)
|
|
407
|
+
}
|
|
408
|
+
|
|
369
409
|
refsRes := smart.createMapResourceWithType(_RTYPE_RUN_COMMAND_REFS, refs)
|
|
370
|
-
self.getField(
|
|
410
|
+
self.getField(_FIELD_REFS).set(refsRes)
|
|
371
411
|
|
|
372
412
|
cmdRes := smart.createValueResource(_RTYPE_RUN_COMMAND_CMD, json.encode(cmd))
|
|
373
|
-
self.getField(
|
|
413
|
+
self.getField(_FIELD_CMD).set(cmdRes)
|
|
374
414
|
|
|
375
415
|
options := {
|
|
376
416
|
queueName: queue,
|
|
@@ -383,10 +423,10 @@ builder := func(workdir) {
|
|
|
383
423
|
}
|
|
384
424
|
|
|
385
425
|
optionsRes := smart.createValueResource(_RTYPE_RUN_COMMAND_OPTIONS, json.encode(options))
|
|
386
|
-
self.getField(
|
|
426
|
+
self.getField(_FIELD_OPTIONS).set(optionsRes)
|
|
387
427
|
|
|
388
428
|
argsRes := smart.createValueResource(_RTYPE_RUN_COMMAND_ARGS, json.encode(args))
|
|
389
|
-
self.getField(
|
|
429
|
+
self.getField(_FIELD_ARGS).set(argsRes)
|
|
390
430
|
|
|
391
431
|
res := ll.toStrict(oop.inherit(self.lockAndBuild(), {
|
|
392
432
|
"workdir": self.outputs()[_FIELD_WORKDIR_OUT],
|
|
@@ -6,11 +6,12 @@ ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
|
6
6
|
|
|
7
7
|
_api := plapi.apiVersion
|
|
8
8
|
if is_undefined(_api) {
|
|
9
|
-
|
|
9
|
+
_api = 0
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export ll.toStrict({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
pureFutureFields: _api >= 1, // 'pure' future fields magic that provides deduplication
|
|
14
|
+
commandExpressions: _api >= 2, // rich expressions in command arguments ( {{ system.ram_bytes / 20 }} )
|
|
15
|
+
workdirLimits: _api >= 4, // workdir storage controller can limit concurrency
|
|
16
|
+
computeLimits: _api >= 8 // runner can plan CPU and RAM
|
|
16
17
|
})
|
|
@@ -6,6 +6,7 @@ json := import("json")
|
|
|
6
6
|
|
|
7
7
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
8
8
|
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
9
|
+
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
9
10
|
|
|
10
11
|
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
11
12
|
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
@@ -15,7 +16,6 @@ sets := import("@platforma-sdk/workflow-tengo:sets")
|
|
|
15
16
|
slices := import("@platforma-sdk/workflow-tengo:slices")
|
|
16
17
|
path := import("@platforma-sdk/workflow-tengo:path")
|
|
17
18
|
enum := import("enum")
|
|
18
|
-
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
19
19
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
20
20
|
|
|
21
21
|
_WD_CREATE_FIELD_ALLOCATION := "allocation"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|