@platforma-sdk/workflow-tengo 6.17.3 → 6.19.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.cjs +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/tengo/lib/action-context.lib.tengo +296 -0
- package/dist/tengo/lib/assets.lib.tengo +22 -1
- package/dist/tengo/lib/exec.limits.lib.tengo +3 -0
- package/dist/tengo/lib/exec.runcmd.lib.tengo +4 -0
- package/dist/tengo/lib/feats.lib.tengo +9 -1
- package/dist/tengo/lib/pframes.bundle.lib.tengo +30 -5
- package/dist/tengo/lib/pframes.table-builder.lib.tengo +58 -17
- package/dist/tengo/lib/render.lib.tengo +30 -0
- package/dist/tengo/lib/smart.lib.tengo +10 -0
- package/dist/tengo/lib/tpl.base.lib.tengo +11 -0
- package/dist/tengo/lib/v2.bquery.lib.tengo +9 -0
- package/dist/tengo/lib/v2.exports.lib.tengo +141 -0
- package/dist/tengo/lib/v2.node-rules.lib.tengo +102 -0
- package/dist/tengo/lib/v2.workflow.lib.tengo +281 -0
- package/dist/tengo/lib/workdir.lib.tengo +4 -0
- package/dist/tengo/lib/workdir.save.lib.tengo +3 -0
- package/dist/tengo/lib/workflow.bquery.lib.tengo +218 -26
- package/dist/tengo/tpl/annotations.compute.plj.gz +0 -0
- package/dist/tengo/tpl/anonymize.deanonymize.plj.gz +0 -0
- package/dist/tengo/tpl/anonymize.impl.plj.gz +0 -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/check_network.workdir_type_name_extractor.plj.gz +0 -0
- package/dist/tengo/tpl/exec.conda.create-env.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.build-table.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.export-parquet-pcolumn-chunk.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.merge-resource-maps.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.parse-to-json.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.process-pcolumn-batch-split.plj.gz +0 -0
- package/dist/tengo/tpl/pframes.process-pcolumn-batch.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/pt.import-dir.plj.gz +0 -0
- package/dist/tengo/tpl/pt.workflow-run.plj.gz +0 -0
- package/dist/tengo/tpl/v2.export-collection-for-ui.plj.gz +0 -0
- package/dist/tengo/tpl/v2.export-for-ui.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/dist/tengo/tpl/workflow.query-context-filter.plj.gz +0 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -43,5 +43,7 @@ module.exports = { Templates: {
|
|
|
43
43
|
'pframes.process-pcolumn-batch': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.process-pcolumn-batch.plj.gz') },
|
|
44
44
|
'pframes.process-pcolumn-data': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.process-pcolumn-data.plj.gz') },
|
|
45
45
|
'pframes.export-pframe': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.export-pframe.plj.gz') },
|
|
46
|
+
'v2.export-collection-for-ui': { type: 'from-file', path: require.resolve('./tengo/tpl/v2.export-collection-for-ui.plj.gz') },
|
|
47
|
+
'v2.export-for-ui': { type: 'from-file', path: require.resolve('./tengo/tpl/v2.export-for-ui.plj.gz') },
|
|
46
48
|
'pframes.export-pframe-for-ui': { type: 'from-file', path: require.resolve('./tengo/tpl/pframes.export-pframe-for-ui.plj.gz') }
|
|
47
49
|
}};
|
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-parquet-pcolumn-chunk" | "pframes.export-single-pcolumn" | "pframes.import-dir" | "pframes.merge-resource-maps" | "pframes.remove-nulls" | "pt.import-dir" | "waiter.waiter" | "workdir.save" | "workflow.build-ctx" | "workflow.query-context-filter" | "anonymize.deanonymize" | "anonymize.impl" | "check_network.workdir_type_name_extractor" | "exec.delayed-compute-allocation.impl" | "exec.monetization_to_json" | "exec.python.install-deps" | "exec.python.venv-bin-path" | "pframes.export-multiple-pcolumns" | "workflow.query-anchored" | "check_network.create_workdir_from_storage" | "exec.conda.create-env" | "exec.exec-impl" | "exec.monetization_info" | "exec.python.create-venv" | "pframes.slice-data" | "check_network.download_blob" | "check_network.upload_blob" | "check_network.upload_template" | "exec.load-software.impl" | "pframes.parse-to-json" | "exec.exec" | "pt.workflow-run" | "check_network.run_hello_world" | "check_network.run_hello_world_py" | "pframes.build-table" | "pframes.xsv-export-pframe" | "pframes.xsv-import-if-not-null" | "pframes.xsv-import-map" | "annotations.compute" | "pframes.process-pcolumn-batch-split" | "pframes.process-pcolumn-batch" | "pframes.process-pcolumn-data" | "pframes.export-pframe" | "pframes.export-pframe-for-ui";
|
|
2
|
+
declare type TplName = "ll.get-field" | "pframes.export-parquet-pcolumn-chunk" | "pframes.export-single-pcolumn" | "pframes.import-dir" | "pframes.merge-resource-maps" | "pframes.remove-nulls" | "pt.import-dir" | "waiter.waiter" | "workdir.save" | "workflow.build-ctx" | "workflow.query-context-filter" | "anonymize.deanonymize" | "anonymize.impl" | "check_network.workdir_type_name_extractor" | "exec.delayed-compute-allocation.impl" | "exec.monetization_to_json" | "exec.python.install-deps" | "exec.python.venv-bin-path" | "pframes.export-multiple-pcolumns" | "workflow.query-anchored" | "check_network.create_workdir_from_storage" | "exec.conda.create-env" | "exec.exec-impl" | "exec.monetization_info" | "exec.python.create-venv" | "pframes.slice-data" | "check_network.download_blob" | "check_network.upload_blob" | "check_network.upload_template" | "exec.load-software.impl" | "pframes.parse-to-json" | "exec.exec" | "pt.workflow-run" | "check_network.run_hello_world" | "check_network.run_hello_world_py" | "pframes.build-table" | "pframes.xsv-export-pframe" | "pframes.xsv-import-if-not-null" | "pframes.xsv-import-map" | "annotations.compute" | "pframes.process-pcolumn-batch-split" | "pframes.process-pcolumn-batch" | "pframes.process-pcolumn-data" | "pframes.export-pframe" | "v2.export-collection-for-ui" | "v2.export-for-ui" | "pframes.export-pframe-for-ui";
|
|
3
3
|
declare const Templates: Record<TplName, TemplateFromFile>;
|
|
4
4
|
export { Templates };
|
package/dist/index.js
CHANGED
|
@@ -44,5 +44,7 @@ export const Templates = {
|
|
|
44
44
|
'pframes.process-pcolumn-batch': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.process-pcolumn-batch.plj.gz') },
|
|
45
45
|
'pframes.process-pcolumn-data': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.process-pcolumn-data.plj.gz') },
|
|
46
46
|
'pframes.export-pframe': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.export-pframe.plj.gz') },
|
|
47
|
+
'v2.export-collection-for-ui': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/v2.export-collection-for-ui.plj.gz') },
|
|
48
|
+
'v2.export-for-ui': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/v2.export-for-ui.plj.gz') },
|
|
47
49
|
'pframes.export-pframe-for-ui': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/pframes.export-pframe-for-ui.plj.gz') }
|
|
48
50
|
};
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
31
|
+
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
32
|
+
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
33
|
+
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
34
|
+
json := import("json")
|
|
35
|
+
slices := import("@platforma-sdk/workflow-tengo:slices")
|
|
36
|
+
text := import("text")
|
|
37
|
+
times := import("times")
|
|
38
|
+
tx := import("tx")
|
|
39
|
+
|
|
40
|
+
LINK_FIELD := "actionContext"
|
|
41
|
+
STATES := ["WaitingForInputs", "Running", "WaitingWorkdirGate", "WaitingSubmissionGate", "PopulatingWorkdir",
|
|
42
|
+
"CollectingOutputs", "WaitingForScheduler", "WaitingForMachine", "Terminated", "Completed"]
|
|
43
|
+
CHILD_FIELD_PREFIX := "child/"
|
|
44
|
+
CONTEXT_TYPE := { Name: "ActionContext", Version: "1" }
|
|
45
|
+
SINKHOLE_TYPE := { Name: "ActionSinkhole", Version: "1" }
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
_vars := func() {
|
|
50
|
+
return ll.moduleVars("action-context")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
linkOf := func(rid) {
|
|
60
|
+
fields := tx.getResource(rid).ServiceFields
|
|
61
|
+
if !maps.containsKey(fields, LINK_FIELD) || fields[LINK_FIELD].Value == 0 {
|
|
62
|
+
return { kind: "none" }
|
|
63
|
+
}
|
|
64
|
+
target := fields[LINK_FIELD].Value
|
|
65
|
+
if tx.getResource(target).Type.Name == CONTEXT_TYPE.Name {
|
|
66
|
+
return { kind: "context", id: target }
|
|
67
|
+
}
|
|
68
|
+
return { kind: "sinkhole", id: target }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
contextOf := func(rid) {
|
|
76
|
+
link := linkOf(rid)
|
|
77
|
+
return link.kind == "context" ? link.id : undefined
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_own := func() {
|
|
81
|
+
vars := _vars()
|
|
82
|
+
own := vars.get("own")
|
|
83
|
+
if is_undefined(own) {
|
|
84
|
+
own = linkOf(ll.getCurrentTemplateRenderer().ID)
|
|
85
|
+
vars.set("own", own)
|
|
86
|
+
}
|
|
87
|
+
return own
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
_ownBaggage := func() {
|
|
91
|
+
vars := _vars()
|
|
92
|
+
baggage := vars.get("ownBaggage")
|
|
93
|
+
if is_undefined(baggage) {
|
|
94
|
+
baggage = {}
|
|
95
|
+
raw := tx.getResource(_own().id).Data
|
|
96
|
+
if !is_undefined(raw) && len(raw) > 0 {
|
|
97
|
+
baggage = json.decode(raw)
|
|
98
|
+
}
|
|
99
|
+
vars.set("ownBaggage", baggage)
|
|
100
|
+
}
|
|
101
|
+
return copy(baggage)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_childFieldName := func() {
|
|
105
|
+
vars := _vars()
|
|
106
|
+
counter := vars.get("childCounter")
|
|
107
|
+
counter = is_undefined(counter) ? 0 : counter + 1
|
|
108
|
+
vars.set("childCounter", counter)
|
|
109
|
+
return CHILD_FIELD_PREFIX + string(times.time_unix_nano(times.now())) + "-" + string(counter)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
_enabled := func() {
|
|
115
|
+
return feats.kvAsync && feats.optionalFieldsInSchemas
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
_link := func(rid, target) {
|
|
119
|
+
if !_enabled() {
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
field := ll.fieldId(rid, LINK_FIELD)
|
|
123
|
+
tx.createField(field, constants.FTYPE_SERVICE)
|
|
124
|
+
tx.setFieldToResource(field, target)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
_validateKeyPart := func(name, part) {
|
|
128
|
+
ll.assert(is_string(part) && len(part) > 0, "action context: %s must be a non-empty string", name)
|
|
129
|
+
ll.assert(!text.contains(part, "/"), "action context: %s %q contains \"/\"", name, part)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
_createLinked := func(rid, type, baggage) {
|
|
133
|
+
id := tx.createEphemeral(type.Name, type.Version, json.encode(baggage))
|
|
134
|
+
_link(rid, id)
|
|
135
|
+
return id
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
_childBaggage := func(name) {
|
|
140
|
+
baggage := _own().kind == "none" ? {} : _ownBaggage()
|
|
141
|
+
if !is_undefined(name) {
|
|
142
|
+
baggage.name = name
|
|
143
|
+
}
|
|
144
|
+
return baggage
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
sinkhole := func(rid, ...name) {
|
|
157
|
+
if _enabled() {
|
|
158
|
+
_createLinked(rid, SINKHOLE_TYPE, _childBaggage(len(name) > 0 ? name[0] : undefined))
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
inherit := func(rid) {
|
|
171
|
+
own := _own()
|
|
172
|
+
if own.kind != "none" {
|
|
173
|
+
_link(rid, own.id)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
createContext := func(rid, baggage) {
|
|
187
|
+
return _enabled() ? _createLinked(rid, CONTEXT_TYPE, copy(baggage)) : undefined
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
createChild := func(rid, name) {
|
|
200
|
+
if !_enabled() {
|
|
201
|
+
return undefined
|
|
202
|
+
}
|
|
203
|
+
own := _own()
|
|
204
|
+
if own.kind == "none" {
|
|
205
|
+
return undefined
|
|
206
|
+
}
|
|
207
|
+
if own.kind == "sinkhole" {
|
|
208
|
+
sinkhole(rid, name)
|
|
209
|
+
return undefined
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
contextId := _createLinked(rid, CONTEXT_TYPE, _childBaggage(name))
|
|
213
|
+
|
|
214
|
+
childField := ll.fieldId(own.id, _childFieldName())
|
|
215
|
+
tx.createField(childField, constants.FTYPE_DYNAMIC)
|
|
216
|
+
tx.setFieldToResource(childField, contextId)
|
|
217
|
+
|
|
218
|
+
return contextId
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
of := func(rid) {
|
|
231
|
+
contextId := func() {
|
|
232
|
+
return _enabled() ? contextOf(rid) : undefined
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return ll.toStrict({
|
|
236
|
+
setReading: func(namespace, key, value) {
|
|
237
|
+
_validateKeyPart("namespace", namespace)
|
|
238
|
+
_validateKeyPart("reading key", key)
|
|
239
|
+
ctx := contextId()
|
|
240
|
+
if !is_undefined(ctx) {
|
|
241
|
+
tx.resourceKeyValueSetAsync(ctx, "reading/" + namespace + "/" + string(rid) + "/" + key, value)
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
record: func(namespace, state, ...detail) {
|
|
246
|
+
_validateKeyPart("namespace", namespace)
|
|
247
|
+
ll.assert(slices.hasElement(STATES, state), "action context: unknown state %q", state)
|
|
248
|
+
ctx := contextId()
|
|
249
|
+
if !is_undefined(ctx) {
|
|
250
|
+
key := "transition/" + namespace + "/" + string(rid) + "/" + string(times.time_unix_nano(times.now()))
|
|
251
|
+
value := json.encode({ state: state, detail: len(detail) > 0 ? detail[0] : "", reason: "" })
|
|
252
|
+
tx.resourceKeyValueSetAsync(ctx, key, value)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
self := func() {
|
|
268
|
+
renderer := ll.getCurrentTemplateRenderer().ID
|
|
269
|
+
handle := of(renderer)
|
|
270
|
+
return ll.toStrict({
|
|
271
|
+
setReading: handle.setReading,
|
|
272
|
+
record: handle.record,
|
|
273
|
+
|
|
274
|
+
baggage: func() {
|
|
275
|
+
return _own().kind == "none" ? undefined : _ownBaggage()
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
id: func() {
|
|
279
|
+
return _own().kind == "context" ? _own().id : undefined
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export ll.toStrict({
|
|
285
|
+
LINK_FIELD: LINK_FIELD,
|
|
286
|
+
CHILD_FIELD_PREFIX: CHILD_FIELD_PREFIX,
|
|
287
|
+
|
|
288
|
+
linkOf: linkOf,
|
|
289
|
+
contextOf: contextOf,
|
|
290
|
+
createChild: createChild,
|
|
291
|
+
createContext: createContext,
|
|
292
|
+
inherit: inherit,
|
|
293
|
+
sinkhole: sinkhole,
|
|
294
|
+
of: of,
|
|
295
|
+
self: self
|
|
296
|
+
})
|
|
@@ -18,8 +18,28 @@ maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
_templateNames := func() {
|
|
25
|
+
return ll.moduleVars("assets.templateNames")
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
importTemplate := func(tplName) {
|
|
22
|
-
|
|
29
|
+
id := plapi.getTemplateId(tplName)
|
|
30
|
+
_templateNames().set(string(id), tplName)
|
|
31
|
+
return smart.resource(id)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
templateName := func(tpl) {
|
|
41
|
+
id := smart.isResource(tpl) ? tpl.id : tpl
|
|
42
|
+
return _templateNames().get(string(id))
|
|
23
43
|
}
|
|
24
44
|
|
|
25
45
|
|
|
@@ -66,6 +86,7 @@ isAssetInfo := func(toCheck) {
|
|
|
66
86
|
|
|
67
87
|
export ll.toStrict({
|
|
68
88
|
importTemplate : importTemplate,
|
|
89
|
+
templateName : templateName,
|
|
69
90
|
importSoftware : swinfo.importSoftware,
|
|
70
91
|
isSoftwareInfo : swinfo.isSoftwareInfo,
|
|
71
92
|
importAsset : importAsset,
|
|
@@ -13,6 +13,7 @@ smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
|
13
13
|
json := import("json")
|
|
14
14
|
constants := import("@platforma-sdk/workflow-tengo:exec.constants")
|
|
15
15
|
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
16
|
+
actionContext := import("@platforma-sdk/workflow-tengo:action-context")
|
|
16
17
|
|
|
17
18
|
_RTYPE_QUOTA := { Name: "Quota", Version: "1" }
|
|
18
19
|
|
|
@@ -278,6 +279,8 @@ computeRequestBuilder := func() {
|
|
|
278
279
|
|
|
279
280
|
requestBuilder.getField(_CR_FIELD_REQUEST).set(quota)
|
|
280
281
|
|
|
282
|
+
|
|
283
|
+
actionContext.inherit(requestBuilder.id)
|
|
281
284
|
requestRef := requestBuilder.lockAndBuild()
|
|
282
285
|
|
|
283
286
|
return ll.toStrict(
|
|
@@ -17,6 +17,7 @@ slices := import("@platforma-sdk/workflow-tengo:slices")
|
|
|
17
17
|
limits := import("@platforma-sdk/workflow-tengo:exec.limits")
|
|
18
18
|
|
|
19
19
|
delayedCompAlloc := import("@platforma-sdk/workflow-tengo:exec.delayed-compute-allocation")
|
|
20
|
+
actionContext := import("@platforma-sdk/workflow-tengo:action-context")
|
|
20
21
|
|
|
21
22
|
_RTYPE_RUN_COMMAND_V1 := { Name: "RunCommand/executor", Version: "1" }
|
|
22
23
|
_RTYPE_RUN_COMMAND_CMD := { Name: "RunCommandCmd", Version: "1" }
|
|
@@ -776,6 +777,9 @@ builder := func(workdir, ...initialState) {
|
|
|
776
777
|
argsRes := smart.createValueResource(_RTYPE_RUN_COMMAND_ARGS, json.encode(options.args))
|
|
777
778
|
runRes.getField(_FIELD_ARGS).set(argsRes)
|
|
778
779
|
|
|
780
|
+
|
|
781
|
+
actionContext.inherit(runRes.id)
|
|
782
|
+
|
|
779
783
|
res := oop.inherit(runRes.lockAndBuild(), {
|
|
780
784
|
"workdir": runRes.outputs()[_FIELD_WORKDIR_OUT],
|
|
781
785
|
"options": buildOptions
|
|
@@ -97,5 +97,13 @@ export ll.toStrict({
|
|
|
97
97
|
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
multiStepProgress: _isEnabled("multiStepProgress")
|
|
100
|
+
multiStepProgress: _isEnabled("multiStepProgress"),
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
kvAsync: _isEnabled("kvAsync"),
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
optionalFieldsInSchemas: _isEnabled("optionalFieldsInSchemas") || _isEnabled("optionalServiceField")
|
|
101
109
|
})
|
|
@@ -65,7 +65,8 @@ render := import("@platforma-sdk/workflow-tengo:render")
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
createBuilderWith := func(q, ctx) {
|
|
69
70
|
|
|
70
71
|
|
|
71
72
|
|
|
@@ -117,6 +118,9 @@ createBuilder := func(ctx) {
|
|
|
117
118
|
|
|
118
119
|
|
|
119
120
|
isGlobalRef := is_map(decodedId) && decodedId.__isRef == true
|
|
121
|
+
if isGlobalRef && maps.containsKey(q, "isRef") {
|
|
122
|
+
ll.panic("serialized value ids are not supported by this query API; add a ref {block, workflow, name} with addRef, got %v", id)
|
|
123
|
+
}
|
|
120
124
|
if isGlobalRef {
|
|
121
125
|
refKey := is_string(id) ? id : canonical.encode(decodedId)
|
|
122
126
|
if !is_undefined(queryKey) {
|
|
@@ -305,7 +309,7 @@ createBuilder := func(ctx) {
|
|
|
305
309
|
build: func() {
|
|
306
310
|
|
|
307
311
|
|
|
308
|
-
resolveResult :=
|
|
312
|
+
resolveResult := q.anchoredQuery(ctx, anchors, queries, anchoredQueryOpts)
|
|
309
313
|
|
|
310
314
|
bundle := smart.mapBuilder(pConstants.RTYPE_P_COLUMN_BUNDLE)
|
|
311
315
|
|
|
@@ -314,7 +318,7 @@ createBuilder := func(ctx) {
|
|
|
314
318
|
bundle.addRef(refKey, resolveResult.getAnchor(ref))
|
|
315
319
|
bundle.addRef(ref, resolveResult.getAnchor(ref))
|
|
316
320
|
} else {
|
|
317
|
-
bundle.addRef(refKey,
|
|
321
|
+
bundle.addRef(refKey, q.resolve(ref, ctx))
|
|
318
322
|
}
|
|
319
323
|
}
|
|
320
324
|
|
|
@@ -334,6 +338,15 @@ createBuilder := func(ctx) {
|
|
|
334
338
|
|
|
335
339
|
|
|
336
340
|
|
|
341
|
+
createBuilder := func(ctx) {
|
|
342
|
+
return createBuilderWith(bquery, ctx)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
337
350
|
|
|
338
351
|
|
|
339
352
|
|
|
@@ -392,6 +405,17 @@ pColumnBundleUnmarshaller := func() {
|
|
|
392
405
|
|
|
393
406
|
result := bResultUnmarshaller.parse(value.getValue(), parser)
|
|
394
407
|
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
dataOf := func(r) {
|
|
412
|
+
if !ll.isMap(r) || maps.containsKey(r, "data") || !maps.containsKey(r, "ref") ||
|
|
413
|
+
!ll.isMap(r.ref) || !maps.containsKey(r.ref, "block") {
|
|
414
|
+
return r.data
|
|
415
|
+
}
|
|
416
|
+
return undefined
|
|
417
|
+
}
|
|
418
|
+
|
|
395
419
|
if is_array(result) {
|
|
396
420
|
arr := []
|
|
397
421
|
for i, r in result {
|
|
@@ -400,7 +424,7 @@ pColumnBundleUnmarshaller := func() {
|
|
|
400
424
|
el := {
|
|
401
425
|
key: k,
|
|
402
426
|
spec: r.spec,
|
|
403
|
-
data: r
|
|
427
|
+
data: dataOf(r)
|
|
404
428
|
}
|
|
405
429
|
pool[k] = el
|
|
406
430
|
arr = append(arr, el)
|
|
@@ -410,7 +434,7 @@ pColumnBundleUnmarshaller := func() {
|
|
|
410
434
|
pool[resultKey] = {
|
|
411
435
|
key: resultKey,
|
|
412
436
|
spec: result.spec,
|
|
413
|
-
data: result
|
|
437
|
+
data: dataOf(result)
|
|
414
438
|
}
|
|
415
439
|
}
|
|
416
440
|
}
|
|
@@ -611,5 +635,6 @@ pColumnBundleUnmarshaller := func() {
|
|
|
611
635
|
|
|
612
636
|
export ll.toStrict({
|
|
613
637
|
createBuilder: createBuilder,
|
|
638
|
+
createBuilderWith: createBuilderWith,
|
|
614
639
|
pColumnBundleUnmarshaller: pColumnBundleUnmarshaller
|
|
615
640
|
})
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
25
|
|
|
28
26
|
|
|
29
27
|
|
|
@@ -148,6 +146,29 @@ isQuerySpec := func(q) {
|
|
|
148
146
|
|
|
149
147
|
|
|
150
148
|
|
|
149
|
+
holdsRef := func(value, isRef) {
|
|
150
|
+
stack := [value]
|
|
151
|
+
si := 0
|
|
152
|
+
for si < len(stack) {
|
|
153
|
+
v := stack[si]
|
|
154
|
+
si += 1
|
|
155
|
+
if isRef(v) { return true }
|
|
156
|
+
if ll.isMap(v) {
|
|
157
|
+
if isResolvedColumn(v) { continue }
|
|
158
|
+
for _, child in v {
|
|
159
|
+
stack = append(stack, child)
|
|
160
|
+
}
|
|
161
|
+
} else if is_array(v) {
|
|
162
|
+
for _, child in v {
|
|
163
|
+
stack = append(stack, child)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return false
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
151
172
|
|
|
152
173
|
|
|
153
174
|
|
|
@@ -157,7 +178,16 @@ isQuerySpec := func(q) {
|
|
|
157
178
|
|
|
158
179
|
|
|
159
180
|
|
|
160
|
-
|
|
181
|
+
tableBuilderWith := func(q, format, ...ctxArg) {
|
|
182
|
+
|
|
183
|
+
unresolved := isUnresolved
|
|
184
|
+
if maps.containsKey(q, "isRef") {
|
|
185
|
+
unresolved = func(value) { return holdsRef(value, q.isRef) }
|
|
186
|
+
}
|
|
187
|
+
querySpec := func(v) {
|
|
188
|
+
return !unresolved(v) && !isResolvedColumn(v) && !isEnrichmentRef(v)
|
|
189
|
+
}
|
|
190
|
+
|
|
161
191
|
ll.assert(!is_undefined(VALID_FORMATS[format]),
|
|
162
192
|
"format must be one of [tsv, csv, parquet, ndjson], got '%s'", format)
|
|
163
193
|
|
|
@@ -194,7 +224,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
194
224
|
header = opts[0].header
|
|
195
225
|
}
|
|
196
226
|
|
|
197
|
-
unresolved :=
|
|
227
|
+
unresolved := unresolved(value)
|
|
198
228
|
if !unresolved {
|
|
199
229
|
ll.assert(
|
|
200
230
|
isResolvedColumn(value) ||
|
|
@@ -232,7 +262,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
232
262
|
header = opts[0].header
|
|
233
263
|
}
|
|
234
264
|
join := columnJoinOpt(opts)
|
|
235
|
-
if
|
|
265
|
+
if unresolved(query) || isEnrichmentRef(query) {
|
|
236
266
|
_hasUnresolved = true
|
|
237
267
|
}
|
|
238
268
|
_columns = append(_columns, {
|
|
@@ -283,7 +313,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
283
313
|
entrySuffix = undefined
|
|
284
314
|
}
|
|
285
315
|
|
|
286
|
-
if
|
|
316
|
+
if unresolved(entryQuery) || isEnrichmentRef(entryQuery) {
|
|
287
317
|
_hasUnresolved = true
|
|
288
318
|
}
|
|
289
319
|
_columns = append(_columns, {
|
|
@@ -298,7 +328,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
298
328
|
return self
|
|
299
329
|
}
|
|
300
330
|
|
|
301
|
-
if
|
|
331
|
+
if unresolved(query) || isEnrichmentRef(query) {
|
|
302
332
|
_hasUnresolved = true
|
|
303
333
|
}
|
|
304
334
|
_columns = append(_columns, {
|
|
@@ -406,7 +436,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
406
436
|
|
|
407
437
|
hasQuerySpec := false
|
|
408
438
|
for _, c in _columns {
|
|
409
|
-
if
|
|
439
|
+
if querySpec(c.query) {
|
|
410
440
|
hasQuerySpec = true
|
|
411
441
|
break
|
|
412
442
|
}
|
|
@@ -421,15 +451,18 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
421
451
|
|
|
422
452
|
resolveColumn := func(value) {
|
|
423
453
|
if is_string(value) {
|
|
454
|
+
if maps.containsKey(q, "isRef") {
|
|
455
|
+
ll.panic("serialized value ids are not supported by this query API; pass a ref {block, workflow, name}, got %v", value)
|
|
456
|
+
}
|
|
424
457
|
ref := decodeGlobalPObjectId(value)
|
|
425
|
-
r :=
|
|
458
|
+
r := q.resolve(ref, _ctx)
|
|
426
459
|
return {
|
|
427
460
|
spec: r.getFutureInputField("spec"),
|
|
428
461
|
data: r.getFutureInputField("data")
|
|
429
462
|
}
|
|
430
463
|
}
|
|
431
|
-
if
|
|
432
|
-
r :=
|
|
464
|
+
if unresolved(value) {
|
|
465
|
+
r := q.resolve(value, _ctx)
|
|
433
466
|
return {
|
|
434
467
|
spec: r.getFutureInputField("spec"),
|
|
435
468
|
data: r.getFutureInputField("data")
|
|
@@ -462,7 +495,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
462
495
|
data: resolvedCol.data,
|
|
463
496
|
filters: []
|
|
464
497
|
}
|
|
465
|
-
if
|
|
498
|
+
if unresolved(column) {
|
|
466
499
|
primaryPlRefs[p.name] = column
|
|
467
500
|
}
|
|
468
501
|
|
|
@@ -487,7 +520,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
487
520
|
multiQueryResultByIdx := {}
|
|
488
521
|
qMap := {}
|
|
489
522
|
for idx, c in _columns {
|
|
490
|
-
if
|
|
523
|
+
if querySpec(c.query) {
|
|
491
524
|
strategy := "expectSingle"
|
|
492
525
|
if c.mode == "multi" { strategy = "expectMultiple" }
|
|
493
526
|
qMap["q" + string(idx)] = maps.deepMerge(c.query, {
|
|
@@ -500,9 +533,9 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
500
533
|
"column query specs require at least one primary added as a PlRef " +
|
|
501
534
|
"or PrimaryRef (pre-resolved primaries cannot anchor column queries)")
|
|
502
535
|
|
|
503
|
-
qResult :=
|
|
536
|
+
qResult := q.anchoredQuery(_ctx, primaryPlRefs, qMap)
|
|
504
537
|
for idx, c in _columns {
|
|
505
|
-
if
|
|
538
|
+
if querySpec(c.query) {
|
|
506
539
|
r := qResult.getResult("q" + string(idx))
|
|
507
540
|
if c.mode == "multi" {
|
|
508
541
|
|
|
@@ -552,7 +585,7 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
552
585
|
} else if isResolvedColumn(c.query) {
|
|
553
586
|
entry.spec = c.query.spec
|
|
554
587
|
entry.data = c.query.data
|
|
555
|
-
} else if
|
|
588
|
+
} else if unresolved(c.query) {
|
|
556
589
|
resolved := resolveColumn(c.query)
|
|
557
590
|
entry.spec = resolved.spec
|
|
558
591
|
entry.data = resolved.data
|
|
@@ -646,6 +679,14 @@ tableBuilder := func(format, ...ctxArg) {
|
|
|
646
679
|
return ll.toStrict(self)
|
|
647
680
|
}
|
|
648
681
|
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
tableBuilder := func(format, ...ctxArg) {
|
|
686
|
+
return tableBuilderWith(bquery, format, ctxArg...)
|
|
687
|
+
}
|
|
688
|
+
|
|
649
689
|
export ll.toStrict({
|
|
650
|
-
tableBuilder: tableBuilder
|
|
690
|
+
tableBuilder: tableBuilder,
|
|
691
|
+
tableBuilderWith: tableBuilderWith
|
|
651
692
|
})
|