@platforma-sdk/workflow-tengo 2.9.1 → 2.9.3
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.internal.lib.tengo +25 -18
- package/dist/tengo/lib/exec.lib.tengo +64 -6
- package/dist/tengo/lib/exec.runcmd.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_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/pframes.aggregate.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.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.map-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.xsv-import-map.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/package.json +1 -1
|
@@ -33,6 +33,13 @@ _expr := func(varName) {
|
|
|
33
33
|
return "{" + varName + "}"
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
_newTypedArg := func(type, value) {
|
|
37
|
+
return ll.toStrict({
|
|
38
|
+
type: type,
|
|
39
|
+
value: value
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
|
|
37
44
|
|
|
38
45
|
|
|
@@ -42,21 +49,12 @@ return "{" + varName + "}"
|
|
|
42
49
|
|
|
43
50
|
_newArg := func(isString, value) {
|
|
44
51
|
if isString {
|
|
45
|
-
return
|
|
46
|
-
type: constants.ARG_TYPE_STRING,
|
|
47
|
-
value: value
|
|
48
|
-
})
|
|
52
|
+
return _newTypedArg(constants.ARG_TYPE_STRING, value)
|
|
49
53
|
}
|
|
50
54
|
if desc.canBackendUseExpressions() {
|
|
51
|
-
return
|
|
52
|
-
type: constants.ARG_TYPE_EXPRESSION,
|
|
53
|
-
value: value
|
|
54
|
-
})
|
|
55
|
+
return _newTypedArg(constants.ARG_TYPE_EXPRESSION, value)
|
|
55
56
|
}
|
|
56
|
-
return
|
|
57
|
-
type: constants.ARG_TYPE_VAR,
|
|
58
|
-
value: value
|
|
59
|
-
})
|
|
57
|
+
return _newTypedArg(constants.ARG_TYPE_VAR, value)
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
_newRefVar := func(varName, refName, reference) {
|
|
@@ -308,13 +306,11 @@ binaryRunOptions := func(runOptions, mnzEnvs) {
|
|
|
308
306
|
validation.assertJsonSchema(mnzEnvs, {"any": validation.reference})
|
|
309
307
|
|
|
310
308
|
runCmdOpts := undefined
|
|
311
|
-
onlyStrings := false
|
|
312
309
|
if (is_undefined(ll.fromStrict(runOptions).software)) {
|
|
313
310
|
|
|
314
311
|
|
|
315
312
|
|
|
316
313
|
runCmdOpts = _directCallOptions(runOptions)
|
|
317
|
-
onlyStrings = true
|
|
318
314
|
} else {
|
|
319
315
|
software := runOptions.software
|
|
320
316
|
descriptor := software.descriptor
|
|
@@ -323,11 +319,22 @@ runCmdOpts = swToRunCmdOptions(software.name, software.version, descriptor)
|
|
|
323
319
|
}
|
|
324
320
|
|
|
325
321
|
|
|
326
|
-
|
|
327
|
-
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
opts := ll.fromStrict(runOptions)
|
|
326
|
+
shouldUseNewTyped := !is_undefined(opts.argsTyped) || !is_undefined(opts.envsTyped)
|
|
327
|
+
|
|
328
|
+
args := shouldUseNewTyped ? runOptions.argsTyped : runOptions.args
|
|
329
|
+
for _, arg in args {
|
|
330
|
+
typedArg := shouldUseNewTyped ? _newTypedArg(arg.type, arg.value) : _newArg(true, arg)
|
|
331
|
+
runCmdOpts.args = append(runCmdOpts.args, typedArg)
|
|
328
332
|
}
|
|
329
|
-
|
|
330
|
-
|
|
333
|
+
|
|
334
|
+
envs := shouldUseNewTyped ? runOptions.envsTyped : runOptions.envs
|
|
335
|
+
for name, v in envs {
|
|
336
|
+
typedEnv := shouldUseNewTyped ? _newTypedArg(v.type, v.value) : _newArg(true, v)
|
|
337
|
+
runCmdOpts.envs[name] = typedEnv
|
|
331
338
|
}
|
|
332
339
|
|
|
333
340
|
for name, val in mnzEnvs { // can be empty
|
|
@@ -17,6 +17,7 @@ validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
|
17
17
|
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
18
18
|
desc := import("@platforma-sdk/workflow-tengo:exec.descriptor")
|
|
19
19
|
monetization := import("@platforma-sdk/workflow-tengo:exec.monetization")
|
|
20
|
+
execConstants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
20
21
|
|
|
21
22
|
_HEAVY_QUEUE := "heavy"
|
|
22
23
|
_MEDIUM_QUEUE := "medium"
|
|
@@ -33,7 +34,14 @@ self := undefined
|
|
|
33
34
|
|
|
34
35
|
soft := undefined
|
|
35
36
|
cmd := undefined
|
|
36
|
-
args := []
|
|
37
|
+
args := [] // list of strings
|
|
38
|
+
argsTyped := [] // list of {type: expression|string, value: string}
|
|
39
|
+
typedArgSet := false
|
|
40
|
+
typedEnvSet := false
|
|
41
|
+
envs := {} // map of names to values-strings
|
|
42
|
+
envsTyped := {} // map of names to {type: expression|string, value: string}
|
|
43
|
+
secrets := {} // { "env_name": "{secrets.secret_name}", ... }
|
|
44
|
+
|
|
37
45
|
entrypointSet := false
|
|
38
46
|
|
|
39
47
|
assertEntrypointNotSet := func() {
|
|
@@ -41,8 +49,6 @@ ll.assert(!entrypointSet,
|
|
|
41
49
|
"either a command with arguments or a software were already set.")
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
envs := {}
|
|
45
|
-
secrets := {} // { "env_name": "{secrets.secret_name}", ... }
|
|
46
52
|
queue := _HEAVY_QUEUE
|
|
47
53
|
cache := 0
|
|
48
54
|
nErrorLines := 200
|
|
@@ -137,10 +143,31 @@ return self
|
|
|
137
143
|
|
|
138
144
|
|
|
139
145
|
arg: func(arg) {
|
|
140
|
-
|
|
141
|
-
ll.panic("exec: arg can't be undefined")
|
|
142
|
-
}
|
|
146
|
+
ll.assert(is_string(arg), "exec.arg(): argument must be a string, got: %v", arg)
|
|
143
147
|
args = append(args, arg)
|
|
148
|
+
argsTyped = append(argsTyped, {
|
|
149
|
+
type: execConstants.ARG_TYPE_STRING,
|
|
150
|
+
value: arg
|
|
151
|
+
})
|
|
152
|
+
return self
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
argWithVar: func(arg) {
|
|
161
|
+
ll.assert(is_string(arg), "exec.argWithVar(): argument with var must be a string, got: %v", arg)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
t := desc.canBackendUseExpressions() ? execConstants.ARG_TYPE_EXPRESSION : execConstants.ARG_TYPE_VAR
|
|
165
|
+
argsTyped = append(argsTyped, {
|
|
166
|
+
type: t,
|
|
167
|
+
value: arg
|
|
168
|
+
})
|
|
169
|
+
typedArgSet = true
|
|
170
|
+
|
|
144
171
|
return self
|
|
145
172
|
},
|
|
146
173
|
|
|
@@ -153,6 +180,30 @@ return self
|
|
|
153
180
|
env: func(name, value) {
|
|
154
181
|
validation.assertJsonSchema([name, value], ["string"])
|
|
155
182
|
envs[name] = value
|
|
183
|
+
envsTyped[name] = {
|
|
184
|
+
type: execConstants.ARG_TYPE_STRING,
|
|
185
|
+
value: value
|
|
186
|
+
}
|
|
187
|
+
return self
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
envWithVar: func(name, value) {
|
|
197
|
+
validation.assertJsonSchema([name, value], ["string"])
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
t := desc.canBackendUseExpressions() ? execConstants.ARG_TYPE_EXPRESSION : execConstants.ARG_TYPE_VAR
|
|
201
|
+
envsTyped[name] = {
|
|
202
|
+
type: t,
|
|
203
|
+
value: value
|
|
204
|
+
}
|
|
205
|
+
typedEnvSet = true
|
|
206
|
+
|
|
156
207
|
return self
|
|
157
208
|
},
|
|
158
209
|
|
|
@@ -656,6 +707,13 @@ if monetization.shouldRun(mnz) {
|
|
|
656
707
|
execInputs.runOptions.monetization = monetization.toJson(mnz)
|
|
657
708
|
}
|
|
658
709
|
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
if typedArgSet || typedEnvSet {
|
|
713
|
+
execInputs.runOptions.argsTyped = argsTyped
|
|
714
|
+
execInputs.runOptions.envsTyped = envsTyped
|
|
715
|
+
}
|
|
716
|
+
|
|
659
717
|
if !is_undefined(soft) {
|
|
660
718
|
execInputs.softwareInfo = soft.resource
|
|
661
719
|
execInputs.runOptions.software = {
|
|
@@ -355,7 +355,7 @@ return self
|
|
|
355
355
|
build: func() {
|
|
356
356
|
|
|
357
357
|
|
|
358
|
-
ll.assert(!
|
|
358
|
+
ll.assert(!hasPatternArgs || len(substRules) != 0,
|
|
359
359
|
"found pattern argument, but no substitution rules were set: hasPatternArgs: %v, substRules: %v, cmd: %v, args: %v, envs: %v",
|
|
360
360
|
hasPatternArgs, substRules, cmd, args, envs)
|
|
361
361
|
ll.assert(!hasExpressionArgs || desc.canBackendUseExpressions(),
|
|
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
|