@platforma-sdk/workflow-tengo 6.18.0 → 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/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/render.lib.tengo +30 -0
- package/dist/tengo/lib/smart.lib.tengo +10 -0
- package/dist/tengo/lib/tpl.base.lib.tengo +10 -0
- package/dist/tengo/lib/workdir.lib.tengo +4 -0
- package/dist/tengo/lib/workdir.save.lib.tengo +3 -0
- 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 +1 -1
|
@@ -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
|
})
|
|
@@ -10,6 +10,8 @@ oop := import("@platforma-sdk/workflow-tengo:oop")
|
|
|
10
10
|
tx := import("tx")
|
|
11
11
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
12
12
|
feats := import("@platforma-sdk/workflow-tengo:feats")
|
|
13
|
+
assets := import("@platforma-sdk/workflow-tengo:assets")
|
|
14
|
+
actionContext := import("@platforma-sdk/workflow-tengo:action-context")
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
_SUBSCRIPTION_FIELD := "subscription"
|
|
@@ -27,15 +29,29 @@ _SUBSCRIPTION_FIELD := "subscription"
|
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
30
38
|
|
|
31
39
|
|
|
32
40
|
createUniversal := func(tpl, isEph, inputs, ...opts) {
|
|
33
41
|
ll.assert(len(opts) <= 1, "too many arguments, expected at most one options object")
|
|
34
42
|
metaInputs := undefined
|
|
35
43
|
inputCache := undefined
|
|
44
|
+
actionContextName := undefined
|
|
45
|
+
actionContextOff := false
|
|
46
|
+
actionContextBaggage := undefined
|
|
36
47
|
if len(opts) == 1 && opts[0] {
|
|
37
48
|
metaInputs = opts[0].metaInputs
|
|
38
49
|
inputCache = opts[0].inputCache
|
|
50
|
+
actionContextName = opts[0].name
|
|
51
|
+
actionContextOff = opts[0].actionContext == false
|
|
52
|
+
if is_map(opts[0].actionContext) {
|
|
53
|
+
actionContextBaggage = opts[0].actionContext
|
|
54
|
+
}
|
|
39
55
|
}
|
|
40
56
|
|
|
41
57
|
if !is_undefined(inputCache) && inputCache > 0 && isEph {
|
|
@@ -87,6 +103,20 @@ createUniversal := func(tpl, isEph, inputs, ...opts) {
|
|
|
87
103
|
|
|
88
104
|
rbuilder.createInputField(tplutil.INPUTS_MAP_FIELD).set(inputsMap.build())
|
|
89
105
|
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
if is_undefined(actionContextName) {
|
|
109
|
+
actionContextName = assets.templateName(tpl)
|
|
110
|
+
}
|
|
111
|
+
if !is_undefined(actionContextBaggage) {
|
|
112
|
+
actionContext.createContext(rbuilder.id, actionContextBaggage)
|
|
113
|
+
} else if actionContextOff {
|
|
114
|
+
actionContext.sinkhole(rbuilder.id, actionContextName)
|
|
115
|
+
} else {
|
|
116
|
+
actionContext.createChild(rbuilder.id, actionContextName)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
90
120
|
renderer := rbuilder.lockInputsAndBuild()
|
|
91
121
|
|
|
92
122
|
self := undefined
|
|
@@ -12,6 +12,7 @@ json := import("json")
|
|
|
12
12
|
times := import("times")
|
|
13
13
|
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
14
14
|
ffDefault := import("@platforma-sdk/workflow-tengo:ll.get-future-field-default")
|
|
15
|
+
actionContext := import("@platforma-sdk/workflow-tengo:action-context")
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
|
|
@@ -758,6 +759,15 @@ resource = func(r) {
|
|
|
758
759
|
|
|
759
760
|
|
|
760
761
|
|
|
762
|
+
actionContext: func() {
|
|
763
|
+
return actionContext.of(self.id)
|
|
764
|
+
},
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
761
771
|
|
|
762
772
|
kvSetFlag: func(key, flag) {
|
|
763
773
|
ll.assert(feats.fullFeaturedApi, "smart.resource.kvSetFlag: the feature is not available on older backends. Please, update the backend.")
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
ll := import("@platforma-sdk/workflow-tengo:ll")
|
|
2
2
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
3
3
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
4
|
+
actionContext := import("@platforma-sdk/workflow-tengo:action-context")
|
|
4
5
|
times := import("times")
|
|
5
6
|
sets := import("@platforma-sdk/workflow-tengo:sets")
|
|
6
7
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
@@ -152,6 +153,14 @@ tpl := func(ops) {
|
|
|
152
153
|
|
|
153
154
|
|
|
154
155
|
|
|
156
|
+
|
|
157
|
+
actionContext: func() {
|
|
158
|
+
return actionContext.self()
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
155
164
|
isEphemeral: func() {
|
|
156
165
|
return _isEphemeral
|
|
157
166
|
},
|
|
@@ -732,6 +741,7 @@ tpl := func(ops) {
|
|
|
732
741
|
api: func() {
|
|
733
742
|
return ll.toStrict({
|
|
734
743
|
renderer : self.renderer,
|
|
744
|
+
actionContext : self.actionContext,
|
|
735
745
|
registerUnmarshaller : self.registerUnmarshaller,
|
|
736
746
|
rawInputs : self.rawInputs,
|
|
737
747
|
rawServiceInputs : self.rawServiceInputs,
|
|
@@ -19,6 +19,7 @@ path := import("@platforma-sdk/workflow-tengo:path")
|
|
|
19
19
|
workdirDirs := import("@platforma-sdk/workflow-tengo:workdir.dirs")
|
|
20
20
|
render := import("@platforma-sdk/workflow-tengo:render")
|
|
21
21
|
maps := import("@platforma-sdk/workflow-tengo:maps")
|
|
22
|
+
actionContext := import("@platforma-sdk/workflow-tengo:action-context")
|
|
22
23
|
|
|
23
24
|
_WD_CREATE_FIELD_ALLOCATION := "allocation"
|
|
24
25
|
_WD_CREATE_FIELD_WORKDIR := "workdir"
|
|
@@ -411,6 +412,9 @@ _fill := func() {
|
|
|
411
412
|
self.getField("dataIn").set(smart.createBinaryMapResource(values))
|
|
412
413
|
self.getField("blobsIn").set(smart.createBlobMapResource(blobs))
|
|
413
414
|
|
|
415
|
+
|
|
416
|
+
actionContext.inherit(wd.id)
|
|
417
|
+
|
|
414
418
|
return self.lockAndBuild().outputs()[_WD_FILL_FIELD_WORKDIR_OUT]
|
|
415
419
|
}
|
|
416
420
|
}))
|
|
@@ -6,6 +6,7 @@ json := import("json")
|
|
|
6
6
|
sets := import("@platforma-sdk/workflow-tengo:sets")
|
|
7
7
|
smart := import("@platforma-sdk/workflow-tengo:smart")
|
|
8
8
|
constants := import("@platforma-sdk/workflow-tengo:constants")
|
|
9
|
+
actionContext := import("@platforma-sdk/workflow-tengo:action-context")
|
|
9
10
|
|
|
10
11
|
_WORKDIR_IN_FIELD := "workdirIn"
|
|
11
12
|
_RULES_FIELD := "rules"
|
|
@@ -143,6 +144,8 @@ builder := func(wdBefore) {
|
|
|
143
144
|
)
|
|
144
145
|
)
|
|
145
146
|
|
|
147
|
+
|
|
148
|
+
actionContext.inherit(super.id)
|
|
146
149
|
resource := super.lockAndBuild()
|
|
147
150
|
|
|
148
151
|
|
|
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
|
|
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
|