@platforma-sdk/workflow-tengo 4.8.1 → 4.9.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/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/dist/index.mjs +6 -4
- package/dist/tengo/lib/exec.R.internal.lib.tengo +4 -1
- package/dist/tengo/lib/exec.delayed-compute-allocation.lib.tengo +43 -0
- package/dist/tengo/lib/exec.load-software.lib.tengo +32 -0
- package/dist/tengo/lib/exec.monetization.lib.tengo +7 -1
- package/dist/tengo/lib/exec.monetization_internal.lib.tengo +13 -19
- package/dist/tengo/lib/exec.runcmd.lib.tengo +350 -104
- package/dist/tengo/lib/feats.lib.tengo +1 -1
- package/dist/tengo/lib/feature-guard.lib.tengo +14 -0
- package/dist/tengo/lib/tpl.base.lib.tengo +3 -0
- package/dist/tengo/tpl/check_network.create_workdir_from_storage.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.download_blob.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.run_hello_world.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.run_hello_world_py.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.upload_blob.plj.gz +0 -0
- package/dist/tengo/tpl/check_network.upload_template.plj.gz +0 -0
- package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
- package/dist/tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec-impl.plj.gz +0 -0
- package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
- package/dist/tengo/tpl/exec.load-software.impl.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/exec.python.venv-bin-path.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
- package/dist/tengo/lib/exec.internal.lib.tengo +0 -430
- package/dist/tengo/tpl/exec.delayed_compute_allocation.plj.gz +0 -0
|
@@ -18,6 +18,8 @@ validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
|
|
22
|
+
|
|
21
23
|
_unmarshal := func(resource, preprocessors) {
|
|
22
24
|
ll.assert(smart.isResource(resource), "expected resource, found ", resource)
|
|
23
25
|
|
|
@@ -645,6 +647,7 @@ tpl := func(ops) {
|
|
|
645
647
|
renderer : self.renderer,
|
|
646
648
|
registerUnmarshaller : self.registerUnmarshaller,
|
|
647
649
|
rawInputs : self.rawInputs,
|
|
650
|
+
rawServiceInputs : self.rawServiceInputs,
|
|
648
651
|
hasInput : self.hasInput,
|
|
649
652
|
inputs : self.inputs,
|
|
650
653
|
defineOutputs : self.defineOutputs,
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
9
|
-
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
10
|
-
|
|
11
|
-
json := import("json")
|
|
12
|
-
times := import("times")
|
|
13
|
-
text := import("text")
|
|
14
|
-
oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
15
|
-
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
16
|
-
path := import("@platforma-sdk/workflow-tengo:path")
|
|
17
|
-
pkg := import("@platforma-sdk/workflow-tengo:exec.package")
|
|
18
|
-
runcmd := import("@platforma-sdk/workflow-tengo:exec.runcmd")
|
|
19
|
-
python := import("@platforma-sdk/workflow-tengo:exec.python")
|
|
20
|
-
R := import("@platforma-sdk/workflow-tengo:exec.R")
|
|
21
|
-
constants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
22
|
-
desc := import("@platforma-sdk/workflow-tengo:exec.descriptor")
|
|
23
|
-
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
_ARG_VAR_PKG := "pkg" // abs path to software package
|
|
29
|
-
_ARG_VAR_JAVA := "java" // abs path to 'java' run environment
|
|
30
|
-
|
|
31
|
-
_ARG_VAR_PYTHON_VENV := "python" // abs path to python virtual environment. WARNING: not change the name, it's used in other part of code
|
|
32
|
-
_ARG_VAR_PYTHON_RUN_ENV := "python_run_env" // abs path to python run environment used to create venv
|
|
33
|
-
_ARG_VAR_VENV_BIN_DIR := "venv_bin_dir" // name of bin dir in python venv depending on OS type (Scripts on Windows, bin on Unix)
|
|
34
|
-
_ARG_PYTHON_LOCAL_SCRIPT_DIR := "python_local_script_dir" // abs path to directory with local python scripts.
|
|
35
|
-
_ARG_PATH_DELIMETER := "path_delimeter"
|
|
36
|
-
|
|
37
|
-
_ARG_VAR_R := "R" // abs path to 'R' run environment runtime
|
|
38
|
-
_ARG_VAR_R_VENV := "rVenv" // abs path to 'R' portable virtual environment
|
|
39
|
-
_ARG_VAR_MNZ := "monetization" // monetization env value
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
pythonBinDir := undefined
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
_expr := func(varName) {
|
|
48
|
-
return "{" + varName + "}"
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_newTypedArg := func(type, value) {
|
|
52
|
-
return ll.toStrict({
|
|
53
|
-
type: type,
|
|
54
|
-
value: value
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
_newArg := func(isString, value) {
|
|
66
|
-
if isString {
|
|
67
|
-
return _newTypedArg(constants.ARG_TYPE_STRING, value)
|
|
68
|
-
}
|
|
69
|
-
if feats.commandExpressions {
|
|
70
|
-
return _newTypedArg(constants.ARG_TYPE_EXPRESSION, value)
|
|
71
|
-
}
|
|
72
|
-
return _newTypedArg(constants.ARG_TYPE_VAR, value)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
_newRefVar := func(varName, refName, reference) {
|
|
76
|
-
|
|
77
|
-
if !feats.commandExpressions {
|
|
78
|
-
return ll.toStrict({
|
|
79
|
-
varName: "{" + varName + "}",
|
|
80
|
-
refName: refName,
|
|
81
|
-
reference: reference
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return ll.toStrict({
|
|
86
|
-
varName: varName,
|
|
87
|
-
refName: refName,
|
|
88
|
-
reference: reference
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
_installSoftware := func(registry, pkgName) {
|
|
93
|
-
ll.assert(is_string(registry), "exec.internal._installSoftware(): registry is not a string, got: %v", registry, pkgName)
|
|
94
|
-
ll.assert(is_string(pkgName), "exec.internal._installSoftware(): pkgName is not a string, got: %v", pkgName, registry)
|
|
95
|
-
|
|
96
|
-
archive := pkg.get(registry, pkgName).archive()
|
|
97
|
-
return pkg.install(archive).package()
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
_directCallOptions := func(runOptions) {
|
|
101
|
-
return ll.toStrict({
|
|
102
|
-
variables: [],
|
|
103
|
-
customPaths: [],
|
|
104
|
-
cmd: _newArg(true, runOptions.cmd),
|
|
105
|
-
args: [],
|
|
106
|
-
envs: {}
|
|
107
|
-
})
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
_loadJavaRunEnvironment := func(operationMode, descriptor) {
|
|
111
|
-
javaPkg := _installSoftware(descriptor.runEnv.registry, descriptor.runEnv.package)
|
|
112
|
-
javaRefVar := _newRefVar(_ARG_VAR_JAVA, descriptor.runEnv.name, javaPkg)
|
|
113
|
-
|
|
114
|
-
return ll.toStrict({
|
|
115
|
-
runEnvType: "java",
|
|
116
|
-
|
|
117
|
-
variables: [ javaRefVar ],
|
|
118
|
-
customPaths: [ _newArg(false, path.join(_expr(_ARG_VAR_JAVA), descriptor.runEnv.binDir)) ],
|
|
119
|
-
envs: {}
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
_loadPythonRunEnvironment := func(operationMode, descriptor, softName, softPkg) {
|
|
124
|
-
venvBuilder := python.venvBuilder().
|
|
125
|
-
software(softPkg).
|
|
126
|
-
runEnvDescriptor(descriptor.runEnv).
|
|
127
|
-
dependencies(descriptor.dependencies)
|
|
128
|
-
|
|
129
|
-
if !is_undefined(descriptor.toolset) && descriptor.toolset != "" {
|
|
130
|
-
venvBuilder.useToolset(descriptor.toolset)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
venv := venvBuilder.
|
|
134
|
-
cacheDays(7).
|
|
135
|
-
build()
|
|
136
|
-
|
|
137
|
-
pythonRefVar := _newRefVar(_ARG_VAR_PYTHON_RUN_ENV, softName+"/python", venv.python())
|
|
138
|
-
pythonVenvRefVar := _newRefVar(_ARG_VAR_PYTHON_VENV, softName + "/venv", venv.venv())
|
|
139
|
-
venvBinDirRefVar := _newRefVar(_ARG_VAR_VENV_BIN_DIR, softName + "/binDir", venv.binDir() )
|
|
140
|
-
pathDelimeterRefVar := _newRefVar(_ARG_PATH_DELIMETER, softName + "/pathDelimeter", venv.pathDelimeter())
|
|
141
|
-
|
|
142
|
-
return ll.toStrict({
|
|
143
|
-
runEnvType: "python",
|
|
144
|
-
|
|
145
|
-
variables: [ pythonRefVar, pythonVenvRefVar, venvBinDirRefVar, pathDelimeterRefVar ],
|
|
146
|
-
customPaths: [ _newArg(false, path.join(_expr(_ARG_VAR_PYTHON_VENV), "venv", _expr(_ARG_VAR_VENV_BIN_DIR))) ],
|
|
147
|
-
envs: {
|
|
148
|
-
"VIRTUAL_ENV": _newArg(false, path.join(_expr(_ARG_VAR_PYTHON_VENV), "venv")),
|
|
149
|
-
"PYTHONPATH": _newArg(false, path.join(_expr(_ARG_VAR_PYTHON_RUN_ENV), descriptor.runEnv.binDir, "python_stdlib") + _expr(_ARG_PATH_DELIMETER) + _expr(_ARG_VAR_PKG))
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
_loadRRunEnvironment := func(operationMode, descriptor, softName, softPkg) {
|
|
155
|
-
renvBuilder := R.rVenvBuilder().
|
|
156
|
-
operationMode(operationMode).
|
|
157
|
-
software(softPkg).
|
|
158
|
-
runEnvDescriptor(descriptor.runEnv).
|
|
159
|
-
dependencies(descriptor.dependencies)
|
|
160
|
-
|
|
161
|
-
if !is_undefined(descriptor.toolset) && descriptor.toolset != "" {
|
|
162
|
-
renvBuilder.useToolset(descriptor.toolset)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
rRuntime := renvBuilder.
|
|
166
|
-
cacheDays(7).
|
|
167
|
-
build()
|
|
168
|
-
|
|
169
|
-
rEnv := rRuntime.venv()
|
|
170
|
-
rPackage := rRuntime.R()
|
|
171
|
-
|
|
172
|
-
rBinDir := path.join(_expr(_ARG_VAR_R), descriptor.runEnv.binDir)
|
|
173
|
-
|
|
174
|
-
rRefKey := softName + "/R-runtime"
|
|
175
|
-
rRefVar := _newRefVar(_ARG_VAR_R, rRefKey, rPackage)
|
|
176
|
-
|
|
177
|
-
rEnvRefKey := softName + "/R-virtual-env"
|
|
178
|
-
rEnvRefVar := _newRefVar(_ARG_VAR_R_VENV, rEnvRefKey, rEnv)
|
|
179
|
-
|
|
180
|
-
renvRootArg := path.join(_expr(_ARG_VAR_R), "renv-root")
|
|
181
|
-
|
|
182
|
-
envs := {
|
|
183
|
-
"RHOME": _newArg(false, _expr(_ARG_VAR_R)), // for Rscript (it uses RHOME instead of R_HOME)
|
|
184
|
-
"R_HOME_DIR": _newArg(false, _expr(_ARG_VAR_R)), // for R startup script. It configures all the rest required for R to start.
|
|
185
|
-
"RENV_PATHS_ROOT": _newArg(false, renvRootArg),
|
|
186
|
-
"RENV_PATHS_BINARY": _newArg(false, path.join(renvRootArg, "binaries")),
|
|
187
|
-
"RENV_PATHS_SOURCE": _newArg(false, path.join(renvRootArg, "sources")),
|
|
188
|
-
"RENV_PATHS_CACHE": _newArg(false, path.join(renvRootArg, "cache")),
|
|
189
|
-
"RENV_PATHS_RENV": _newArg(false, path.join(_expr(_ARG_VAR_R_VENV), "renv")),
|
|
190
|
-
"RENV_PATHS_LOCKFILE": _newArg(false, path.join(renvRootArg, "renv.lock"))
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
envs["RENV_CONFIG_REPOS_OVERRIDE"] = _newArg(false, path.join(_expr(_ARG_VAR_R), "packages"))
|
|
197
|
-
|
|
198
|
-
return ll.toStrict({
|
|
199
|
-
runEnvType: "R",
|
|
200
|
-
|
|
201
|
-
variables: [ rRefVar, rEnvRefVar ],
|
|
202
|
-
customPaths: [ _newArg(false, rBinDir) ],
|
|
203
|
-
envs: envs
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
_loadRunEnvironment := func(operationMode, descriptor, softName, softPackage) {
|
|
209
|
-
if descriptor.runEnv.type == "java" {
|
|
210
|
-
return _loadJavaRunEnvironment(operationMode, descriptor)
|
|
211
|
-
}
|
|
212
|
-
if descriptor.runEnv.type == "python" {
|
|
213
|
-
return _loadPythonRunEnvironment(operationMode, descriptor, softName, softPackage)
|
|
214
|
-
}
|
|
215
|
-
if descriptor.runEnv.type == "R" {
|
|
216
|
-
return _loadRRunEnvironment(operationMode, descriptor, softName, softPackage)
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
ll.panic("run environment type %q is not currently supported by workflow-sdk", descriptor.runEnv.type)
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
_binPackageCallOptions := func(operationMode, softwareName, variables, descriptor, softPackage) {
|
|
226
|
-
customPaths := []
|
|
227
|
-
envs := ll.toStrict({})
|
|
228
|
-
args := []
|
|
229
|
-
runEnvType := "binary"
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (maps.containsKey(descriptor, "runEnv")) {
|
|
234
|
-
runEnvInfo := _loadRunEnvironment(operationMode, descriptor, softwareName, softPackage)
|
|
235
|
-
|
|
236
|
-
runEnvType = runEnvInfo.runEnvType
|
|
237
|
-
if len(runEnvInfo.variables) > 0 {
|
|
238
|
-
variables = append(variables, runEnvInfo.variables...)
|
|
239
|
-
}
|
|
240
|
-
if len(runEnvInfo.customPaths) > 0 {
|
|
241
|
-
customPaths = append(customPaths, runEnvInfo.customPaths...)
|
|
242
|
-
}
|
|
243
|
-
if len(runEnvInfo.envs) > 0 {
|
|
244
|
-
for n, v in runEnvInfo.envs {
|
|
245
|
-
envs[n] = v
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
ll.assert(
|
|
251
|
-
len(descriptor.cmd) != 0,
|
|
252
|
-
"cannot render final command for software: empty 'cmd' and 'command' in software descriptor")
|
|
253
|
-
|
|
254
|
-
cmd := _newArg(false, descriptor.cmd[0])
|
|
255
|
-
|
|
256
|
-
for arg in splice(descriptor.cmd, 1) {
|
|
257
|
-
args = append(args, _newArg(false, arg))
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return ll.toStrict({
|
|
261
|
-
runEnvType: runEnvType,
|
|
262
|
-
variables: variables,
|
|
263
|
-
customPaths: customPaths,
|
|
264
|
-
cmd: cmd,
|
|
265
|
-
args: args,
|
|
266
|
-
envs: envs
|
|
267
|
-
})
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
_devLocalPackageCallOptions := func(softwareName, localDescriptor) {
|
|
271
|
-
softPackage := pkg.use({
|
|
272
|
-
hash: localDescriptor.hash,
|
|
273
|
-
path: localDescriptor.path,
|
|
274
|
-
descriptor: json.encode(ll.fromStrict(localDescriptor)),
|
|
275
|
-
origin: {
|
|
276
|
-
registry: "dev-local",
|
|
277
|
-
url: "file://" + localDescriptor.path,
|
|
278
|
-
packageName: softwareName
|
|
279
|
-
}
|
|
280
|
-
}).package()
|
|
281
|
-
|
|
282
|
-
variables := [ _newRefVar(_ARG_VAR_PKG, softwareName, softPackage) ]
|
|
283
|
-
|
|
284
|
-
return _binPackageCallOptions("dev-local", softwareName, variables, localDescriptor, softPackage)
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
_remotePackageCallOptions := func(softwareName, binaryDescriptor) {
|
|
288
|
-
softPackage := _installSoftware(binaryDescriptor.registry, binaryDescriptor.package)
|
|
289
|
-
|
|
290
|
-
variables := [ _newRefVar(_ARG_VAR_PKG, softwareName, softPackage) ]
|
|
291
|
-
|
|
292
|
-
return _binPackageCallOptions("remote", softwareName, variables, binaryDescriptor, softPackage)
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
swToRunCmdOptions := func(softwareName, softwareVersion, softwareDescriptor) {
|
|
300
|
-
ll.assert(is_string(softwareName),
|
|
301
|
-
"exec.internal.swToRunCmdOptions: software name must be a string, got %v", softwareName)
|
|
302
|
-
ll.assert(is_string(softwareVersion),
|
|
303
|
-
"exec.internal.swToRunCmdOptions: software version must be a string, got %v", softwareVersion)
|
|
304
|
-
validation.assertType(softwareDescriptor, desc.scheme,
|
|
305
|
-
"exec.internal.swToRunCmdOptions: descriptor does not fit schema")
|
|
306
|
-
|
|
307
|
-
result := undefined
|
|
308
|
-
if maps.containsKey(softwareDescriptor, "local") {
|
|
309
|
-
result = _devLocalPackageCallOptions(softwareName, softwareDescriptor.local)
|
|
310
|
-
} else if maps.containsKey(softwareDescriptor, "binary") {
|
|
311
|
-
result = _remotePackageCallOptions(softwareName, softwareDescriptor.binary)
|
|
312
|
-
} else {
|
|
313
|
-
ll.panic(
|
|
314
|
-
"Unable to run software %s v%s: 'binary' execution mode is not enabled in software descriptor",
|
|
315
|
-
softwareName, softwareVersion)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return ll.toStrict({
|
|
321
|
-
runEnvType: result.runEnvType,
|
|
322
|
-
variables: result.variables,
|
|
323
|
-
customPaths: result.customPaths,
|
|
324
|
-
cmd: result.cmd,
|
|
325
|
-
args: result.args,
|
|
326
|
-
envs: result.envs
|
|
327
|
-
})
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
binaryRunOptions := func(runOptions, mnzEnvs) {
|
|
331
|
-
validation.assertType(mnzEnvs, {"any": validation.reference})
|
|
332
|
-
|
|
333
|
-
runCmdOpts := undefined
|
|
334
|
-
if (is_undefined(ll.fromStrict(runOptions).software)) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
runCmdOpts = _directCallOptions(runOptions)
|
|
339
|
-
} else {
|
|
340
|
-
software := runOptions.software
|
|
341
|
-
descriptor := software.descriptor
|
|
342
|
-
|
|
343
|
-
runCmdOpts = swToRunCmdOptions(software.name, software.version, descriptor)
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
opts := ll.fromStrict(runOptions)
|
|
351
|
-
shouldUseNewTyped := !is_undefined(opts.argsTyped) || !is_undefined(opts.envsTyped)
|
|
352
|
-
|
|
353
|
-
args := shouldUseNewTyped ? runOptions.argsTyped : runOptions.args
|
|
354
|
-
for _, arg in args {
|
|
355
|
-
typedArg := shouldUseNewTyped ? _newTypedArg(arg.type, arg.value) : _newArg(true, arg)
|
|
356
|
-
runCmdOpts.args = append(runCmdOpts.args, typedArg)
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
envs := shouldUseNewTyped ? runOptions.envsTyped : runOptions.envs
|
|
360
|
-
for name, v in envs {
|
|
361
|
-
typedEnv := shouldUseNewTyped ? _newTypedArg(v.type, v.value) : _newArg(true, v)
|
|
362
|
-
runCmdOpts.envs[name] = typedEnv
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
for name, val in mnzEnvs { // can be empty
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
runCmdOpts.envs[name] = _newArg(false, _expr(_ARG_VAR_MNZ))
|
|
369
|
-
|
|
370
|
-
runCmdOpts.variables = append(runCmdOpts.variables,
|
|
371
|
-
_newRefVar(_ARG_VAR_MNZ, "monetization", val))
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
return oop.inherit(runOptions, ll.fromStrict(runCmdOpts))
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
prepareCommandRun := func(wd, opts) {
|
|
379
|
-
runBuilder := runcmd.builder(wd)
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
for varInfo in opts.variables {
|
|
383
|
-
runBuilder.ref(varInfo.refName, varInfo.reference)
|
|
384
|
-
runBuilder.substitutionRule(varInfo.varName, varInfo.refName)
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
for p in opts.customPaths {
|
|
389
|
-
runBuilder.addToPath(p.type, p.value)
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
for name, value in opts.envs {
|
|
394
|
-
runBuilder.envTyped(name, value.type, value.value)
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
return runBuilder
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
_activateRenv := func(wd, opts) {
|
|
401
|
-
activateRenv := prepareCommandRun(wd, opts)
|
|
402
|
-
activateRenv.
|
|
403
|
-
cmd("R").
|
|
404
|
-
inQueue(constants.LIGHT_QUEUE).
|
|
405
|
-
arg("-e").arg("renv::activate()")
|
|
406
|
-
|
|
407
|
-
activateRenvRun := activateRenv.build()
|
|
408
|
-
|
|
409
|
-
return activateRenvRun
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
prepareWDForRunEnvironment := func(wd, opts) {
|
|
413
|
-
if (!maps.containsKey(opts, "runEnvType")) {
|
|
414
|
-
return wd
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (opts.runEnvType == "R") {
|
|
418
|
-
return _activateRenv(wd, opts).workdir
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
return wd
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
export {
|
|
425
|
-
swToRunCmdOptions : swToRunCmdOptions,
|
|
426
|
-
binaryRunOptions : binaryRunOptions,
|
|
427
|
-
|
|
428
|
-
prepareWDForRunEnvironment : prepareWDForRunEnvironment,
|
|
429
|
-
prepareCommandRun : prepareCommandRun
|
|
430
|
-
}
|
|
Binary file
|