Skip to content

Commit c5dbbf7

Browse files
miltalexteo
authored andcommitted
[core] Extend role with GetTaskPID
1 parent cf65808 commit c5dbbf7

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

core/workflow/iteratorrole.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,11 @@ func (i *iteratorRole) SetRuntimeVars(kv map[string]string) {
271271
}
272272
i.template.SetRuntimeVars(kv)
273273
}
274+
275+
func (i *iteratorRole) GetTaskPID() string {
276+
if i == nil {
277+
return ""
278+
}
279+
pid, _ := i.template.GetUserVars().Get("taskPID")
280+
return pid
281+
}

core/workflow/role.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type Role interface {
5757
GlobFilter(g glob.Glob) []Role
5858
SetRuntimeVar(key string, value string)
5959
SetRuntimeVars(kv map[string]string)
60+
GetTaskPID() string
6061
}
6162

6263
type Updatable interface {

core/workflow/rolebase.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,12 @@ func (r *roleBase) CollectInboundChannels() (channels []channel.Inbound) {
350350
channels = channel.MergeInbound(r.Bind, r.parent.CollectInboundChannels())
351351
}
352352
return
353+
}
354+
355+
func (r *roleBase) GetTaskPID() string {
356+
if r == nil {
357+
return ""
358+
}
359+
pid, _ := r.UserVars.Get("taskPID")
360+
return pid
353361
}

0 commit comments

Comments
 (0)