This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for using task execution ID fields in log URI templates (#…
…372) * Refactor task log templates to support extra vars * plumbing for k8s * Cleanup use of providers * cleanup * more cleanups * more cleanups * more cleanups * Plumb through task context for plugins * fix Signed-off-by: Jeev B <[email protected]> * move task execution identifier into Input struct * use pointer * tests Signed-off-by: Jeev B <[email protected]> * fix linting Signed-off-by: Jeev B <[email protected]> * cleanups * fix * revert to using regex replacements for performance * Readd benchmark * Split templating scheme (#373) * Use a split templating scheme * add enum for TemplateScheme * cleanup comment * fix linting issues * add unit tests for templateVarsForScheme * update for consistency --------- Signed-off-by: Jeev B <[email protected]>
- Loading branch information
Showing
23 changed files
with
874 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,58 @@ | ||
package tasklog | ||
|
||
import "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
import ( | ||
"regexp" | ||
|
||
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
) | ||
|
||
//go:generate enumer --type=TemplateScheme --trimprefix=TemplateScheme -json -yaml | ||
|
||
type TemplateScheme int | ||
|
||
const ( | ||
TemplateSchemePod TemplateScheme = iota | ||
TemplateSchemeTaskExecution | ||
) | ||
|
||
type TemplateVar struct { | ||
Regex *regexp.Regexp | ||
Value string | ||
} | ||
|
||
type TemplateVars []TemplateVar | ||
|
||
type TemplateVarsByScheme struct { | ||
Common TemplateVars | ||
Pod TemplateVars | ||
TaskExecution TemplateVars | ||
} | ||
|
||
// Input contains all available information about task's execution that a log plugin can use to construct task's | ||
// log links. | ||
type Input struct { | ||
HostName string `json:"hostname"` | ||
PodName string `json:"podName"` | ||
Namespace string `json:"namespace"` | ||
ContainerName string `json:"containerName"` | ||
ContainerID string `json:"containerId"` | ||
LogName string `json:"logName"` | ||
PodRFC3339StartTime string `json:"podRFC3339StartTime"` | ||
PodRFC3339FinishTime string `json:"podRFC3339FinishTime"` | ||
PodUnixStartTime int64 `json:"podUnixStartTime"` | ||
PodUnixFinishTime int64 `json:"podUnixFinishTime"` | ||
PodUID string `json:"podUID"` | ||
HostName string | ||
PodName string | ||
Namespace string | ||
ContainerName string | ||
ContainerID string | ||
LogName string | ||
PodRFC3339StartTime string | ||
PodRFC3339FinishTime string | ||
PodUnixStartTime int64 | ||
PodUnixFinishTime int64 | ||
PodUID string | ||
TaskExecutionIdentifier *core.TaskExecutionIdentifier | ||
ExtraTemplateVarsByScheme *TemplateVarsByScheme | ||
} | ||
|
||
// Output contains all task logs a plugin generates for a given Input. | ||
type Output struct { | ||
TaskLogs []*core.TaskLog `json:"taskLogs"` | ||
TaskLogs []*core.TaskLog | ||
} | ||
|
||
// Plugin represents an interface for task log plugins to implement to plug generated task log links into task events. | ||
type Plugin interface { | ||
// Generates a TaskLog object given necessary computation information | ||
GetTaskLogs(input Input) (logs Output, err error) | ||
GetTaskLogs(i Input) (logs Output, err error) | ||
} |
Oops, something went wrong.