@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
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
|
|
2
|
-
declare type TplName = "ll.get-field" | "pframes.export-single-pcolumn" | "pframes.import-dir" | "pframes.remove-nulls" | "waiter.waiter" | "workdir.save" | "workflow.build-ctx" | "workflow.query-anchored" | "exec.
|
|
2
|
+
declare type TplName = "ll.get-field" | "pframes.export-single-pcolumn" | "pframes.import-dir" | "pframes.remove-nulls" | "waiter.waiter" | "workdir.save" | "workflow.build-ctx" | "workflow.query-anchored" | "exec.delayed-compute-allocation.impl" | "exec.monetization_to_json" | "exec.python.install-deps" | "exec.python.venv-bin-path" | "pframes.export-multiple-pcolumns" | "pframes.slice-data" | "check_network.create_workdir_from_storage" | "check_network.download_blob" | "check_network.upload_blob" | "check_network.upload_template" | "exec.R.create-renv" | "exec.exec-impl" | "exec.monetization_info" | "exec.python.create-venv" | "exec.load-software.impl" | "exec.exec" | "pframes.xsv-export-pframe" | "pframes.xsv-import-if-not-null" | "pframes.xsv-import-map" | "check_network.run_hello_world" | "check_network.run_hello_world_py" | "pframes.process-pcolumn-data" | "pframes.export-pframe" | "pframes.export-pframe-for-ui";
|
|
3
3
|
declare const Templates: Record<TplName, TemplateFromFile>;
|
|
4
4
|
export { Templates };
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,8 @@ module.exports = { Templates: {
|
|
|
7
7
|
'workdir.save': { type: 'from-file', path: require.resolve('./tengo/tpl/workdir.save.plj.gz') },
|
|
8
8
|
'workflow.build-ctx': { type: 'from-file', path: require.resolve('./tengo/tpl/workflow.build-ctx.plj.gz') },
|
|
9
9
|
'workflow.query-anchored': { type: 'from-file', path: require.resolve('./tengo/tpl/workflow.query-anchored.plj.gz') },
|
|
10
|
-
'exec.
|
|
11
|
-
'exec.
|
|
10
|
+
'exec.delayed-compute-allocation.impl': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz') },
|
|
11
|
+
'exec.monetization_to_json': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.monetization_to_json.plj.gz') },
|
|
12
12
|
'exec.python.install-deps': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.python.install-deps.plj.gz') },
|
|
13
13
|
'exec.python.venv-bin-path': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.python.venv-bin-path.plj.gz') },
|
|
14
14
|
'pframes.export-multiple-pcolumns': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.export-multiple-pcolumns.plj.gz') },
|
|
@@ -17,10 +17,12 @@ module.exports = { Templates: {
|
|
|
17
17
|
'check_network.download_blob': { type: 'from-file', path: require.resolve('./tengo/tpl/check_network.download_blob.plj.gz') },
|
|
18
18
|
'check_network.upload_blob': { type: 'from-file', path: require.resolve('./tengo/tpl/check_network.upload_blob.plj.gz') },
|
|
19
19
|
'check_network.upload_template': { type: 'from-file', path: require.resolve('./tengo/tpl/check_network.upload_template.plj.gz') },
|
|
20
|
+
'exec.R.create-renv': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.R.create-renv.plj.gz') },
|
|
21
|
+
'exec.exec-impl': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.exec-impl.plj.gz') },
|
|
22
|
+
'exec.monetization_info': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.monetization_info.plj.gz') },
|
|
20
23
|
'exec.python.create-venv': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.python.create-venv.plj.gz') },
|
|
21
|
-
'exec.
|
|
24
|
+
'exec.load-software.impl': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.load-software.impl.plj.gz') },
|
|
22
25
|
'exec.exec': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.exec.plj.gz') },
|
|
23
|
-
'exec.monetization_info': { type: 'from-file', path: require.resolve('./tengo/tpl/exec.monetization_info.plj.gz') },
|
|
24
26
|
'pframes.xsv-export-pframe': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.xsv-export-pframe.plj.gz') },
|
|
25
27
|
'pframes.xsv-import-if-not-null': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.xsv-import-if-not-null.plj.gz') },
|
|
26
28
|
'pframes.xsv-import-map': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.xsv-import-map.plj.gz') },
|
package/dist/index.mjs
CHANGED
|
@@ -8,8 +8,8 @@ export const Templates = {
|
|
|
8
8
|
'workdir.save': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/workdir.save.plj.gz') },
|
|
9
9
|
'workflow.build-ctx': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/workflow.build-ctx.plj.gz') },
|
|
10
10
|
'workflow.query-anchored': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/workflow.query-anchored.plj.gz') },
|
|
11
|
-
'exec.
|
|
12
|
-
'exec.
|
|
11
|
+
'exec.delayed-compute-allocation.impl': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz') },
|
|
12
|
+
'exec.monetization_to_json': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.monetization_to_json.plj.gz') },
|
|
13
13
|
'exec.python.install-deps': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.python.install-deps.plj.gz') },
|
|
14
14
|
'exec.python.venv-bin-path': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.python.venv-bin-path.plj.gz') },
|
|
15
15
|
'pframes.export-multiple-pcolumns': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.export-multiple-pcolumns.plj.gz') },
|
|
@@ -18,10 +18,12 @@ export const Templates = {
|
|
|
18
18
|
'check_network.download_blob': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/check_network.download_blob.plj.gz') },
|
|
19
19
|
'check_network.upload_blob': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/check_network.upload_blob.plj.gz') },
|
|
20
20
|
'check_network.upload_template': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/check_network.upload_template.plj.gz') },
|
|
21
|
+
'exec.R.create-renv': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.R.create-renv.plj.gz') },
|
|
22
|
+
'exec.exec-impl': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.exec-impl.plj.gz') },
|
|
23
|
+
'exec.monetization_info': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.monetization_info.plj.gz') },
|
|
21
24
|
'exec.python.create-venv': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.python.create-venv.plj.gz') },
|
|
22
|
-
'exec.
|
|
25
|
+
'exec.load-software.impl': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.load-software.impl.plj.gz') },
|
|
23
26
|
'exec.exec': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.exec.plj.gz') },
|
|
24
|
-
'exec.monetization_info': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/exec.monetization_info.plj.gz') },
|
|
25
27
|
'pframes.xsv-export-pframe': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.xsv-export-pframe.plj.gz') },
|
|
26
28
|
'pframes.xsv-import-if-not-null': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.xsv-import-if-not-null.plj.gz') },
|
|
27
29
|
'pframes.xsv-import-map': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.xsv-import-map.plj.gz') },
|
|
@@ -22,9 +22,12 @@ runRBuilder := func(operationMode, wd, rPackage, rDescriptor) {
|
|
|
22
22
|
rule := feats.commandExpressions ? "R" : "{R}"
|
|
23
23
|
|
|
24
24
|
builder := runcmd.builder(wd).
|
|
25
|
+
inQueue("light").
|
|
26
|
+
cpu(1).
|
|
27
|
+
mem("1GiB").
|
|
25
28
|
ref("r-run-environment", rPackage).
|
|
26
29
|
substitutionRule(rule, "r-run-environment").
|
|
27
|
-
|
|
30
|
+
addPathTyped(t, path.join("{R}", rDescriptor.binDir)).
|
|
28
31
|
envTyped("RHOME", t, "{R}").
|
|
29
32
|
envTyped("R_HOME_DIR", t, "{R}").
|
|
30
33
|
envTyped("RENV_PATHS_ROOT", t, path.join("{R}", "renv-root")).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
render := import("@platforma-sdk/workflow-tengo:render")
|
|
2
|
+
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
3
|
+
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
4
|
+
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
5
|
+
|
|
6
|
+
tpl := assets.importTemplate("@platforma-sdk/workflow-tengo:exec.delayed-compute-allocation.impl")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
create := func(workdir, req) {
|
|
20
|
+
validation.assertType(req, {
|
|
21
|
+
"queue": "string",
|
|
22
|
+
"cpu,?": "number",
|
|
23
|
+
"ram,?": ["or", "number", "string"]
|
|
24
|
+
}, "request must be a valid request")
|
|
25
|
+
|
|
26
|
+
reqMap := { queue: req.queue }
|
|
27
|
+
if !is_undefined(req.cpu) {
|
|
28
|
+
reqMap.cpu = req.cpu
|
|
29
|
+
}
|
|
30
|
+
if !is_undefined(req.ram) {
|
|
31
|
+
reqMap.ram = req.ram
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
delayedComputeAllocation := render.createEphemeral(tpl, {
|
|
35
|
+
request: smart.createJsonResource(reqMap),
|
|
36
|
+
wd: workdir
|
|
37
|
+
})
|
|
38
|
+
return delayedComputeAllocation.output("allocation")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
create: create
|
|
43
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
render := import("@platforma-sdk/workflow-tengo:render")
|
|
6
|
+
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
7
|
+
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
8
|
+
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
9
|
+
|
|
10
|
+
times := import("times")
|
|
11
|
+
|
|
12
|
+
loadSoftwareTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:exec.load-software.impl")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
loadSoftware := func(software) {
|
|
20
|
+
loadSoftwareResult := render.create(loadSoftwareTpl, {
|
|
21
|
+
software: smart.createJsonResource({
|
|
22
|
+
name: software.name,
|
|
23
|
+
version: software.version,
|
|
24
|
+
descriptor: ll.fromStrict(software.descriptor)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
return loadSoftwareResult.output("plan", 9 * times.hour * 24)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
loadSoftware: loadSoftware
|
|
32
|
+
}
|
|
@@ -6,6 +6,9 @@ assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
|
6
6
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
7
7
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
8
8
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
9
|
+
loadSoftware := import("@platforma-sdk/workflow-tengo:exec.load-software")
|
|
10
|
+
|
|
11
|
+
mnzSw := assets.importSoftware("@platforma-open/milaboratories.software-small-binaries:mnz-client")
|
|
9
12
|
|
|
10
13
|
mznInfoTpl := assets.importTemplate("@platforma-sdk/workflow-tengo:exec.monetization_info")
|
|
11
14
|
|
|
@@ -116,6 +119,8 @@ builder := func(productKey) {
|
|
|
116
119
|
build: func() {
|
|
117
120
|
ll.assert(!is_undefined(date), "monetization.builder().build: date must be set")
|
|
118
121
|
|
|
122
|
+
mnzPlan := loadSoftware.loadSoftware(mnzSw)
|
|
123
|
+
|
|
119
124
|
|
|
120
125
|
|
|
121
126
|
|
|
@@ -126,7 +131,8 @@ builder := func(productKey) {
|
|
|
126
131
|
date: date, // solely for deduplication
|
|
127
132
|
monetization: monetization.toJson(mnz),
|
|
128
133
|
filesToAdd: filesToAdd,
|
|
129
|
-
filesToWrite: filesToWrite
|
|
134
|
+
filesToWrite: filesToWrite,
|
|
135
|
+
mnzPlan: mnzPlan
|
|
130
136
|
}
|
|
131
137
|
)
|
|
132
138
|
|
|
@@ -4,17 +4,14 @@ base64 := import("base64")
|
|
|
4
4
|
json := import("json")
|
|
5
5
|
|
|
6
6
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
7
|
-
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
8
7
|
|
|
9
8
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
10
9
|
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
11
|
-
internal := import("@platforma-sdk/workflow-tengo:exec.internal")
|
|
12
10
|
fmt := import("fmt")
|
|
13
11
|
text := import("text")
|
|
14
12
|
runcmd := import("@platforma-sdk/workflow-tengo:exec.runcmd")
|
|
15
13
|
workdir := import("@platforma-sdk/workflow-tengo:workdir")
|
|
16
14
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
17
|
-
constants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
18
15
|
slices := import("@platforma-sdk/workflow-tengo:slices")
|
|
19
16
|
sets := import("@platforma-sdk/workflow-tengo:sets")
|
|
20
17
|
|
|
@@ -212,28 +209,26 @@ setUrl := func(mnz, url) {
|
|
|
212
209
|
|
|
213
210
|
|
|
214
211
|
|
|
215
|
-
run := func(mnz, wd, queue) {
|
|
216
|
-
_validateIsReady(mnz)
|
|
217
|
-
|
|
218
|
-
mnzSw := assets.importSoftware("@platforma-open/milaboratories.software-small-binaries:mnz-client")
|
|
219
|
-
|
|
220
|
-
exprType := feats.commandExpressions ? constants.ARG_TYPE_EXPRESSION : constants.ARG_TYPE_VAR
|
|
221
212
|
|
|
222
|
-
builder := runcmd.builder(wd)
|
|
223
|
-
builder.envTyped("MI_LICENSE", exprType, "{secrets.MI_LICENSE}")
|
|
224
213
|
|
|
225
|
-
|
|
214
|
+
run := func(mnz, wd, plan, queue, ...allocationOpt) {
|
|
215
|
+
_validateIsReady(mnz)
|
|
226
216
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
217
|
+
allocation := undefined
|
|
218
|
+
if len(allocationOpt) > 0 {
|
|
219
|
+
allocation = allocationOpt[0]
|
|
230
220
|
}
|
|
231
221
|
|
|
232
|
-
builder.
|
|
233
|
-
|
|
222
|
+
builder := runcmd.builder(wd, plan).
|
|
223
|
+
inQueue(queue)
|
|
234
224
|
|
|
235
|
-
|
|
225
|
+
if is_undefined(allocation) {
|
|
226
|
+
builder.cpu(1).mem("512MiB")
|
|
227
|
+
} else {
|
|
228
|
+
builder.allocation(allocation)
|
|
236
229
|
}
|
|
230
|
+
|
|
231
|
+
builder.envExpression("MI_LICENSE", "{secrets.MI_LICENSE}")
|
|
237
232
|
if mnz.isDryRun {
|
|
238
233
|
builder.arg("-dry-run")
|
|
239
234
|
}
|
|
@@ -252,7 +247,6 @@ run := func(mnz, wd, queue) {
|
|
|
252
247
|
}
|
|
253
248
|
}
|
|
254
249
|
|
|
255
|
-
builder.inQueue(queue)
|
|
256
250
|
stdoutName := "mnz_stdout.txt"
|
|
257
251
|
builder.stdout(stdoutName)
|
|
258
252
|
run := builder.build()
|