@platforma-sdk/workflow-tengo 2.15.10 → 2.15.12
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 +5 -2
- package/dist/tengo/lib/exec.monetization.lib.tengo +60 -11
- package/dist/tengo/lib/exec.monetization_internal.lib.tengo +61 -39
- package/dist/tengo/lib/pframes.lib.tengo +2 -2
- package/dist/tengo/lib/pframes.spec.lib.tengo +3 -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.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.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/package.json +2 -2
|
@@ -487,6 +487,9 @@ builder := func() {
|
|
|
487
487
|
|
|
488
488
|
enableMnz: func(productKey) {
|
|
489
489
|
monetization.enable(mnz, productKey)
|
|
490
|
+
|
|
491
|
+
monetization.appendRun(mnz)
|
|
492
|
+
|
|
490
493
|
return self
|
|
491
494
|
},
|
|
492
495
|
|
|
@@ -507,7 +510,7 @@ builder := func() {
|
|
|
507
510
|
|
|
508
511
|
fileName = path.canonize(fileName)
|
|
509
512
|
filesToAdd[fileName] = file
|
|
510
|
-
monetization.
|
|
513
|
+
monetization.addOptionalArg(mnz, fileName, opts...)
|
|
511
514
|
return self
|
|
512
515
|
},
|
|
513
516
|
|
|
@@ -540,7 +543,7 @@ builder := func() {
|
|
|
540
543
|
fileName = path.canonize(fileName)
|
|
541
544
|
|
|
542
545
|
filesToWrite[fileName] = data
|
|
543
|
-
monetization.
|
|
546
|
+
monetization.addOptionalArg(mnz, fileName, opts...)
|
|
544
547
|
|
|
545
548
|
return self
|
|
546
549
|
},
|
|
@@ -4,7 +4,6 @@ ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
|
4
4
|
monetization := import("@platforma-sdk/workflow-tengo:exec.monetization_internal")
|
|
5
5
|
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
6
6
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
7
|
-
path := import("@platforma-sdk/workflow-tengo:path")
|
|
8
7
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
9
8
|
validation := import("@platforma-sdk/workflow-tengo:validation")
|
|
10
9
|
|
|
@@ -31,30 +30,80 @@ builder := func(productKey) {
|
|
|
31
30
|
return self
|
|
32
31
|
},
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
addRun: func(...args) {
|
|
47
|
+
validation.assertType(args, [{
|
|
48
|
+
file: ["or", validation.reference, "string", "bytes"],
|
|
49
|
+
params: monetization.argSchema
|
|
50
|
+
}])
|
|
51
|
+
|
|
52
|
+
monetization.appendRun(mnz)
|
|
53
|
+
|
|
54
|
+
for _, arg in args {
|
|
55
|
+
if smart.isReference(arg.file) {
|
|
56
|
+
self.addFile(arg.file, arg.params)
|
|
57
|
+
} else {
|
|
58
|
+
self.writeFile(arg.file, arg.params)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return self
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
addFile: func(file, params) {
|
|
36
75
|
ll.assert(smart.isReference(file), "monetization.builder().addFile: file must be a reference")
|
|
37
76
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
77
|
+
filesToAdd[params.arg] = file
|
|
78
|
+
monetization.addArgToLastRun(mnz, params.arg, params)
|
|
79
|
+
|
|
41
80
|
return self
|
|
42
81
|
},
|
|
43
82
|
|
|
44
|
-
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
writeFile: func(data, params) {
|
|
45
93
|
validation.assertType(data, ["or",
|
|
46
94
|
"string",
|
|
47
95
|
"bytes",
|
|
48
96
|
validation.reference])
|
|
49
97
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
filesToWrite[fileName] = data
|
|
53
|
-
monetization.addFileParams(mnz, fileName, params)
|
|
98
|
+
filesToWrite[params.arg] = data
|
|
99
|
+
monetization.addArgToLastRun(mnz, params.arg, params)
|
|
54
100
|
|
|
55
101
|
return self
|
|
56
102
|
},
|
|
57
103
|
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
58
107
|
setUrl: func(url) {
|
|
59
108
|
monetization.setUrl(mnz, url)
|
|
60
109
|
return self
|
|
@@ -54,44 +54,31 @@ init := func() {
|
|
|
54
54
|
isDryRun: false,
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
|
|
58
|
+
runs: [],
|
|
58
59
|
|
|
59
60
|
|
|
60
61
|
url: undefined
|
|
61
62
|
})
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
argSchema := {
|
|
66
|
+
arg: "string",
|
|
67
|
+
metrics: [`string,regex=size|lines|sha256`]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
runSchema := {
|
|
71
|
+
"any": argSchema
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
schema := {
|
|
70
75
|
"enabled": "bool",
|
|
71
76
|
"productKey": "string",
|
|
72
77
|
"isDryRun": "bool",
|
|
73
|
-
"
|
|
78
|
+
"runs": [runSchema],
|
|
74
79
|
"url,?": "string"
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
_validateParams := func(params) {
|
|
80
|
-
ll.assert(ll.isMap(params), "monetization.validateParams(): mnz params must be a map")
|
|
81
|
-
|
|
82
|
-
ll.assert(is_string(params.arg), "monetization.validateParams(): 'arg' in addFileParams must be string")
|
|
83
|
-
|
|
84
|
-
ll.assert(is_array(params.collect) && len(params.collect) > 0, "monetization.validateParams(): 'collect' in {\"mnz\": {...}} param must be non-empty an array")
|
|
85
|
-
|
|
86
|
-
ll.assert(slices.every(params.collect, func(elem) {
|
|
87
|
-
return {
|
|
88
|
-
size: true,
|
|
89
|
-
lines: true,
|
|
90
|
-
sha256: true
|
|
91
|
-
}[elem]
|
|
92
|
-
}), "monetization.validateParams(): params in 'collect' must be either 'size', 'lines' or 'sha256'")
|
|
93
|
-
}
|
|
94
|
-
|
|
95
82
|
_validateIsReady := func(mnz) {
|
|
96
83
|
validation.assertType(mnz, schema,
|
|
97
84
|
"monetization.assertIsReady(): monetization does not fit schema")
|
|
@@ -132,23 +119,54 @@ toJson := func(mnz) {
|
|
|
132
119
|
return ll.fromStrict(mnz)
|
|
133
120
|
}
|
|
134
121
|
|
|
122
|
+
appendRun := func(mnz) {
|
|
123
|
+
validation.assertType(mnz, schema,
|
|
124
|
+
"monetization.appendRun(): monetization object does not fit json schema")
|
|
125
|
+
|
|
126
|
+
ll.assert(mnz.enabled,
|
|
127
|
+
"monetization.appendRun(): monetization must be explicitly enabled by enableMnz(productKey) function")
|
|
135
128
|
|
|
136
|
-
|
|
129
|
+
mnz.runs = append(mnz.runs, {})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
_validateArgToLastRun := func(arg) {
|
|
135
|
+
ll.assert(ll.isMap(arg), "monetization.validateArgToLastRun(): mnz arg must be a map")
|
|
136
|
+
|
|
137
|
+
ll.assert(is_string(arg.arg), "monetization.validateArgToLastRun(): 'arg' in addArgToLastRun must be string")
|
|
138
|
+
|
|
139
|
+
ll.assert(is_array(arg.metrics) && len(arg.metrics) > 0, "monetization.validateArgToLastRun(): 'metrics' in {\"mnz\": {...}} param must be a non-empty array")
|
|
140
|
+
|
|
141
|
+
ll.assert(slices.every(arg.metrics, func(elem) {
|
|
142
|
+
return {
|
|
143
|
+
size: true,
|
|
144
|
+
lines: true,
|
|
145
|
+
sha256: true
|
|
146
|
+
}[elem]
|
|
147
|
+
}), "monetization.validateArgToLastRun(): params in 'metrics' must be either 'size', 'lines' or 'sha256'")
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
addArgToLastRun := func(mnz, fileName, arg) {
|
|
137
152
|
validation.assertType(mnz, schema,
|
|
138
|
-
"monetization.
|
|
153
|
+
"monetization.addArgToLastRun(): monetization object does not fit json schema")
|
|
139
154
|
|
|
140
|
-
|
|
155
|
+
_validateArgToLastRun(arg)
|
|
141
156
|
|
|
142
|
-
validation.assertType(
|
|
143
|
-
"monetization.
|
|
157
|
+
validation.assertType(arg, argSchema,
|
|
158
|
+
"monetization.addArgToLastRun(): arg does not fit json schema")
|
|
144
159
|
|
|
145
160
|
ll.assert(mnz.enabled,
|
|
146
|
-
"monetization.
|
|
161
|
+
"monetization.addArgToLastRun(): monetization must be explicitly enabled by enableMnz(productKey) function")
|
|
147
162
|
|
|
148
163
|
ll.assert(is_string(fileName),
|
|
149
|
-
"monetization.
|
|
164
|
+
"monetization.addArgToLastRun(): file name must be a string.")
|
|
150
165
|
|
|
151
|
-
mnz.
|
|
166
|
+
ll.assert(len(mnz.runs) > 0,
|
|
167
|
+
"monetization.addArgToLastRun(): appendRun must be added first")
|
|
168
|
+
|
|
169
|
+
mnz.runs[len(mnz.runs) - 1][fileName] = arg
|
|
152
170
|
}
|
|
153
171
|
|
|
154
172
|
setDryRun := func(mnz, isDryRun) {
|
|
@@ -215,11 +233,13 @@ run := func(mnz, wd, queue) {
|
|
|
215
233
|
builder.arg("-productKey").arg(mnz.productKey)
|
|
216
234
|
|
|
217
235
|
|
|
218
|
-
for
|
|
236
|
+
for i, run in mnz.runs {
|
|
237
|
+
for fileName, arg in run {
|
|
219
238
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
239
|
+
toCollect := text.join(arg.metrics, ",")
|
|
240
|
+
runSpecPart := fmt.sprintf("%d:%s:file:%s:%s", i, arg.arg, fileName, toCollect)
|
|
241
|
+
builder.arg(runSpecPart)
|
|
242
|
+
}
|
|
223
243
|
}
|
|
224
244
|
|
|
225
245
|
builder.inQueue(queue)
|
|
@@ -266,23 +286,25 @@ _extractOption := func(...opts) {
|
|
|
266
286
|
}
|
|
267
287
|
|
|
268
288
|
|
|
269
|
-
|
|
289
|
+
addOptionalArg := func(mnz, fileName, ...opts) {
|
|
270
290
|
opt := _extractOption(opts...)
|
|
271
291
|
if !is_undefined(opt) {
|
|
272
|
-
|
|
292
|
+
addArgToLastRun(mnz, fileName, opt)
|
|
273
293
|
}
|
|
274
294
|
}
|
|
275
295
|
|
|
276
296
|
export ll.toStrict({
|
|
277
297
|
init: init,
|
|
278
298
|
schema: schema,
|
|
299
|
+
argSchema: argSchema,
|
|
279
300
|
enable: enable,
|
|
280
301
|
setDryRun: setDryRun,
|
|
281
302
|
setUrl: setUrl,
|
|
282
303
|
shouldRun: shouldRun,
|
|
283
304
|
toJson: toJson,
|
|
284
|
-
|
|
285
|
-
|
|
305
|
+
appendRun: appendRun,
|
|
306
|
+
addArgToLastRun: addArgToLastRun,
|
|
307
|
+
addOptionalArg: addOptionalArg,
|
|
286
308
|
run: run,
|
|
287
309
|
mnzClientStdoutSchema: mnzClientStdoutSchema
|
|
288
310
|
})
|
|
@@ -204,8 +204,8 @@ processColumn := func(input, bodyTpl, outputs, ...opts) {
|
|
|
204
204
|
|
|
205
205
|
|
|
206
206
|
trace := undefined
|
|
207
|
-
if !is_undefined(opts.traceSteps) {
|
|
208
|
-
trace = pSpec.makeTrace(input.spec, opts.traceSteps...)
|
|
207
|
+
if !is_undefined(opts.traceSteps) || !is_undefined(input.spec.annotations[pSpec.A_TRACE]) {
|
|
208
|
+
trace = pSpec.makeTrace(input.spec, (opts.traceSteps ? opts.traceSteps : [])...)
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
|
|
@@ -235,7 +235,9 @@ makeTrace := func(input, ...steps) {
|
|
|
235
235
|
validation.assertType(currentTrace, _TRACE_SCHEMA)
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
if len(steps) > 0 {
|
|
239
|
+
currentTrace = append(currentTrace, steps...)
|
|
240
|
+
}
|
|
239
241
|
currentTraceStr := string(json.encode(currentTrace))
|
|
240
242
|
|
|
241
243
|
return ll.toStrict({
|
|
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/workflow-tengo",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.12",
|
|
4
4
|
"description": "Tengo SDK library",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@milaboratories/software-pframes-conv": "2.1.16",
|
|
20
|
-
"@platforma-open/milaboratories.software-small-binaries": "^1.15.
|
|
20
|
+
"@platforma-open/milaboratories.software-small-binaries": "^1.15.16"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@platforma-sdk/tengo-builder": "^1.19.2"
|