Skip to content

Commit

Permalink
SVR-323: Add task org to plugins log link templating (#165)
Browse files Browse the repository at this point in the history
Signed-off-by: Katrina Rogan <[email protected]>
  • Loading branch information
katrogan authored Mar 18, 2024
1 parent 44b48c8 commit 91038d9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package webapi

import (
"context"
pluginErrors "github.com/flyteorg/flyte/flyteplugins/go/tasks/errors"
"time"

pluginErrors "github.com/flyteorg/flyte/flyteplugins/go/tasks/errors"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/webapi"
"github.com/flyteorg/flyte/flytestdlib/cache"
Expand Down
6 changes: 6 additions & 0 deletions flyteplugins/go/tasks/pluginmachinery/tasklog/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type templateRegexes struct {
PodUnixFinishTime *regexp.Regexp
TaskID *regexp.Regexp
TaskVersion *regexp.Regexp
TaskOrg *regexp.Regexp
TaskProject *regexp.Regexp
TaskDomain *regexp.Regexp
TaskRetryAttempt *regexp.Regexp
Expand All @@ -59,6 +60,7 @@ func initDefaultRegexes() templateRegexes {
MustCreateRegex("podUnixFinishTime"),
MustCreateRegex("taskID"),
MustCreateRegex("taskVersion"),
MustCreateRegex("taskOrg"),
MustCreateRegex("taskProject"),
MustCreateRegex("taskDomain"),
MustCreateRegex("taskRetryAttempt"),
Expand Down Expand Up @@ -136,6 +138,10 @@ func (input Input) templateVars() []TemplateVar {
defaultRegexes.TaskVersion,
taskExecutionIdentifier.TaskId.Version,
},
TemplateVar{
defaultRegexes.TaskOrg,
taskExecutionIdentifier.TaskId.Org,
},
TemplateVar{
defaultRegexes.TaskProject,
taskExecutionIdentifier.TaskId.Project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func dummyTaskExecID() pluginCore.TaskExecutionID {
Project: "my-task-project",
Domain: "my-task-domain",
Version: "1",
Org: "my-task-org",
},
NodeExecutionId: &core.NodeExecutionIdentifier{
ExecutionId: &core.WorkflowExecutionIdentifier{
Expand Down Expand Up @@ -145,6 +146,7 @@ func Test_Input_templateVars(t *testing.T) {
{defaultRegexes.TaskRetryAttempt, "1"},
{defaultRegexes.TaskID, "my-task-name"},
{defaultRegexes.TaskVersion, "1"},
{defaultRegexes.TaskOrg, "my-task-org"},
{defaultRegexes.TaskProject, "my-task-project"},
{defaultRegexes.TaskDomain, "my-task-domain"},
{defaultRegexes.ExecutionName, "my-execution-name"},
Expand Down Expand Up @@ -420,7 +422,7 @@ func TestTemplateLogPlugin(t *testing.T) {
{
"task-with-task-execution-identifier-with-org",
TemplateLogPlugin{
TemplateURIs: []TemplateURI{"https://flyte.corp.net/console/org/{{ .executionOrg }}/projects/{{ .executionProject }}/domains/{{ .executionDomain }}/executions/{{ .executionName }}/nodeId/{{ .nodeID }}/taskId/{{ .taskID }}/attempt/{{ .taskRetryAttempt }}/view/logs"},
TemplateURIs: []TemplateURI{"https://flyte.corp.net/console/org/{{ .executionOrg }}/projects/{{ .executionProject }}/domains/{{ .executionDomain }}/executions/{{ .executionName }}/nodeId/{{ .nodeID }}/taskId/{{ .taskID }}/taskOrg/{{ .taskOrg }}/attempt/{{ .taskRetryAttempt }}/view/logs"},
MessageFormat: core.TaskLog_JSON,
},
args{
Expand All @@ -441,7 +443,7 @@ func TestTemplateLogPlugin(t *testing.T) {
Output{
TaskLogs: []*core.TaskLog{
{
Uri: "https://flyte.corp.net/console/org/my-execution-org/projects/my-execution-project/domains/my-execution-domain/executions/my-execution-name/nodeId/n0-0-n0/taskId/my-task-name/attempt/1/view/logs",
Uri: "https://flyte.corp.net/console/org/my-execution-org/projects/my-execution-project/domains/my-execution-domain/executions/my-execution-name/nodeId/n0-0-n0/taskId/my-task-name/taskOrg/my-task-org/attempt/1/view/logs",
MessageFormat: core.TaskLog_JSON,
Name: "main_logs",
},
Expand Down
2 changes: 1 addition & 1 deletion flyteplugins/go/tasks/plugins/webapi/agent/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"encoding/gob"
"fmt"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service"
"time"

"golang.org/x/exp/maps"

"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
flyteIdl "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/service"
pluginErrors "github.com/flyteorg/flyte/flyteplugins/go/tasks/errors"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core"
Expand Down

0 comments on commit 91038d9

Please sign in to comment.