Skip to content

Commit

Permalink
Add visibility control to dynamic log links (#6000)
Browse files Browse the repository at this point in the history
* Add visibility control to dynamic log links

Signed-off-by: Kevin Su <[email protected]>

* Add visibility control to dynamic log links

Signed-off-by: Kevin Su <[email protected]>

* update logging utils

Signed-off-by: Kevin Su <[email protected]>

---------

Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw authored Nov 15, 2024
1 parent b3330ba commit d1a723e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 2 additions & 0 deletions flyteplugins/go/tasks/logs/logging_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ func InitializeLogPlugins(cfg *LogConfig) (tasklog.Plugin, error) {
DisplayName: dynamicLogLink.DisplayName,
DynamicTemplateURIs: dynamicLogLink.TemplateURIs,
MessageFormat: core.TaskLog_JSON,
ShowWhilePending: dynamicLogLink.ShowWhilePending,
HideOnceFinished: dynamicLogLink.HideOnceFinished,
})
}

Expand Down
8 changes: 5 additions & 3 deletions flyteplugins/go/tasks/pluginmachinery/tasklog/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,11 @@ func (p TemplateLogPlugin) GetTaskLogs(input Input) (Output, error) {
}
}
taskLogs = append(taskLogs, &core.TaskLog{
Uri: replaceAll(dynamicTemplateURI, templateVars),
Name: p.DisplayName + input.LogName,
MessageFormat: p.MessageFormat,
Uri: replaceAll(dynamicTemplateURI, templateVars),
Name: p.DisplayName + input.LogName,
MessageFormat: p.MessageFormat,
ShowWhilePending: p.ShowWhilePending,
HideOnceFinished: p.HideOnceFinished,
})
}
}
Expand Down
31 changes: 31 additions & 0 deletions flyteplugins/go/tasks/pluginmachinery/tasklog/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,37 @@ func TestTemplateLogPlugin(t *testing.T) {
},
},
},
{
"flyteinteractive",
TemplateLogPlugin{
Name: "vscode",
DynamicTemplateURIs: []TemplateURI{"vscode://flyteinteractive:{{ .taskConfig.port }}/{{ .podName }}"},
MessageFormat: core.TaskLog_JSON,
HideOnceFinished: true,
ShowWhilePending: true,
},
args{
input: Input{
PodName: "my-pod-name",
TaskTemplate: &core.TaskTemplate{
Config: map[string]string{
"link_type": "vscode",
"port": "1234",
},
},
},
},
Output{
TaskLogs: []*core.TaskLog{
{
Uri: "vscode://flyteinteractive:1234/my-pod-name",
MessageFormat: core.TaskLog_JSON,
ShowWhilePending: true,
HideOnceFinished: true,
},
},
},
},
{
"flyteinteractive - no link_type in task template",
TemplateLogPlugin{
Expand Down

0 comments on commit d1a723e

Please sign in to comment.