id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
134,600 | argoproj/argo | workflow/executor/executor.go | CaptureScriptResult | func (we *WorkflowExecutor) CaptureScriptResult() error {
if we.Template.Script == nil {
return nil
}
log.Infof("Capturing script output")
mainContainerID, err := we.GetMainContainerID()
if err != nil {
return err
}
reader, err := we.RuntimeExecutor.GetOutputStream(mainContainerID, false)
if err != nil {
... | go | func (we *WorkflowExecutor) CaptureScriptResult() error {
if we.Template.Script == nil {
return nil
}
log.Infof("Capturing script output")
mainContainerID, err := we.GetMainContainerID()
if err != nil {
return err
}
reader, err := we.RuntimeExecutor.GetOutputStream(mainContainerID, false)
if err != nil {
... | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"CaptureScriptResult",
"(",
")",
"error",
"{",
"if",
"we",
".",
"Template",
".",
"Script",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"mainCont... | // CaptureScriptResult will add the stdout of a script template as output result | [
"CaptureScriptResult",
"will",
"add",
"the",
"stdout",
"of",
"a",
"script",
"template",
"as",
"output",
"result"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L731-L757 |
134,601 | argoproj/argo | workflow/executor/executor.go | AnnotateOutputs | func (we *WorkflowExecutor) AnnotateOutputs(logArt *wfv1.Artifact) error {
outputs := we.Template.Outputs.DeepCopy()
if logArt != nil {
outputs.Artifacts = append(outputs.Artifacts, *logArt)
}
if !outputs.HasOutputs() {
return nil
}
log.Infof("Annotating pod with output")
outputBytes, err := json.Marshal(ou... | go | func (we *WorkflowExecutor) AnnotateOutputs(logArt *wfv1.Artifact) error {
outputs := we.Template.Outputs.DeepCopy()
if logArt != nil {
outputs.Artifacts = append(outputs.Artifacts, *logArt)
}
if !outputs.HasOutputs() {
return nil
}
log.Infof("Annotating pod with output")
outputBytes, err := json.Marshal(ou... | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"AnnotateOutputs",
"(",
"logArt",
"*",
"wfv1",
".",
"Artifact",
")",
"error",
"{",
"outputs",
":=",
"we",
".",
"Template",
".",
"Outputs",
".",
"DeepCopy",
"(",
")",
"\n",
"if",
"logArt",
"!=",
"nil",
"{... | // AnnotateOutputs annotation to the pod indicating all the outputs. | [
"AnnotateOutputs",
"annotation",
"to",
"the",
"pod",
"indicating",
"all",
"the",
"outputs",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L760-L775 |
134,602 | argoproj/argo | workflow/executor/executor.go | AddError | func (we *WorkflowExecutor) AddError(err error) {
log.Errorf("executor error: %+v", err)
we.errors = append(we.errors, err)
} | go | func (we *WorkflowExecutor) AddError(err error) {
log.Errorf("executor error: %+v", err)
we.errors = append(we.errors, err)
} | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"AddError",
"(",
"err",
"error",
")",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"we",
".",
"errors",
"=",
"append",
"(",
"we",
".",
"errors",
",",
"err",
")",
"\n",
"}"
] | // AddError adds an error to the list of encountered errors durign execution | [
"AddError",
"adds",
"an",
"error",
"to",
"the",
"list",
"of",
"encountered",
"errors",
"durign",
"execution"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L778-L781 |
134,603 | argoproj/argo | workflow/executor/executor.go | AddAnnotation | func (we *WorkflowExecutor) AddAnnotation(key, value string) error {
return common.AddPodAnnotation(we.ClientSet, we.PodName, we.Namespace, key, value)
} | go | func (we *WorkflowExecutor) AddAnnotation(key, value string) error {
return common.AddPodAnnotation(we.ClientSet, we.PodName, we.Namespace, key, value)
} | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"AddAnnotation",
"(",
"key",
",",
"value",
"string",
")",
"error",
"{",
"return",
"common",
".",
"AddPodAnnotation",
"(",
"we",
".",
"ClientSet",
",",
"we",
".",
"PodName",
",",
"we",
".",
"Namespace",
","... | // AddAnnotation adds an annotation to the workflow pod | [
"AddAnnotation",
"adds",
"an",
"annotation",
"to",
"the",
"workflow",
"pod"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L784-L786 |
134,604 | argoproj/argo | workflow/executor/executor.go | isTarball | func isTarball(filePath string) bool {
cmd := exec.Command("tar", "-tf", filePath)
log.Info(cmd.Args)
err := cmd.Run()
return err == nil
} | go | func isTarball(filePath string) bool {
cmd := exec.Command("tar", "-tf", filePath)
log.Info(cmd.Args)
err := cmd.Run()
return err == nil
} | [
"func",
"isTarball",
"(",
"filePath",
"string",
")",
"bool",
"{",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"filePath",
")",
"\n",
"log",
".",
"Info",
"(",
"cmd",
".",
"Args",
")",
"\n",
"err",
":=",
"cmd",
".",
... | // isTarball returns whether or not the file is a tarball | [
"isTarball",
"returns",
"whether",
"or",
"not",
"the",
"file",
"is",
"a",
"tarball"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L789-L794 |
134,605 | argoproj/argo | workflow/executor/executor.go | untar | func untar(tarPath string, destPath string) error {
// first extract the tar into a temporary dir
tmpDir := destPath + ".tmpdir"
err := os.MkdirAll(tmpDir, os.ModePerm)
if err != nil {
return errors.InternalWrapError(err)
}
err = common.RunCommand("tar", "-xf", tarPath, "-C", tmpDir)
if err != nil {
return e... | go | func untar(tarPath string, destPath string) error {
// first extract the tar into a temporary dir
tmpDir := destPath + ".tmpdir"
err := os.MkdirAll(tmpDir, os.ModePerm)
if err != nil {
return errors.InternalWrapError(err)
}
err = common.RunCommand("tar", "-xf", tarPath, "-C", tmpDir)
if err != nil {
return e... | [
"func",
"untar",
"(",
"tarPath",
"string",
",",
"destPath",
"string",
")",
"error",
"{",
"// first extract the tar into a temporary dir",
"tmpDir",
":=",
"destPath",
"+",
"\"",
"\"",
"\n",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"tmpDir",
",",
"os",
".",
"M... | // untar extracts a tarball to a temporary directory,
// renaming it to the desired location | [
"untar",
"extracts",
"a",
"tarball",
"to",
"a",
"temporary",
"directory",
"renaming",
"it",
"to",
"the",
"desired",
"location"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L798-L836 |
134,606 | argoproj/argo | workflow/executor/executor.go | waitMainContainerStart | func (we *WorkflowExecutor) waitMainContainerStart() (string, error) {
for {
podsIf := we.ClientSet.CoreV1().Pods(we.Namespace)
fieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", we.PodName))
opts := metav1.ListOptions{
FieldSelector: fieldSelector.String(),
}
watchIf, err := podsI... | go | func (we *WorkflowExecutor) waitMainContainerStart() (string, error) {
for {
podsIf := we.ClientSet.CoreV1().Pods(we.Namespace)
fieldSelector := fields.ParseSelectorOrDie(fmt.Sprintf("metadata.name=%s", we.PodName))
opts := metav1.ListOptions{
FieldSelector: fieldSelector.String(),
}
watchIf, err := podsI... | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"waitMainContainerStart",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"for",
"{",
"podsIf",
":=",
"we",
".",
"ClientSet",
".",
"CoreV1",
"(",
")",
".",
"Pods",
"(",
"we",
".",
"Namespace",
")",
"\... | // waitMainContainerStart waits for the main container to start and returns its container ID. | [
"waitMainContainerStart",
"waits",
"for",
"the",
"main",
"container",
"to",
"start",
"and",
"returns",
"its",
"container",
"ID",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L876-L915 |
134,607 | argoproj/argo | workflow/executor/executor.go | monitorAnnotations | func (we *WorkflowExecutor) monitorAnnotations(ctx context.Context) <-chan struct{} {
log.Infof("Starting annotations monitor")
// Create a channel to listen for a SIGUSR2. Upon receiving of the signal, we force reload our annotations
// directly from kubernetes API. The controller uses this to fast-track notificat... | go | func (we *WorkflowExecutor) monitorAnnotations(ctx context.Context) <-chan struct{} {
log.Infof("Starting annotations monitor")
// Create a channel to listen for a SIGUSR2. Upon receiving of the signal, we force reload our annotations
// directly from kubernetes API. The controller uses this to fast-track notificat... | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"monitorAnnotations",
"(",
"ctx",
"context",
".",
"Context",
")",
"<-",
"chan",
"struct",
"{",
"}",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"// Create a channel to listen for a SIGUSR2. Upon receiv... | // monitorAnnotations starts a goroutine which monitors for any changes to the pod annotations.
// Emits an event on the returned channel upon any updates | [
"monitorAnnotations",
"starts",
"a",
"goroutine",
"which",
"monitors",
"for",
"any",
"changes",
"to",
"the",
"pod",
"annotations",
".",
"Emits",
"an",
"event",
"on",
"the",
"returned",
"channel",
"upon",
"any",
"updates"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L947-L990 |
134,608 | argoproj/argo | workflow/executor/executor.go | setExecutionControl | func (we *WorkflowExecutor) setExecutionControl() {
pod, err := we.getPod()
if err != nil {
log.Warnf("Failed to set execution control from API server: %v", err)
return
}
execCtlString, ok := pod.ObjectMeta.Annotations[common.AnnotationKeyExecutionControl]
if !ok {
we.ExecutionControl = nil
} else {
var e... | go | func (we *WorkflowExecutor) setExecutionControl() {
pod, err := we.getPod()
if err != nil {
log.Warnf("Failed to set execution control from API server: %v", err)
return
}
execCtlString, ok := pod.ObjectMeta.Annotations[common.AnnotationKeyExecutionControl]
if !ok {
we.ExecutionControl = nil
} else {
var e... | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"setExecutionControl",
"(",
")",
"{",
"pod",
",",
"err",
":=",
"we",
".",
"getPod",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"retu... | // setExecutionControl sets the execution control information from the pod annotation | [
"setExecutionControl",
"sets",
"the",
"execution",
"control",
"information",
"from",
"the",
"pod",
"annotation"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L993-L1012 |
134,609 | argoproj/argo | workflow/executor/executor.go | monitorDeadline | func (we *WorkflowExecutor) monitorDeadline(ctx context.Context, annotationsUpdate <-chan struct{}) {
log.Infof("Starting deadline monitor")
for {
select {
case <-ctx.Done():
log.Info("Deadline monitor stopped")
return
case <-annotationsUpdate:
default:
// TODO(jessesuen): we do not effectively use t... | go | func (we *WorkflowExecutor) monitorDeadline(ctx context.Context, annotationsUpdate <-chan struct{}) {
log.Infof("Starting deadline monitor")
for {
select {
case <-ctx.Done():
log.Info("Deadline monitor stopped")
return
case <-annotationsUpdate:
default:
// TODO(jessesuen): we do not effectively use t... | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"monitorDeadline",
"(",
"ctx",
"context",
".",
"Context",
",",
"annotationsUpdate",
"<-",
"chan",
"struct",
"{",
"}",
")",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"for",
"{",
"select",
"{",... | // monitorDeadline checks to see if we exceeded the deadline for the step and
// terminates the main container if we did | [
"monitorDeadline",
"checks",
"to",
"see",
"if",
"we",
"exceeded",
"the",
"deadline",
"for",
"the",
"step",
"and",
"terminates",
"the",
"main",
"container",
"if",
"we",
"did"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L1016-L1052 |
134,610 | argoproj/argo | workflow/executor/executor.go | KillSidecars | func (we *WorkflowExecutor) KillSidecars() error {
if len(we.Template.Sidecars) == 0 {
log.Infof("No sidecars")
return nil
}
log.Infof("Killing sidecars")
pod, err := we.getPod()
if err != nil {
return err
}
sidecarIDs := make([]string, 0)
for _, ctrStatus := range pod.Status.ContainerStatuses {
if ctrS... | go | func (we *WorkflowExecutor) KillSidecars() error {
if len(we.Template.Sidecars) == 0 {
log.Infof("No sidecars")
return nil
}
log.Infof("Killing sidecars")
pod, err := we.getPod()
if err != nil {
return err
}
sidecarIDs := make([]string, 0)
for _, ctrStatus := range pod.Status.ContainerStatuses {
if ctrS... | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"KillSidecars",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"we",
".",
"Template",
".",
"Sidecars",
")",
"==",
"0",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"... | // KillSidecars kills any sidecars to the main container | [
"KillSidecars",
"kills",
"any",
"sidecars",
"to",
"the",
"main",
"container"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L1055-L1081 |
134,611 | argoproj/argo | workflow/executor/executor.go | LoadExecutionControl | func (we *WorkflowExecutor) LoadExecutionControl() error {
err := unmarshalAnnotationField(we.PodAnnotationsPath, common.AnnotationKeyExecutionControl, &we.ExecutionControl)
if err != nil {
if errors.IsCode(errors.CodeNotFound, err) {
return nil
}
return err
}
return nil
} | go | func (we *WorkflowExecutor) LoadExecutionControl() error {
err := unmarshalAnnotationField(we.PodAnnotationsPath, common.AnnotationKeyExecutionControl, &we.ExecutionControl)
if err != nil {
if errors.IsCode(errors.CodeNotFound, err) {
return nil
}
return err
}
return nil
} | [
"func",
"(",
"we",
"*",
"WorkflowExecutor",
")",
"LoadExecutionControl",
"(",
")",
"error",
"{",
"err",
":=",
"unmarshalAnnotationField",
"(",
"we",
".",
"PodAnnotationsPath",
",",
"common",
".",
"AnnotationKeyExecutionControl",
",",
"&",
"we",
".",
"ExecutionCont... | // LoadExecutionControl reads the execution control definition from the the Kubernetes downward api annotations volume file | [
"LoadExecutionControl",
"reads",
"the",
"execution",
"control",
"definition",
"from",
"the",
"the",
"Kubernetes",
"downward",
"api",
"annotations",
"volume",
"file"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L1084-L1093 |
134,612 | argoproj/argo | workflow/executor/executor.go | LoadTemplate | func LoadTemplate(path string) (*wfv1.Template, error) {
var tmpl wfv1.Template
err := unmarshalAnnotationField(path, common.AnnotationKeyTemplate, &tmpl)
if err != nil {
return nil, err
}
return &tmpl, nil
} | go | func LoadTemplate(path string) (*wfv1.Template, error) {
var tmpl wfv1.Template
err := unmarshalAnnotationField(path, common.AnnotationKeyTemplate, &tmpl)
if err != nil {
return nil, err
}
return &tmpl, nil
} | [
"func",
"LoadTemplate",
"(",
"path",
"string",
")",
"(",
"*",
"wfv1",
".",
"Template",
",",
"error",
")",
"{",
"var",
"tmpl",
"wfv1",
".",
"Template",
"\n",
"err",
":=",
"unmarshalAnnotationField",
"(",
"path",
",",
"common",
".",
"AnnotationKeyTemplate",
... | // LoadTemplate reads the template definition from the the Kubernetes downward api annotations volume file | [
"LoadTemplate",
"reads",
"the",
"template",
"definition",
"from",
"the",
"the",
"Kubernetes",
"downward",
"api",
"annotations",
"volume",
"file"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L1096-L1103 |
134,613 | argoproj/argo | workflow/executor/executor.go | unmarshalAnnotationField | func unmarshalAnnotationField(filePath string, key string, into interface{}) error {
// Read the annotation file
file, err := os.Open(filePath)
if err != nil {
log.Errorf("ERROR opening annotation file from %s", filePath)
return errors.InternalWrapError(err)
}
defer func() {
_ = file.Close()
}()
reader :=... | go | func unmarshalAnnotationField(filePath string, key string, into interface{}) error {
// Read the annotation file
file, err := os.Open(filePath)
if err != nil {
log.Errorf("ERROR opening annotation file from %s", filePath)
return errors.InternalWrapError(err)
}
defer func() {
_ = file.Close()
}()
reader :=... | [
"func",
"unmarshalAnnotationField",
"(",
"filePath",
"string",
",",
"key",
"string",
",",
"into",
"interface",
"{",
"}",
")",
"error",
"{",
"// Read the annotation file",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"filePath",
")",
"\n",
"if",
"err",
... | // unmarshalAnnotationField unmarshals the value of an annotation key into the supplied interface
// from the downward api annotation volume file | [
"unmarshalAnnotationField",
"unmarshals",
"the",
"value",
"of",
"an",
"annotation",
"key",
"into",
"the",
"supplied",
"interface",
"from",
"the",
"downward",
"api",
"annotation",
"volume",
"file"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/executor.go#L1107-L1182 |
134,614 | argoproj/argo | cmd/argo/commands/get.go | attachToParent | func attachToParent(wf *wfv1.Workflow, n renderNode,
nonBoundaryParentChildrenMap map[string]*nonBoundaryParentNode, boundaryID string,
boundaryNodeMap map[string]*boundaryNode, parentBoundaryMap map[string][]renderNode) bool {
// Check first if I am a child of a nonBoundaryParent
// that implies I attach to that ... | go | func attachToParent(wf *wfv1.Workflow, n renderNode,
nonBoundaryParentChildrenMap map[string]*nonBoundaryParentNode, boundaryID string,
boundaryNodeMap map[string]*boundaryNode, parentBoundaryMap map[string][]renderNode) bool {
// Check first if I am a child of a nonBoundaryParent
// that implies I attach to that ... | [
"func",
"attachToParent",
"(",
"wf",
"*",
"wfv1",
".",
"Workflow",
",",
"n",
"renderNode",
",",
"nonBoundaryParentChildrenMap",
"map",
"[",
"string",
"]",
"*",
"nonBoundaryParentNode",
",",
"boundaryID",
"string",
",",
"boundaryNodeMap",
"map",
"[",
"string",
"]... | // Attach render node n to its parent based on what has been parsed previously
// In some cases add it to list of things that still needs to be attached to parent
// Return if I am a possible root | [
"Attach",
"render",
"node",
"n",
"to",
"its",
"parent",
"based",
"on",
"what",
"has",
"been",
"parsed",
"previously",
"In",
"some",
"cases",
"add",
"it",
"to",
"list",
"of",
"things",
"that",
"still",
"needs",
"to",
"be",
"attached",
"to",
"parent",
"Ret... | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/get.go#L238-L265 |
134,615 | argoproj/argo | cmd/argo/commands/get.go | convertToRenderTrees | func convertToRenderTrees(wf *wfv1.Workflow) map[string]renderNode {
renderTreeRoots := make(map[string]renderNode)
// Used to store all boundary nodes so future render children can attach
// Maps node Name -> *boundaryNode
boundaryNodeMap := make(map[string]*boundaryNode)
// Used to store children of a boundary... | go | func convertToRenderTrees(wf *wfv1.Workflow) map[string]renderNode {
renderTreeRoots := make(map[string]renderNode)
// Used to store all boundary nodes so future render children can attach
// Maps node Name -> *boundaryNode
boundaryNodeMap := make(map[string]*boundaryNode)
// Used to store children of a boundary... | [
"func",
"convertToRenderTrees",
"(",
"wf",
"*",
"wfv1",
".",
"Workflow",
")",
"map",
"[",
"string",
"]",
"renderNode",
"{",
"renderTreeRoots",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"renderNode",
")",
"\n\n",
"// Used to store all boundary nodes so future r... | // This takes the map of NodeStatus and converts them into a forrest
// of trees of renderNodes and returns the set of roots for each tree | [
"This",
"takes",
"the",
"map",
"of",
"NodeStatus",
"and",
"converts",
"them",
"into",
"a",
"forrest",
"of",
"trees",
"of",
"renderNodes",
"and",
"returns",
"the",
"set",
"of",
"roots",
"for",
"each",
"tree"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/get.go#L269-L348 |
134,616 | argoproj/argo | cmd/argo/commands/get.go | printNode | func printNode(w *tabwriter.Writer, wf *wfv1.Workflow, node wfv1.NodeStatus, depth int, nodePrefix string, childPrefix string, outFmt string) {
nodeName := fmt.Sprintf("%s %s", jobStatusIconMap[node.Phase], node.DisplayName)
var args []interface{}
duration := humanize.RelativeDurationShort(node.StartedAt.Time, node.... | go | func printNode(w *tabwriter.Writer, wf *wfv1.Workflow, node wfv1.NodeStatus, depth int, nodePrefix string, childPrefix string, outFmt string) {
nodeName := fmt.Sprintf("%s %s", jobStatusIconMap[node.Phase], node.DisplayName)
var args []interface{}
duration := humanize.RelativeDurationShort(node.StartedAt.Time, node.... | [
"func",
"printNode",
"(",
"w",
"*",
"tabwriter",
".",
"Writer",
",",
"wf",
"*",
"wfv1",
".",
"Workflow",
",",
"node",
"wfv1",
".",
"NodeStatus",
",",
"depth",
"int",
",",
"nodePrefix",
"string",
",",
"childPrefix",
"string",
",",
"outFmt",
"string",
")",... | // Main method to print information of node in get | [
"Main",
"method",
"to",
"print",
"information",
"of",
"node",
"in",
"get"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/get.go#L409-L426 |
134,617 | argoproj/argo | workflow/controller/scope.go | replaceMap | func (s *wfScope) replaceMap() map[string]string {
replaceMap := make(map[string]string)
for key, val := range s.scope {
valStr, ok := val.(string)
if ok {
replaceMap[key] = valStr
}
}
return replaceMap
} | go | func (s *wfScope) replaceMap() map[string]string {
replaceMap := make(map[string]string)
for key, val := range s.scope {
valStr, ok := val.(string)
if ok {
replaceMap[key] = valStr
}
}
return replaceMap
} | [
"func",
"(",
"s",
"*",
"wfScope",
")",
"replaceMap",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"replaceMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"key",
",",
"val",
":=",
"range",
"s",
".",
"scope",
... | // replaceMap returns a replacement map of strings intended to be used simple string substitution | [
"replaceMap",
"returns",
"a",
"replacement",
"map",
"of",
"strings",
"intended",
"to",
"be",
"used",
"simple",
"string",
"substitution"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/scope.go#L17-L26 |
134,618 | argoproj/argo | workflow/controller/scope.go | resolveVar | func (s *wfScope) resolveVar(v string) (interface{}, error) {
v = strings.TrimPrefix(v, "{{")
v = strings.TrimSuffix(v, "}}")
parts := strings.Split(v, ".")
prefix := parts[0]
switch prefix {
case "steps", "tasks", "workflow":
val, ok := s.scope[v]
if ok {
return val, nil
}
case "inputs":
art := s.tmp... | go | func (s *wfScope) resolveVar(v string) (interface{}, error) {
v = strings.TrimPrefix(v, "{{")
v = strings.TrimSuffix(v, "}}")
parts := strings.Split(v, ".")
prefix := parts[0]
switch prefix {
case "steps", "tasks", "workflow":
val, ok := s.scope[v]
if ok {
return val, nil
}
case "inputs":
art := s.tmp... | [
"func",
"(",
"s",
"*",
"wfScope",
")",
"resolveVar",
"(",
"v",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"v",
"=",
"strings",
".",
"TrimPrefix",
"(",
"v",
",",
"\"",
"\"",
")",
"\n",
"v",
"=",
"strings",
".",
"TrimSuffix"... | // resolveVar resolves a parameter or artifact | [
"resolveVar",
"resolves",
"a",
"parameter",
"or",
"artifact"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/scope.go#L37-L55 |
134,619 | argoproj/argo | workflow/artifacts/hdfs/hdfs.go | ValidateArtifact | func ValidateArtifact(errPrefix string, art *wfv1.HDFSArtifact) error {
if len(art.Addresses) == 0 {
return errors.Errorf(errors.CodeBadRequest, "%s.addresses is required", errPrefix)
}
if art.Path == "" {
return errors.Errorf(errors.CodeBadRequest, "%s.path is required", errPrefix)
}
if !filepath.IsAbs(art.Pa... | go | func ValidateArtifact(errPrefix string, art *wfv1.HDFSArtifact) error {
if len(art.Addresses) == 0 {
return errors.Errorf(errors.CodeBadRequest, "%s.addresses is required", errPrefix)
}
if art.Path == "" {
return errors.Errorf(errors.CodeBadRequest, "%s.path is required", errPrefix)
}
if !filepath.IsAbs(art.Pa... | [
"func",
"ValidateArtifact",
"(",
"errPrefix",
"string",
",",
"art",
"*",
"wfv1",
".",
"HDFSArtifact",
")",
"error",
"{",
"if",
"len",
"(",
"art",
".",
"Addresses",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"errors",
".",
"CodeBadReques... | // ValidateArtifact validates HDFS artifact | [
"ValidateArtifact",
"validates",
"HDFS",
"artifact"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/artifacts/hdfs/hdfs.go#L48-L72 |
134,620 | argoproj/argo | workflow/artifacts/hdfs/hdfs.go | CreateDriver | func CreateDriver(ci common.ResourceInterface, art *wfv1.HDFSArtifact) (*ArtifactDriver, error) {
var krbConfig string
var krbOptions *KrbOptions
var err error
namespace := ci.GetNamespace()
if art.KrbConfigConfigMap != nil && art.KrbConfigConfigMap.Name != "" {
krbConfig, err = ci.GetConfigMapKey(namespace, a... | go | func CreateDriver(ci common.ResourceInterface, art *wfv1.HDFSArtifact) (*ArtifactDriver, error) {
var krbConfig string
var krbOptions *KrbOptions
var err error
namespace := ci.GetNamespace()
if art.KrbConfigConfigMap != nil && art.KrbConfigConfigMap.Name != "" {
krbConfig, err = ci.GetConfigMapKey(namespace, a... | [
"func",
"CreateDriver",
"(",
"ci",
"common",
".",
"ResourceInterface",
",",
"art",
"*",
"wfv1",
".",
"HDFSArtifact",
")",
"(",
"*",
"ArtifactDriver",
",",
"error",
")",
"{",
"var",
"krbConfig",
"string",
"\n",
"var",
"krbOptions",
"*",
"KrbOptions",
"\n",
... | // CreateDriver constructs ArtifactDriver | [
"CreateDriver",
"constructs",
"ArtifactDriver"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/artifacts/hdfs/hdfs.go#L75-L133 |
134,621 | argoproj/argo | workflow/artifacts/hdfs/hdfs.go | Load | func (driver *ArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
hdfscli, err := createHDFSClient(driver.Addresses, driver.HDFSUser, driver.KrbOptions)
if err != nil {
return err
}
defer util.Close(hdfscli)
srcStat, err := hdfscli.Stat(driver.Path)
if err != nil {
return err
}
if srcSt... | go | func (driver *ArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
hdfscli, err := createHDFSClient(driver.Addresses, driver.HDFSUser, driver.KrbOptions)
if err != nil {
return err
}
defer util.Close(hdfscli)
srcStat, err := hdfscli.Stat(driver.Path)
if err != nil {
return err
}
if srcSt... | [
"func",
"(",
"driver",
"*",
"ArtifactDriver",
")",
"Load",
"(",
"inputArtifact",
"*",
"wfv1",
".",
"Artifact",
",",
"path",
"string",
")",
"error",
"{",
"hdfscli",
",",
"err",
":=",
"createHDFSClient",
"(",
"driver",
".",
"Addresses",
",",
"driver",
".",
... | // Load downloads artifacts from HDFS compliant storage | [
"Load",
"downloads",
"artifacts",
"from",
"HDFS",
"compliant",
"storage"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/artifacts/hdfs/hdfs.go#L136-L175 |
134,622 | argoproj/argo | workflow/artifacts/hdfs/hdfs.go | Save | func (driver *ArtifactDriver) Save(path string, outputArtifact *wfv1.Artifact) error {
hdfscli, err := createHDFSClient(driver.Addresses, driver.HDFSUser, driver.KrbOptions)
if err != nil {
return err
}
defer util.Close(hdfscli)
isDir, err := file.IsDirectory(path)
if err != nil {
return err
}
if isDir {
... | go | func (driver *ArtifactDriver) Save(path string, outputArtifact *wfv1.Artifact) error {
hdfscli, err := createHDFSClient(driver.Addresses, driver.HDFSUser, driver.KrbOptions)
if err != nil {
return err
}
defer util.Close(hdfscli)
isDir, err := file.IsDirectory(path)
if err != nil {
return err
}
if isDir {
... | [
"func",
"(",
"driver",
"*",
"ArtifactDriver",
")",
"Save",
"(",
"path",
"string",
",",
"outputArtifact",
"*",
"wfv1",
".",
"Artifact",
")",
"error",
"{",
"hdfscli",
",",
"err",
":=",
"createHDFSClient",
"(",
"driver",
".",
"Addresses",
",",
"driver",
".",
... | // Save saves an artifact to HDFS compliant storage | [
"Save",
"saves",
"an",
"artifact",
"to",
"HDFS",
"compliant",
"storage"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/artifacts/hdfs/hdfs.go#L178-L217 |
134,623 | argoproj/argo | workflow/ttlcontroller/ttlcontroller.go | NewController | func NewController(config *rest.Config, wfClientset wfclientset.Interface, namespace, instanceID string) *Controller {
filterCompletedWithTTL := func(options *metav1.ListOptions) {
// completed equals (true)
completedReq, err := labels.NewRequirement(common.LabelKeyCompleted, selection.Equals, []string{"true"})
... | go | func NewController(config *rest.Config, wfClientset wfclientset.Interface, namespace, instanceID string) *Controller {
filterCompletedWithTTL := func(options *metav1.ListOptions) {
// completed equals (true)
completedReq, err := labels.NewRequirement(common.LabelKeyCompleted, selection.Equals, []string{"true"})
... | [
"func",
"NewController",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"wfClientset",
"wfclientset",
".",
"Interface",
",",
"namespace",
",",
"instanceID",
"string",
")",
"*",
"Controller",
"{",
"filterCompletedWithTTL",
":=",
"func",
"(",
"options",
"*",
"m... | // NewController returns a new workflow ttl controller | [
"NewController",
"returns",
"a",
"new",
"workflow",
"ttl",
"controller"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/ttlcontroller/ttlcontroller.go#L39-L69 |
134,624 | argoproj/argo | workflow/ttlcontroller/ttlcontroller.go | enqueueWF | func (c *Controller) enqueueWF(obj interface{}) {
un, ok := obj.(*unstructured.Unstructured)
if !ok {
log.Warnf("'%v' is not an unstructured", obj)
return
}
wf, err := util.FromUnstructured(un)
if err != nil {
log.Warnf("Failed to unmarshal workflow %v object: %v", obj, err)
return
}
now := c.clock.Now()... | go | func (c *Controller) enqueueWF(obj interface{}) {
un, ok := obj.(*unstructured.Unstructured)
if !ok {
log.Warnf("'%v' is not an unstructured", obj)
return
}
wf, err := util.FromUnstructured(un)
if err != nil {
log.Warnf("Failed to unmarshal workflow %v object: %v", obj, err)
return
}
now := c.clock.Now()... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"enqueueWF",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"un",
",",
"ok",
":=",
"obj",
".",
"(",
"*",
"unstructured",
".",
"Unstructured",
")",
"\n",
"if",
"!",
"ok",
"{",
"log",
".",
"Warnf",
"(",
"\"",... | // enqueueWF conditionally queues a workflow to the ttl queue if it is within the deletion period | [
"enqueueWF",
"conditionally",
"queues",
"a",
"workflow",
"to",
"the",
"ttl",
"queue",
"if",
"it",
"is",
"within",
"the",
"deletion",
"period"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/ttlcontroller/ttlcontroller.go#L132-L161 |
134,625 | argoproj/argo | workflow/metrics/server.go | RunServer | func RunServer(ctx context.Context, config PrometheusConfig, registry *prometheus.Registry) {
mux := http.NewServeMux()
mux.Handle(config.Path, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
srv := &http.Server{Addr: fmt.Sprintf(":%s", config.Port), Handler: mux}
defer func() {
if cerr := srv.Close(); ce... | go | func RunServer(ctx context.Context, config PrometheusConfig, registry *prometheus.Registry) {
mux := http.NewServeMux()
mux.Handle(config.Path, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
srv := &http.Server{Addr: fmt.Sprintf(":%s", config.Port), Handler: mux}
defer func() {
if cerr := srv.Close(); ce... | [
"func",
"RunServer",
"(",
"ctx",
"context",
".",
"Context",
",",
"config",
"PrometheusConfig",
",",
"registry",
"*",
"prometheus",
".",
"Registry",
")",
"{",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"mux",
".",
"Handle",
"(",
"config",
".... | // RunServer starts a metrics server | [
"RunServer",
"starts",
"a",
"metrics",
"server"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/metrics/server.go#L21-L38 |
134,626 | argoproj/argo | workflow/common/util.go | ExecPodContainer | func ExecPodContainer(restConfig *rest.Config, namespace string, pod string, container string, stdout bool, stderr bool, command ...string) (remotecommand.Executor, error) {
clientset, err := kubernetes.NewForConfig(restConfig)
if err != nil {
return nil, errors.InternalWrapError(err)
}
execRequest := clientset.... | go | func ExecPodContainer(restConfig *rest.Config, namespace string, pod string, container string, stdout bool, stderr bool, command ...string) (remotecommand.Executor, error) {
clientset, err := kubernetes.NewForConfig(restConfig)
if err != nil {
return nil, errors.InternalWrapError(err)
}
execRequest := clientset.... | [
"func",
"ExecPodContainer",
"(",
"restConfig",
"*",
"rest",
".",
"Config",
",",
"namespace",
"string",
",",
"pod",
"string",
",",
"container",
"string",
",",
"stdout",
"bool",
",",
"stderr",
"bool",
",",
"command",
"...",
"string",
")",
"(",
"remotecommand",... | // ExecPodContainer runs a command in a container in a pod and returns the remotecommand.Executor | [
"ExecPodContainer",
"runs",
"a",
"command",
"in",
"a",
"container",
"in",
"a",
"pod",
"and",
"returns",
"the",
"remotecommand",
".",
"Executor"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L194-L220 |
134,627 | argoproj/argo | workflow/common/util.go | GetExecutorOutput | func GetExecutorOutput(exec remotecommand.Executor) (*bytes.Buffer, *bytes.Buffer, error) {
var stdOut bytes.Buffer
var stdErr bytes.Buffer
err := exec.Stream(remotecommand.StreamOptions{
Stdout: &stdOut,
Stderr: &stdErr,
Tty: false,
})
if err != nil {
return nil, nil, errors.InternalWrapError(err)
}
... | go | func GetExecutorOutput(exec remotecommand.Executor) (*bytes.Buffer, *bytes.Buffer, error) {
var stdOut bytes.Buffer
var stdErr bytes.Buffer
err := exec.Stream(remotecommand.StreamOptions{
Stdout: &stdOut,
Stderr: &stdErr,
Tty: false,
})
if err != nil {
return nil, nil, errors.InternalWrapError(err)
}
... | [
"func",
"GetExecutorOutput",
"(",
"exec",
"remotecommand",
".",
"Executor",
")",
"(",
"*",
"bytes",
".",
"Buffer",
",",
"*",
"bytes",
".",
"Buffer",
",",
"error",
")",
"{",
"var",
"stdOut",
"bytes",
".",
"Buffer",
"\n",
"var",
"stdErr",
"bytes",
".",
"... | // GetExecutorOutput returns the output of an remotecommand.Executor | [
"GetExecutorOutput",
"returns",
"the",
"output",
"of",
"an",
"remotecommand",
".",
"Executor"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L223-L235 |
134,628 | argoproj/argo | workflow/common/util.go | substituteParams | func substituteParams(tmpl *wfv1.Template, globalParams, localParams map[string]string) (*wfv1.Template, error) {
tmplBytes, err := json.Marshal(tmpl)
if err != nil {
return nil, errors.InternalWrapError(err)
}
// First replace globals & locals, then replace inputs because globals could be referenced in the input... | go | func substituteParams(tmpl *wfv1.Template, globalParams, localParams map[string]string) (*wfv1.Template, error) {
tmplBytes, err := json.Marshal(tmpl)
if err != nil {
return nil, errors.InternalWrapError(err)
}
// First replace globals & locals, then replace inputs because globals could be referenced in the input... | [
"func",
"substituteParams",
"(",
"tmpl",
"*",
"wfv1",
".",
"Template",
",",
"globalParams",
",",
"localParams",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"wfv1",
".",
"Template",
",",
"error",
")",
"{",
"tmplBytes",
",",
"err",
":=",
"json",
... | // substituteParams returns a new copy of the template with global, pod, and input parameters substituted | [
"substituteParams",
"returns",
"a",
"new",
"copy",
"of",
"the",
"template",
"with",
"global",
"pod",
"and",
"input",
"parameters",
"substituted"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L297-L355 |
134,629 | argoproj/argo | workflow/common/util.go | Replace | func Replace(fstTmpl *fasttemplate.Template, replaceMap map[string]string, allowUnresolved bool) (string, error) {
var unresolvedErr error
replacedTmpl := fstTmpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {
replacement, ok := replaceMap[tag]
if !ok {
if allowUnresolved {
// just write th... | go | func Replace(fstTmpl *fasttemplate.Template, replaceMap map[string]string, allowUnresolved bool) (string, error) {
var unresolvedErr error
replacedTmpl := fstTmpl.ExecuteFuncString(func(w io.Writer, tag string) (int, error) {
replacement, ok := replaceMap[tag]
if !ok {
if allowUnresolved {
// just write th... | [
"func",
"Replace",
"(",
"fstTmpl",
"*",
"fasttemplate",
".",
"Template",
",",
"replaceMap",
"map",
"[",
"string",
"]",
"string",
",",
"allowUnresolved",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"unresolvedErr",
"error",
"\n",
"replacedTmpl"... | // Replace executes basic string substitution of a template with replacement values.
// allowUnresolved indicates whether or not it is acceptable to have unresolved variables
// remaining in the substituted template. prefixFilter will apply the replacements only
// to variables with the specified prefix | [
"Replace",
"executes",
"basic",
"string",
"substitution",
"of",
"a",
"template",
"with",
"replacement",
"values",
".",
"allowUnresolved",
"indicates",
"whether",
"or",
"not",
"it",
"is",
"acceptable",
"to",
"have",
"unresolved",
"variables",
"remaining",
"in",
"th... | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L361-L383 |
134,630 | argoproj/argo | workflow/common/util.go | AddPodAnnotation | func AddPodAnnotation(c kubernetes.Interface, podName, namespace, key, value string) error {
return addPodMetadata(c, "annotations", podName, namespace, key, value)
} | go | func AddPodAnnotation(c kubernetes.Interface, podName, namespace, key, value string) error {
return addPodMetadata(c, "annotations", podName, namespace, key, value)
} | [
"func",
"AddPodAnnotation",
"(",
"c",
"kubernetes",
".",
"Interface",
",",
"podName",
",",
"namespace",
",",
"key",
",",
"value",
"string",
")",
"error",
"{",
"return",
"addPodMetadata",
"(",
"c",
",",
"\"",
"\"",
",",
"podName",
",",
"namespace",
",",
"... | // AddPodAnnotation adds an annotation to pod | [
"AddPodAnnotation",
"adds",
"an",
"annotation",
"to",
"pod"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L405-L407 |
134,631 | argoproj/argo | workflow/common/util.go | addPodMetadata | func addPodMetadata(c kubernetes.Interface, field, podName, namespace, key, value string) error {
metadata := map[string]interface{}{
"metadata": map[string]interface{}{
field: map[string]string{
key: value,
},
},
}
var err error
patch, err := json.Marshal(metadata)
if err != nil {
return errors.In... | go | func addPodMetadata(c kubernetes.Interface, field, podName, namespace, key, value string) error {
metadata := map[string]interface{}{
"metadata": map[string]interface{}{
field: map[string]string{
key: value,
},
},
}
var err error
patch, err := json.Marshal(metadata)
if err != nil {
return errors.In... | [
"func",
"addPodMetadata",
"(",
"c",
"kubernetes",
".",
"Interface",
",",
"field",
",",
"podName",
",",
"namespace",
",",
"key",
",",
"value",
"string",
")",
"error",
"{",
"metadata",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\... | // addPodMetadata is helper to either add a pod label or annotation to the pod | [
"addPodMetadata",
"is",
"helper",
"to",
"either",
"add",
"a",
"pod",
"label",
"or",
"annotation",
"to",
"the",
"pod"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L415-L440 |
134,632 | argoproj/argo | workflow/common/util.go | IsPodTemplate | func IsPodTemplate(tmpl *wfv1.Template) bool {
if tmpl.Container != nil || tmpl.Script != nil || tmpl.Resource != nil {
return true
}
return false
} | go | func IsPodTemplate(tmpl *wfv1.Template) bool {
if tmpl.Container != nil || tmpl.Script != nil || tmpl.Resource != nil {
return true
}
return false
} | [
"func",
"IsPodTemplate",
"(",
"tmpl",
"*",
"wfv1",
".",
"Template",
")",
"bool",
"{",
"if",
"tmpl",
".",
"Container",
"!=",
"nil",
"||",
"tmpl",
".",
"Script",
"!=",
"nil",
"||",
"tmpl",
".",
"Resource",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",... | // IsPodTemplate returns whether the template corresponds to a pod | [
"IsPodTemplate",
"returns",
"whether",
"the",
"template",
"corresponds",
"to",
"a",
"pod"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L443-L448 |
134,633 | argoproj/argo | workflow/common/util.go | GetTaskAncestry | func GetTaskAncestry(taskName string, tasks []wfv1.DAGTask) []string {
taskByName := make(map[string]wfv1.DAGTask)
for _, task := range tasks {
taskByName[task.Name] = task
}
visited := make(map[string]bool)
var getAncestry func(s string)
getAncestry = func(currTask string) {
task := taskByName[currTask]
f... | go | func GetTaskAncestry(taskName string, tasks []wfv1.DAGTask) []string {
taskByName := make(map[string]wfv1.DAGTask)
for _, task := range tasks {
taskByName[task.Name] = task
}
visited := make(map[string]bool)
var getAncestry func(s string)
getAncestry = func(currTask string) {
task := taskByName[currTask]
f... | [
"func",
"GetTaskAncestry",
"(",
"taskName",
"string",
",",
"tasks",
"[",
"]",
"wfv1",
".",
"DAGTask",
")",
"[",
"]",
"string",
"{",
"taskByName",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"wfv1",
".",
"DAGTask",
")",
"\n",
"for",
"_",
",",
"task"... | // GetTaskAncestry returns a list of taskNames which are ancestors of this task | [
"GetTaskAncestry",
"returns",
"a",
"list",
"of",
"taskNames",
"which",
"are",
"ancestors",
"of",
"this",
"task"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L451-L475 |
134,634 | argoproj/argo | workflow/common/util.go | SplitYAMLFile | func SplitYAMLFile(body []byte, strict bool) ([]wfv1.Workflow, error) {
manifestsStrings := yamlSeparator.Split(string(body), -1)
manifests := make([]wfv1.Workflow, 0)
for _, manifestStr := range manifestsStrings {
if strings.TrimSpace(manifestStr) == "" {
continue
}
var wf wfv1.Workflow
var opts []yaml.J... | go | func SplitYAMLFile(body []byte, strict bool) ([]wfv1.Workflow, error) {
manifestsStrings := yamlSeparator.Split(string(body), -1)
manifests := make([]wfv1.Workflow, 0)
for _, manifestStr := range manifestsStrings {
if strings.TrimSpace(manifestStr) == "" {
continue
}
var wf wfv1.Workflow
var opts []yaml.J... | [
"func",
"SplitYAMLFile",
"(",
"body",
"[",
"]",
"byte",
",",
"strict",
"bool",
")",
"(",
"[",
"]",
"wfv1",
".",
"Workflow",
",",
"error",
")",
"{",
"manifestsStrings",
":=",
"yamlSeparator",
".",
"Split",
"(",
"string",
"(",
"body",
")",
",",
"-",
"1... | // SplitYAMLFile is a helper to split a body into multiple workflow objects | [
"SplitYAMLFile",
"is",
"a",
"helper",
"to",
"split",
"a",
"body",
"into",
"multiple",
"workflow",
"objects"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/common/util.go#L480-L504 |
134,635 | argoproj/argo | workflow/validate/lint.go | LintWorkflowDir | func LintWorkflowDir(dirPath string, strict bool) error {
walkFunc := func(path string, info os.FileInfo, err error) error {
if info == nil || info.IsDir() {
return nil
}
fileExt := filepath.Ext(info.Name())
switch fileExt {
case ".yaml", ".yml", ".json":
default:
return nil
}
return LintWorkflow... | go | func LintWorkflowDir(dirPath string, strict bool) error {
walkFunc := func(path string, info os.FileInfo, err error) error {
if info == nil || info.IsDir() {
return nil
}
fileExt := filepath.Ext(info.Name())
switch fileExt {
case ".yaml", ".yml", ".json":
default:
return nil
}
return LintWorkflow... | [
"func",
"LintWorkflowDir",
"(",
"dirPath",
"string",
",",
"strict",
"bool",
")",
"error",
"{",
"walkFunc",
":=",
"func",
"(",
"path",
"string",
",",
"info",
"os",
".",
"FileInfo",
",",
"err",
"error",
")",
"error",
"{",
"if",
"info",
"==",
"nil",
"||",... | // LintWorkflowDir validates all workflow manifests in a directory. Ignores non-workflow manifests | [
"LintWorkflowDir",
"validates",
"all",
"workflow",
"manifests",
"in",
"a",
"directory",
".",
"Ignores",
"non",
"-",
"workflow",
"manifests"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/lint.go#L17-L31 |
134,636 | argoproj/argo | workflow/validate/lint.go | LintWorkflowFile | func LintWorkflowFile(filePath string, strict bool) error {
body, err := ioutil.ReadFile(filePath)
if err != nil {
return errors.Errorf(errors.CodeBadRequest, "Can't read from file: %s, err: %v", filePath, err)
}
var workflows []wfv1.Workflow
if json.IsJSON(body) {
var wf wfv1.Workflow
if strict {
err = j... | go | func LintWorkflowFile(filePath string, strict bool) error {
body, err := ioutil.ReadFile(filePath)
if err != nil {
return errors.Errorf(errors.CodeBadRequest, "Can't read from file: %s, err: %v", filePath, err)
}
var workflows []wfv1.Workflow
if json.IsJSON(body) {
var wf wfv1.Workflow
if strict {
err = j... | [
"func",
"LintWorkflowFile",
"(",
"filePath",
"string",
",",
"strict",
"bool",
")",
"error",
"{",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"er... | // LintWorkflowFile lints a json file, or multiple workflow manifest in a single yaml file. Ignores
// non-workflow manifests | [
"LintWorkflowFile",
"lints",
"a",
"json",
"file",
"or",
"multiple",
"workflow",
"manifest",
"in",
"a",
"single",
"yaml",
"file",
".",
"Ignores",
"non",
"-",
"workflow",
"manifests"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/lint.go#L35-L70 |
134,637 | argoproj/argo | workflow/executor/docker/docker.go | Kill | func (d *DockerExecutor) Kill(containerIDs []string) error {
killArgs := append([]string{"kill", "--signal", "TERM"}, containerIDs...)
err := common.RunCommand("docker", killArgs...)
if err != nil {
return errors.InternalWrapError(err)
}
waitArgs := append([]string{"wait"}, containerIDs...)
waitCmd := exec.Comm... | go | func (d *DockerExecutor) Kill(containerIDs []string) error {
killArgs := append([]string{"kill", "--signal", "TERM"}, containerIDs...)
err := common.RunCommand("docker", killArgs...)
if err != nil {
return errors.InternalWrapError(err)
}
waitArgs := append([]string{"wait"}, containerIDs...)
waitCmd := exec.Comm... | [
"func",
"(",
"d",
"*",
"DockerExecutor",
")",
"Kill",
"(",
"containerIDs",
"[",
"]",
"string",
")",
"error",
"{",
"killArgs",
":=",
"append",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"containerIDs",
"...... | // killContainers kills a list of containerIDs first with a SIGTERM then with a SIGKILL after a grace period | [
"killContainers",
"kills",
"a",
"list",
"of",
"containerIDs",
"first",
"with",
"a",
"SIGTERM",
"then",
"with",
"a",
"SIGKILL",
"after",
"a",
"grace",
"period"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/docker/docker.go#L99-L130 |
134,638 | argoproj/argo | workflow/util/util.go | FromUnstructured | func FromUnstructured(un *unstructured.Unstructured) (*wfv1.Workflow, error) {
var wf wfv1.Workflow
err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &wf)
return &wf, err
} | go | func FromUnstructured(un *unstructured.Unstructured) (*wfv1.Workflow, error) {
var wf wfv1.Workflow
err := runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, &wf)
return &wf, err
} | [
"func",
"FromUnstructured",
"(",
"un",
"*",
"unstructured",
".",
"Unstructured",
")",
"(",
"*",
"wfv1",
".",
"Workflow",
",",
"error",
")",
"{",
"var",
"wf",
"wfv1",
".",
"Workflow",
"\n",
"err",
":=",
"runtime",
".",
"DefaultUnstructuredConverter",
".",
"... | // FromUnstructured converts an unstructured object to a workflow | [
"FromUnstructured",
"converts",
"an",
"unstructured",
"object",
"to",
"a",
"workflow"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L115-L119 |
134,639 | argoproj/argo | workflow/util/util.go | ToUnstructured | func ToUnstructured(wf *wfv1.Workflow) (*unstructured.Unstructured, error) {
obj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(wf)
return &unstructured.Unstructured{Object: obj}, err
} | go | func ToUnstructured(wf *wfv1.Workflow) (*unstructured.Unstructured, error) {
obj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(wf)
return &unstructured.Unstructured{Object: obj}, err
} | [
"func",
"ToUnstructured",
"(",
"wf",
"*",
"wfv1",
".",
"Workflow",
")",
"(",
"*",
"unstructured",
".",
"Unstructured",
",",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"runtime",
".",
"DefaultUnstructuredConverter",
".",
"ToUnstructured",
"(",
"wf",
")",
"... | // ToUnstructured converts an workflow to an Unstructured object | [
"ToUnstructured",
"converts",
"an",
"workflow",
"to",
"an",
"Unstructured",
"object"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L122-L125 |
134,640 | argoproj/argo | workflow/util/util.go | IsWorkflowCompleted | func IsWorkflowCompleted(wf *wfv1.Workflow) bool {
if wf.ObjectMeta.Labels != nil {
return wf.ObjectMeta.Labels[common.LabelKeyCompleted] == "true"
}
return false
} | go | func IsWorkflowCompleted(wf *wfv1.Workflow) bool {
if wf.ObjectMeta.Labels != nil {
return wf.ObjectMeta.Labels[common.LabelKeyCompleted] == "true"
}
return false
} | [
"func",
"IsWorkflowCompleted",
"(",
"wf",
"*",
"wfv1",
".",
"Workflow",
")",
"bool",
"{",
"if",
"wf",
".",
"ObjectMeta",
".",
"Labels",
"!=",
"nil",
"{",
"return",
"wf",
".",
"ObjectMeta",
".",
"Labels",
"[",
"common",
".",
"LabelKeyCompleted",
"]",
"=="... | // IsWorkflowCompleted returns whether or not a workflow is considered completed | [
"IsWorkflowCompleted",
"returns",
"whether",
"or",
"not",
"a",
"workflow",
"is",
"considered",
"completed"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L128-L133 |
134,641 | argoproj/argo | workflow/util/util.go | SuspendWorkflow | func SuspendWorkflow(wfIf v1alpha1.WorkflowInterface, workflowName string) error {
err := wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) {
wf, err := wfIf.Get(workflowName, metav1.GetOptions{})
if err != nil {
return false, err
}
if IsWorkflowCompleted(wf) {
return false, errSuspendedCo... | go | func SuspendWorkflow(wfIf v1alpha1.WorkflowInterface, workflowName string) error {
err := wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) {
wf, err := wfIf.Get(workflowName, metav1.GetOptions{})
if err != nil {
return false, err
}
if IsWorkflowCompleted(wf) {
return false, errSuspendedCo... | [
"func",
"SuspendWorkflow",
"(",
"wfIf",
"v1alpha1",
".",
"WorkflowInterface",
",",
"workflowName",
"string",
")",
"error",
"{",
"err",
":=",
"wait",
".",
"ExponentialBackoff",
"(",
"retry",
".",
"DefaultRetry",
",",
"func",
"(",
")",
"(",
"bool",
",",
"error... | // SuspendWorkflow suspends a workflow by setting spec.suspend to true. Retries conflict errors | [
"SuspendWorkflow",
"suspends",
"a",
"workflow",
"by",
"setting",
"spec",
".",
"suspend",
"to",
"true",
".",
"Retries",
"conflict",
"errors"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L251-L276 |
134,642 | argoproj/argo | workflow/util/util.go | ResumeWorkflow | func ResumeWorkflow(wfIf v1alpha1.WorkflowInterface, workflowName string) error {
err := wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) {
wf, err := wfIf.Get(workflowName, metav1.GetOptions{})
if err != nil {
return false, err
}
updated := false
if wf.Spec.Suspend != nil && *wf.Spec.Susp... | go | func ResumeWorkflow(wfIf v1alpha1.WorkflowInterface, workflowName string) error {
err := wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) {
wf, err := wfIf.Get(workflowName, metav1.GetOptions{})
if err != nil {
return false, err
}
updated := false
if wf.Spec.Suspend != nil && *wf.Spec.Susp... | [
"func",
"ResumeWorkflow",
"(",
"wfIf",
"v1alpha1",
".",
"WorkflowInterface",
",",
"workflowName",
"string",
")",
"error",
"{",
"err",
":=",
"wait",
".",
"ExponentialBackoff",
"(",
"retry",
".",
"DefaultRetry",
",",
"func",
"(",
")",
"(",
"bool",
",",
"error"... | // ResumeWorkflow resumes a workflow by setting spec.suspend to nil and any suspended nodes to Successful.
// Retries conflict errors | [
"ResumeWorkflow",
"resumes",
"a",
"workflow",
"by",
"setting",
"spec",
".",
"suspend",
"to",
"nil",
"and",
"any",
"suspended",
"nodes",
"to",
"Successful",
".",
"Retries",
"conflict",
"errors"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L280-L315 |
134,643 | argoproj/argo | workflow/util/util.go | convertNodeID | func convertNodeID(newWf *wfv1.Workflow, regex *regexp.Regexp, oldNodeID string, oldNodes map[string]wfv1.NodeStatus) string {
node := oldNodes[oldNodeID]
newNodeName := regex.ReplaceAllString(node.Name, newWf.ObjectMeta.Name)
return newWf.NodeID(newNodeName)
} | go | func convertNodeID(newWf *wfv1.Workflow, regex *regexp.Regexp, oldNodeID string, oldNodes map[string]wfv1.NodeStatus) string {
node := oldNodes[oldNodeID]
newNodeName := regex.ReplaceAllString(node.Name, newWf.ObjectMeta.Name)
return newWf.NodeID(newNodeName)
} | [
"func",
"convertNodeID",
"(",
"newWf",
"*",
"wfv1",
".",
"Workflow",
",",
"regex",
"*",
"regexp",
".",
"Regexp",
",",
"oldNodeID",
"string",
",",
"oldNodes",
"map",
"[",
"string",
"]",
"wfv1",
".",
"NodeStatus",
")",
"string",
"{",
"node",
":=",
"oldNode... | // convertNodeID converts an old nodeID to a new nodeID | [
"convertNodeID",
"converts",
"an",
"old",
"nodeID",
"to",
"a",
"new",
"nodeID"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L428-L432 |
134,644 | argoproj/argo | workflow/util/util.go | IsWorkflowSuspended | func IsWorkflowSuspended(wf *wfv1.Workflow) bool {
if wf.Spec.Suspend != nil && *wf.Spec.Suspend {
return true
}
for _, node := range wf.Status.Nodes {
if node.Type == wfv1.NodeTypeSuspend && node.Phase == wfv1.NodeRunning {
return true
}
}
return false
} | go | func IsWorkflowSuspended(wf *wfv1.Workflow) bool {
if wf.Spec.Suspend != nil && *wf.Spec.Suspend {
return true
}
for _, node := range wf.Status.Nodes {
if node.Type == wfv1.NodeTypeSuspend && node.Phase == wfv1.NodeRunning {
return true
}
}
return false
} | [
"func",
"IsWorkflowSuspended",
"(",
"wf",
"*",
"wfv1",
".",
"Workflow",
")",
"bool",
"{",
"if",
"wf",
".",
"Spec",
".",
"Suspend",
"!=",
"nil",
"&&",
"*",
"wf",
".",
"Spec",
".",
"Suspend",
"{",
"return",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
... | // IsWorkflowSuspended returns whether or not a workflow is considered suspended | [
"IsWorkflowSuspended",
"returns",
"whether",
"or",
"not",
"a",
"workflow",
"is",
"considered",
"suspended"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L485-L495 |
134,645 | argoproj/argo | workflow/util/util.go | TerminateWorkflow | func TerminateWorkflow(wfClient v1alpha1.WorkflowInterface, name string) error {
patchObj := map[string]interface{}{
"spec": map[string]interface{}{
"activeDeadlineSeconds": 0,
},
}
var err error
patch, err := json.Marshal(patchObj)
if err != nil {
return errors.InternalWrapError(err)
}
for attempt := 0... | go | func TerminateWorkflow(wfClient v1alpha1.WorkflowInterface, name string) error {
patchObj := map[string]interface{}{
"spec": map[string]interface{}{
"activeDeadlineSeconds": 0,
},
}
var err error
patch, err := json.Marshal(patchObj)
if err != nil {
return errors.InternalWrapError(err)
}
for attempt := 0... | [
"func",
"TerminateWorkflow",
"(",
"wfClient",
"v1alpha1",
".",
"WorkflowInterface",
",",
"name",
"string",
")",
"error",
"{",
"patchObj",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"map",
"[",
"string",
"]",
"interface",
... | // TerminateWorkflow terminates a workflow by setting its activeDeadlineSeconds to 0 | [
"TerminateWorkflow",
"terminates",
"a",
"workflow",
"by",
"setting",
"its",
"activeDeadlineSeconds",
"to",
"0"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/util/util.go#L505-L528 |
134,646 | argoproj/argo | workflow/artifacts/artifactory/artifactory.go | Load | func (a *ArtifactoryArtifactDriver) Load(artifact *wfv1.Artifact, path string) error {
lf, err := os.Create(path)
if err != nil {
return err
}
defer func() {
_ = lf.Close()
}()
req, err := http.NewRequest(http.MethodGet, artifact.Artifactory.URL, nil)
if err != nil {
return err
}
req.SetBasicAuth(a.Use... | go | func (a *ArtifactoryArtifactDriver) Load(artifact *wfv1.Artifact, path string) error {
lf, err := os.Create(path)
if err != nil {
return err
}
defer func() {
_ = lf.Close()
}()
req, err := http.NewRequest(http.MethodGet, artifact.Artifactory.URL, nil)
if err != nil {
return err
}
req.SetBasicAuth(a.Use... | [
"func",
"(",
"a",
"*",
"ArtifactoryArtifactDriver",
")",
"Load",
"(",
"artifact",
"*",
"wfv1",
".",
"Artifact",
",",
"path",
"string",
")",
"error",
"{",
"lf",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // Download artifact from an artifactory URL | [
"Download",
"artifact",
"from",
"an",
"artifactory",
"URL"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/artifacts/artifactory/artifactory.go#L18-L47 |
134,647 | argoproj/argo | workflow/artifacts/artifactory/artifactory.go | Save | func (a *ArtifactoryArtifactDriver) Save(path string, artifact *wfv1.Artifact) error {
f, err := os.Open(path)
if err != nil {
return err
}
req, err := http.NewRequest(http.MethodPut, artifact.Artifactory.URL, f)
if err != nil {
return err
}
req.SetBasicAuth(a.Username, a.Password)
res, err := (&http.Clien... | go | func (a *ArtifactoryArtifactDriver) Save(path string, artifact *wfv1.Artifact) error {
f, err := os.Open(path)
if err != nil {
return err
}
req, err := http.NewRequest(http.MethodPut, artifact.Artifactory.URL, f)
if err != nil {
return err
}
req.SetBasicAuth(a.Username, a.Password)
res, err := (&http.Clien... | [
"func",
"(",
"a",
"*",
"ArtifactoryArtifactDriver",
")",
"Save",
"(",
"path",
"string",
",",
"artifact",
"*",
"wfv1",
".",
"Artifact",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{... | // UpLoad artifact to an artifactory URL | [
"UpLoad",
"artifact",
"to",
"an",
"artifactory",
"URL"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/artifacts/artifactory/artifactory.go#L50-L72 |
134,648 | argoproj/argo | cmd/workflow-controller/main.go | NewRootCommand | func NewRootCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
configMap string // --configmap
executorImage string // --executor-image
executorImagePullPolicy string // --executor-image-pull-policy
logLevel string // --loglevel
glogLevel ... | go | func NewRootCommand() *cobra.Command {
var (
clientConfig clientcmd.ClientConfig
configMap string // --configmap
executorImage string // --executor-image
executorImagePullPolicy string // --executor-image-pull-policy
logLevel string // --loglevel
glogLevel ... | [
"func",
"NewRootCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"(",
"clientConfig",
"clientcmd",
".",
"ClientConfig",
"\n",
"configMap",
"string",
"// --configmap",
"\n",
"executorImage",
"string",
"// --executor-image",
"\n",
"executorImagePullPolicy",... | // NewRootCommand returns an new instance of the workflow-controller main entrypoint | [
"NewRootCommand",
"returns",
"an",
"new",
"instance",
"of",
"the",
"workflow",
"-",
"controller",
"main",
"entrypoint"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/workflow-controller/main.go#L30-L96 |
134,649 | argoproj/argo | util/archive/archive.go | TarGzToWriter | func TarGzToWriter(sourcePath string, w io.Writer) error {
sourcePath, err := filepath.Abs(sourcePath)
if err != nil {
return errors.InternalErrorf("getting absolute path: %v", err)
}
log.Infof("Taring %s", sourcePath)
sourceFi, err := os.Stat(sourcePath)
if err != nil {
if os.IsNotExist(err) {
return erro... | go | func TarGzToWriter(sourcePath string, w io.Writer) error {
sourcePath, err := filepath.Abs(sourcePath)
if err != nil {
return errors.InternalErrorf("getting absolute path: %v", err)
}
log.Infof("Taring %s", sourcePath)
sourceFi, err := os.Stat(sourcePath)
if err != nil {
if os.IsNotExist(err) {
return erro... | [
"func",
"TarGzToWriter",
"(",
"sourcePath",
"string",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"sourcePath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"sourcePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Inter... | // TarGzToWriter tar.gz's the source path to the supplied writer | [
"TarGzToWriter",
"tar",
".",
"gz",
"s",
"the",
"source",
"path",
"to",
"the",
"supplied",
"writer"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/archive/archive.go#L20-L48 |
134,650 | argoproj/argo | workflow/controller/config.go | ResyncConfig | func (wfc *WorkflowController) ResyncConfig() error {
cmClient := wfc.kubeclientset.CoreV1().ConfigMaps(wfc.namespace)
cm, err := cmClient.Get(wfc.configMap, metav1.GetOptions{})
if err != nil {
return errors.InternalWrapError(err)
}
return wfc.updateConfig(cm)
} | go | func (wfc *WorkflowController) ResyncConfig() error {
cmClient := wfc.kubeclientset.CoreV1().ConfigMaps(wfc.namespace)
cm, err := cmClient.Get(wfc.configMap, metav1.GetOptions{})
if err != nil {
return errors.InternalWrapError(err)
}
return wfc.updateConfig(cm)
} | [
"func",
"(",
"wfc",
"*",
"WorkflowController",
")",
"ResyncConfig",
"(",
")",
"error",
"{",
"cmClient",
":=",
"wfc",
".",
"kubeclientset",
".",
"CoreV1",
"(",
")",
".",
"ConfigMaps",
"(",
"wfc",
".",
"namespace",
")",
"\n",
"cm",
",",
"err",
":=",
"cmC... | // ResyncConfig reloads the controller config from the configmap | [
"ResyncConfig",
"reloads",
"the",
"controller",
"config",
"from",
"the",
"configmap"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/config.go#L132-L139 |
134,651 | argoproj/argo | workflow/controller/config.go | executorImage | func (wfc *WorkflowController) executorImage() string {
if wfc.cliExecutorImage != "" {
return wfc.cliExecutorImage
}
return wfc.Config.ExecutorImage
} | go | func (wfc *WorkflowController) executorImage() string {
if wfc.cliExecutorImage != "" {
return wfc.cliExecutorImage
}
return wfc.Config.ExecutorImage
} | [
"func",
"(",
"wfc",
"*",
"WorkflowController",
")",
"executorImage",
"(",
")",
"string",
"{",
"if",
"wfc",
".",
"cliExecutorImage",
"!=",
"\"",
"\"",
"{",
"return",
"wfc",
".",
"cliExecutorImage",
"\n",
"}",
"\n",
"return",
"wfc",
".",
"Config",
".",
"Ex... | // executorImage returns the image to use for the workflow executor | [
"executorImage",
"returns",
"the",
"image",
"to",
"use",
"for",
"the",
"workflow",
"executor"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/config.go#L162-L167 |
134,652 | argoproj/argo | workflow/controller/config.go | executorImagePullPolicy | func (wfc *WorkflowController) executorImagePullPolicy() apiv1.PullPolicy {
if wfc.cliExecutorImagePullPolicy != "" {
return apiv1.PullPolicy(wfc.cliExecutorImagePullPolicy)
} else if wfc.Config.Executor != nil && wfc.Config.Executor.ImagePullPolicy != "" {
return wfc.Config.Executor.ImagePullPolicy
} else {
r... | go | func (wfc *WorkflowController) executorImagePullPolicy() apiv1.PullPolicy {
if wfc.cliExecutorImagePullPolicy != "" {
return apiv1.PullPolicy(wfc.cliExecutorImagePullPolicy)
} else if wfc.Config.Executor != nil && wfc.Config.Executor.ImagePullPolicy != "" {
return wfc.Config.Executor.ImagePullPolicy
} else {
r... | [
"func",
"(",
"wfc",
"*",
"WorkflowController",
")",
"executorImagePullPolicy",
"(",
")",
"apiv1",
".",
"PullPolicy",
"{",
"if",
"wfc",
".",
"cliExecutorImagePullPolicy",
"!=",
"\"",
"\"",
"{",
"return",
"apiv1",
".",
"PullPolicy",
"(",
"wfc",
".",
"cliExecutor... | // executorImagePullPolicy returns the imagePullPolicy to use for the workflow executor | [
"executorImagePullPolicy",
"returns",
"the",
"imagePullPolicy",
"to",
"use",
"for",
"the",
"workflow",
"executor"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/controller/config.go#L170-L178 |
134,653 | argoproj/argo | pkg/client/listers/workflow/v1alpha1/workflow.go | List | func (s *workflowLister) List(selector labels.Selector) (ret []*v1alpha1.Workflow, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Workflow))
})
return ret, err
} | go | func (s *workflowLister) List(selector labels.Selector) (ret []*v1alpha1.Workflow, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Workflow))
})
return ret, err
} | [
"func",
"(",
"s",
"*",
"workflowLister",
")",
"List",
"(",
"selector",
"labels",
".",
"Selector",
")",
"(",
"ret",
"[",
"]",
"*",
"v1alpha1",
".",
"Workflow",
",",
"err",
"error",
")",
"{",
"err",
"=",
"cache",
".",
"ListAll",
"(",
"s",
".",
"index... | // List lists all Workflows in the indexer. | [
"List",
"lists",
"all",
"Workflows",
"in",
"the",
"indexer",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/client/listers/workflow/v1alpha1/workflow.go#L32-L37 |
134,654 | argoproj/argo | pkg/client/listers/workflow/v1alpha1/workflow.go | Workflows | func (s *workflowLister) Workflows(namespace string) WorkflowNamespaceLister {
return workflowNamespaceLister{indexer: s.indexer, namespace: namespace}
} | go | func (s *workflowLister) Workflows(namespace string) WorkflowNamespaceLister {
return workflowNamespaceLister{indexer: s.indexer, namespace: namespace}
} | [
"func",
"(",
"s",
"*",
"workflowLister",
")",
"Workflows",
"(",
"namespace",
"string",
")",
"WorkflowNamespaceLister",
"{",
"return",
"workflowNamespaceLister",
"{",
"indexer",
":",
"s",
".",
"indexer",
",",
"namespace",
":",
"namespace",
"}",
"\n",
"}"
] | // Workflows returns an object that can list and get Workflows. | [
"Workflows",
"returns",
"an",
"object",
"that",
"can",
"list",
"and",
"get",
"Workflows",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/client/listers/workflow/v1alpha1/workflow.go#L40-L42 |
134,655 | argoproj/argo | pkg/client/listers/workflow/v1alpha1/workflow.go | List | func (s workflowNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Workflow, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Workflow))
})
return ret, err
} | go | func (s workflowNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Workflow, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Workflow))
})
return ret, err
} | [
"func",
"(",
"s",
"workflowNamespaceLister",
")",
"List",
"(",
"selector",
"labels",
".",
"Selector",
")",
"(",
"ret",
"[",
"]",
"*",
"v1alpha1",
".",
"Workflow",
",",
"err",
"error",
")",
"{",
"err",
"=",
"cache",
".",
"ListAllByNamespace",
"(",
"s",
... | // List lists all Workflows in the indexer for a given namespace. | [
"List",
"lists",
"all",
"Workflows",
"in",
"the",
"indexer",
"for",
"a",
"given",
"namespace",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/client/listers/workflow/v1alpha1/workflow.go#L61-L66 |
134,656 | argoproj/argo | cmd/argo/commands/root.go | NewCommand | func NewCommand() *cobra.Command {
var command = &cobra.Command{
Use: CLIName,
Short: "argo is the command line interface to Argo",
Run: func(cmd *cobra.Command, args []string) {
cmd.HelpFunc()(cmd, args)
},
}
command.AddCommand(NewCompletionCommand())
command.AddCommand(NewDeleteCommand())
command.A... | go | func NewCommand() *cobra.Command {
var command = &cobra.Command{
Use: CLIName,
Short: "argo is the command line interface to Argo",
Run: func(cmd *cobra.Command, args []string) {
cmd.HelpFunc()(cmd, args)
},
}
command.AddCommand(NewCompletionCommand())
command.AddCommand(NewDeleteCommand())
command.A... | [
"func",
"NewCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"command",
"=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"CLIName",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
... | // NewCommand returns a new instance of an argo command | [
"NewCommand",
"returns",
"a",
"new",
"instance",
"of",
"an",
"argo",
"command"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/root.go#L17-L44 |
134,657 | argoproj/argo | errors/errors.go | Errorf | func Errorf(code string, format string, args ...interface{}) error {
return New(code, fmt.Sprintf(format, args...))
} | go | func Errorf(code string, format string, args ...interface{}) error {
return New(code, fmt.Sprintf(format, args...))
} | [
"func",
"Errorf",
"(",
"code",
"string",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"New",
"(",
"code",
",",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
")",
"\n",
"}"
] | // Errorf returns an error and formats according to a format specifier | [
"Errorf",
"returns",
"an",
"error",
"and",
"formats",
"according",
"to",
"a",
"format",
"specifier"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/errors/errors.go#L54-L56 |
134,658 | argoproj/argo | errors/errors.go | InternalWrapError | func InternalWrapError(err error, message ...string) error {
if len(message) == 0 {
return Wrap(err, CodeInternal, err.Error())
}
return Wrap(err, CodeInternal, message[0])
} | go | func InternalWrapError(err error, message ...string) error {
if len(message) == 0 {
return Wrap(err, CodeInternal, err.Error())
}
return Wrap(err, CodeInternal, message[0])
} | [
"func",
"InternalWrapError",
"(",
"err",
"error",
",",
"message",
"...",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"message",
")",
"==",
"0",
"{",
"return",
"Wrap",
"(",
"err",
",",
"CodeInternal",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
... | // InternalWrapError annotates the error with the ERR_INTERNAL code and a stack trace, optional message | [
"InternalWrapError",
"annotates",
"the",
"error",
"with",
"the",
"ERR_INTERNAL",
"code",
"and",
"a",
"stack",
"trace",
"optional",
"message"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/errors/errors.go#L69-L74 |
134,659 | argoproj/argo | errors/errors.go | InternalWrapErrorf | func InternalWrapErrorf(err error, format string, args ...interface{}) error {
return Wrap(err, CodeInternal, fmt.Sprintf(format, args...))
} | go | func InternalWrapErrorf(err error, format string, args ...interface{}) error {
return Wrap(err, CodeInternal, fmt.Sprintf(format, args...))
} | [
"func",
"InternalWrapErrorf",
"(",
"err",
"error",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"Wrap",
"(",
"err",
",",
"CodeInternal",
",",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
... | // InternalWrapErrorf annotates the error with the ERR_INTERNAL code and a stack trace, optional message | [
"InternalWrapErrorf",
"annotates",
"the",
"error",
"with",
"the",
"ERR_INTERNAL",
"code",
"and",
"a",
"stack",
"trace",
"optional",
"message"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/errors/errors.go#L77-L79 |
134,660 | argoproj/argo | errors/errors.go | IsCode | func IsCode(code string, err error) bool {
if argoErr, ok := err.(argoerr); ok {
return argoErr.code == code
}
return false
} | go | func IsCode(code string, err error) bool {
if argoErr, ok := err.(argoerr); ok {
return argoErr.code == code
}
return false
} | [
"func",
"IsCode",
"(",
"code",
"string",
",",
"err",
"error",
")",
"bool",
"{",
"if",
"argoErr",
",",
"ok",
":=",
"err",
".",
"(",
"argoerr",
")",
";",
"ok",
"{",
"return",
"argoErr",
".",
"code",
"==",
"code",
"\n",
"}",
"\n",
"return",
"false",
... | // IsCode is a helper to determine if the error is of a specific code | [
"IsCode",
"is",
"a",
"helper",
"to",
"determine",
"if",
"the",
"error",
"is",
"of",
"a",
"specific",
"code"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/errors/errors.go#L155-L161 |
134,661 | argoproj/argo | cmd/argo/commands/common.go | InitWorkflowClient | func InitWorkflowClient(ns ...string) v1alpha1.WorkflowInterface {
if wfClient != nil {
return wfClient
}
initKubeClient()
var namespace string
var err error
if len(ns) > 0 {
namespace = ns[0]
} else {
namespace, _, err = clientConfig.Namespace()
if err != nil {
log.Fatal(err)
}
}
wfcs := wfclient... | go | func InitWorkflowClient(ns ...string) v1alpha1.WorkflowInterface {
if wfClient != nil {
return wfClient
}
initKubeClient()
var namespace string
var err error
if len(ns) > 0 {
namespace = ns[0]
} else {
namespace, _, err = clientConfig.Namespace()
if err != nil {
log.Fatal(err)
}
}
wfcs := wfclient... | [
"func",
"InitWorkflowClient",
"(",
"ns",
"...",
"string",
")",
"v1alpha1",
".",
"WorkflowInterface",
"{",
"if",
"wfClient",
"!=",
"nil",
"{",
"return",
"wfClient",
"\n",
"}",
"\n",
"initKubeClient",
"(",
")",
"\n",
"var",
"namespace",
"string",
"\n",
"var",
... | // InitWorkflowClient creates a new client for the Kubernetes Workflow CRD. | [
"InitWorkflowClient",
"creates",
"a",
"new",
"client",
"for",
"the",
"Kubernetes",
"Workflow",
"CRD",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/common.go#L79-L97 |
134,662 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | Completed | func (n NodeStatus) Completed() bool {
return isCompletedPhase(n.Phase) || n.IsDaemoned() && n.Phase != NodePending
} | go | func (n NodeStatus) Completed() bool {
return isCompletedPhase(n.Phase) || n.IsDaemoned() && n.Phase != NodePending
} | [
"func",
"(",
"n",
"NodeStatus",
")",
"Completed",
"(",
")",
"bool",
"{",
"return",
"isCompletedPhase",
"(",
"n",
".",
"Phase",
")",
"||",
"n",
".",
"IsDaemoned",
"(",
")",
"&&",
"n",
".",
"Phase",
"!=",
"NodePending",
"\n",
"}"
] | // Remove returns whether or not the node has completed execution | [
"Remove",
"returns",
"whether",
"or",
"not",
"the",
"node",
"has",
"completed",
"execution"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L608-L610 |
134,663 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | IsDaemoned | func (n NodeStatus) IsDaemoned() bool {
if n.Daemoned == nil || !*n.Daemoned {
return false
}
return true
} | go | func (n NodeStatus) IsDaemoned() bool {
if n.Daemoned == nil || !*n.Daemoned {
return false
}
return true
} | [
"func",
"(",
"n",
"NodeStatus",
")",
"IsDaemoned",
"(",
")",
"bool",
"{",
"if",
"n",
".",
"Daemoned",
"==",
"nil",
"||",
"!",
"*",
"n",
".",
"Daemoned",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] | // IsDaemoned returns whether or not the node is deamoned | [
"IsDaemoned",
"returns",
"whether",
"or",
"not",
"the",
"node",
"is",
"deamoned"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L613-L618 |
134,664 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | Successful | func (n NodeStatus) Successful() bool {
return n.Phase == NodeSucceeded || n.Phase == NodeSkipped || n.IsDaemoned() && n.Phase != NodePending
} | go | func (n NodeStatus) Successful() bool {
return n.Phase == NodeSucceeded || n.Phase == NodeSkipped || n.IsDaemoned() && n.Phase != NodePending
} | [
"func",
"(",
"n",
"NodeStatus",
")",
"Successful",
"(",
")",
"bool",
"{",
"return",
"n",
".",
"Phase",
"==",
"NodeSucceeded",
"||",
"n",
".",
"Phase",
"==",
"NodeSkipped",
"||",
"n",
".",
"IsDaemoned",
"(",
")",
"&&",
"n",
".",
"Phase",
"!=",
"NodePe... | // Successful returns whether or not this node completed successfully | [
"Successful",
"returns",
"whether",
"or",
"not",
"this",
"node",
"completed",
"successfully"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L621-L623 |
134,665 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | GetType | func (tmpl *Template) GetType() TemplateType {
if tmpl.Container != nil {
return TemplateTypeContainer
}
if tmpl.Steps != nil {
return TemplateTypeSteps
}
if tmpl.DAG != nil {
return TemplateTypeDAG
}
if tmpl.Script != nil {
return TemplateTypeScript
}
if tmpl.Resource != nil {
return TemplateTypeRes... | go | func (tmpl *Template) GetType() TemplateType {
if tmpl.Container != nil {
return TemplateTypeContainer
}
if tmpl.Steps != nil {
return TemplateTypeSteps
}
if tmpl.DAG != nil {
return TemplateTypeDAG
}
if tmpl.Script != nil {
return TemplateTypeScript
}
if tmpl.Resource != nil {
return TemplateTypeRes... | [
"func",
"(",
"tmpl",
"*",
"Template",
")",
"GetType",
"(",
")",
"TemplateType",
"{",
"if",
"tmpl",
".",
"Container",
"!=",
"nil",
"{",
"return",
"TemplateTypeContainer",
"\n",
"}",
"\n",
"if",
"tmpl",
".",
"Steps",
"!=",
"nil",
"{",
"return",
"TemplateTy... | // GetType returns the type of this template | [
"GetType",
"returns",
"the",
"type",
"of",
"this",
"template"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L838-L858 |
134,666 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | IsPodType | func (tmpl *Template) IsPodType() bool {
switch tmpl.GetType() {
case TemplateTypeContainer, TemplateTypeScript, TemplateTypeResource:
return true
}
return false
} | go | func (tmpl *Template) IsPodType() bool {
switch tmpl.GetType() {
case TemplateTypeContainer, TemplateTypeScript, TemplateTypeResource:
return true
}
return false
} | [
"func",
"(",
"tmpl",
"*",
"Template",
")",
"IsPodType",
"(",
")",
"bool",
"{",
"switch",
"tmpl",
".",
"GetType",
"(",
")",
"{",
"case",
"TemplateTypeContainer",
",",
"TemplateTypeScript",
",",
"TemplateTypeResource",
":",
"return",
"true",
"\n",
"}",
"\n",
... | // IsPodType returns whether or not the template is a pod type | [
"IsPodType",
"returns",
"whether",
"or",
"not",
"the",
"template",
"is",
"a",
"pod",
"type"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L861-L867 |
134,667 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | IsLeaf | func (tmpl *Template) IsLeaf() bool {
switch tmpl.GetType() {
case TemplateTypeContainer, TemplateTypeScript:
return true
}
return false
} | go | func (tmpl *Template) IsLeaf() bool {
switch tmpl.GetType() {
case TemplateTypeContainer, TemplateTypeScript:
return true
}
return false
} | [
"func",
"(",
"tmpl",
"*",
"Template",
")",
"IsLeaf",
"(",
")",
"bool",
"{",
"switch",
"tmpl",
".",
"GetType",
"(",
")",
"{",
"case",
"TemplateTypeContainer",
",",
"TemplateTypeScript",
":",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
... | // IsLeaf returns whether or not the template is a leaf | [
"IsLeaf",
"returns",
"whether",
"or",
"not",
"the",
"template",
"is",
"a",
"leaf"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L870-L876 |
134,668 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | GetArtifactByName | func (in *Inputs) GetArtifactByName(name string) *Artifact {
for _, art := range in.Artifacts {
if art.Name == name {
return &art
}
}
return nil
} | go | func (in *Inputs) GetArtifactByName(name string) *Artifact {
for _, art := range in.Artifacts {
if art.Name == name {
return &art
}
}
return nil
} | [
"func",
"(",
"in",
"*",
"Inputs",
")",
"GetArtifactByName",
"(",
"name",
"string",
")",
"*",
"Artifact",
"{",
"for",
"_",
",",
"art",
":=",
"range",
"in",
".",
"Artifacts",
"{",
"if",
"art",
".",
"Name",
"==",
"name",
"{",
"return",
"&",
"art",
"\n... | // GetArtifactByName returns an input artifact by its name | [
"GetArtifactByName",
"returns",
"an",
"input",
"artifact",
"by",
"its",
"name"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L924-L931 |
134,669 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | GetParameterByName | func (in *Inputs) GetParameterByName(name string) *Parameter {
for _, param := range in.Parameters {
if param.Name == name {
return ¶m
}
}
return nil
} | go | func (in *Inputs) GetParameterByName(name string) *Parameter {
for _, param := range in.Parameters {
if param.Name == name {
return ¶m
}
}
return nil
} | [
"func",
"(",
"in",
"*",
"Inputs",
")",
"GetParameterByName",
"(",
"name",
"string",
")",
"*",
"Parameter",
"{",
"for",
"_",
",",
"param",
":=",
"range",
"in",
".",
"Parameters",
"{",
"if",
"param",
".",
"Name",
"==",
"name",
"{",
"return",
"&",
"para... | // GetParameterByName returns an input parameter by its name | [
"GetParameterByName",
"returns",
"an",
"input",
"parameter",
"by",
"its",
"name"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L934-L941 |
134,670 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | HasInputs | func (in *Inputs) HasInputs() bool {
if len(in.Artifacts) > 0 {
return true
}
if len(in.Parameters) > 0 {
return true
}
return false
} | go | func (in *Inputs) HasInputs() bool {
if len(in.Artifacts) > 0 {
return true
}
if len(in.Parameters) > 0 {
return true
}
return false
} | [
"func",
"(",
"in",
"*",
"Inputs",
")",
"HasInputs",
"(",
")",
"bool",
"{",
"if",
"len",
"(",
"in",
".",
"Artifacts",
")",
">",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"len",
"(",
"in",
".",
"Parameters",
")",
">",
"0",
"{",
"return",... | // HasInputs returns whether or not there are any inputs | [
"HasInputs",
"returns",
"whether",
"or",
"not",
"there",
"are",
"any",
"inputs"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L944-L952 |
134,671 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | HasOutputs | func (out *Outputs) HasOutputs() bool {
if out.Result != nil {
return true
}
if len(out.Artifacts) > 0 {
return true
}
if len(out.Parameters) > 0 {
return true
}
return false
} | go | func (out *Outputs) HasOutputs() bool {
if out.Result != nil {
return true
}
if len(out.Artifacts) > 0 {
return true
}
if len(out.Parameters) > 0 {
return true
}
return false
} | [
"func",
"(",
"out",
"*",
"Outputs",
")",
"HasOutputs",
"(",
")",
"bool",
"{",
"if",
"out",
".",
"Result",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"len",
"(",
"out",
".",
"Artifacts",
")",
">",
"0",
"{",
"return",
"true",
"\n",
... | // HasOutputs returns whether or not there are any outputs | [
"HasOutputs",
"returns",
"whether",
"or",
"not",
"there",
"are",
"any",
"outputs"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L955-L966 |
134,672 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | GetArtifactByName | func (args *Arguments) GetArtifactByName(name string) *Artifact {
for _, art := range args.Artifacts {
if art.Name == name {
return &art
}
}
return nil
} | go | func (args *Arguments) GetArtifactByName(name string) *Artifact {
for _, art := range args.Artifacts {
if art.Name == name {
return &art
}
}
return nil
} | [
"func",
"(",
"args",
"*",
"Arguments",
")",
"GetArtifactByName",
"(",
"name",
"string",
")",
"*",
"Artifact",
"{",
"for",
"_",
",",
"art",
":=",
"range",
"args",
".",
"Artifacts",
"{",
"if",
"art",
".",
"Name",
"==",
"name",
"{",
"return",
"&",
"art"... | // GetArtifactByName retrieves an artifact by its name | [
"GetArtifactByName",
"retrieves",
"an",
"artifact",
"by",
"its",
"name"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L969-L976 |
134,673 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | GetParameterByName | func (args *Arguments) GetParameterByName(name string) *Parameter {
for _, param := range args.Parameters {
if param.Name == name {
return ¶m
}
}
return nil
} | go | func (args *Arguments) GetParameterByName(name string) *Parameter {
for _, param := range args.Parameters {
if param.Name == name {
return ¶m
}
}
return nil
} | [
"func",
"(",
"args",
"*",
"Arguments",
")",
"GetParameterByName",
"(",
"name",
"string",
")",
"*",
"Parameter",
"{",
"for",
"_",
",",
"param",
":=",
"range",
"args",
".",
"Parameters",
"{",
"if",
"param",
".",
"Name",
"==",
"name",
"{",
"return",
"&",
... | // GetParameterByName retrieves a parameter by its name | [
"GetParameterByName",
"retrieves",
"a",
"parameter",
"by",
"its",
"name"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L979-L986 |
134,674 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | HasLocation | func (a *Artifact) HasLocation() bool {
return a.S3.HasLocation() ||
a.Git.HasLocation() ||
a.HTTP.HasLocation() ||
a.Artifactory.HasLocation() ||
a.Raw.HasLocation() ||
a.HDFS.HasLocation()
} | go | func (a *Artifact) HasLocation() bool {
return a.S3.HasLocation() ||
a.Git.HasLocation() ||
a.HTTP.HasLocation() ||
a.Artifactory.HasLocation() ||
a.Raw.HasLocation() ||
a.HDFS.HasLocation()
} | [
"func",
"(",
"a",
"*",
"Artifact",
")",
"HasLocation",
"(",
")",
"bool",
"{",
"return",
"a",
".",
"S3",
".",
"HasLocation",
"(",
")",
"||",
"a",
".",
"Git",
".",
"HasLocation",
"(",
")",
"||",
"a",
".",
"HTTP",
".",
"HasLocation",
"(",
")",
"||",... | // HasLocation whether or not an artifact has a location defined | [
"HasLocation",
"whether",
"or",
"not",
"an",
"artifact",
"has",
"a",
"location",
"defined"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L989-L996 |
134,675 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | GetTemplate | func (wf *Workflow) GetTemplate(name string) *Template {
for _, t := range wf.Spec.Templates {
if t.Name == name {
return &t
}
}
return nil
} | go | func (wf *Workflow) GetTemplate(name string) *Template {
for _, t := range wf.Spec.Templates {
if t.Name == name {
return &t
}
}
return nil
} | [
"func",
"(",
"wf",
"*",
"Workflow",
")",
"GetTemplate",
"(",
"name",
"string",
")",
"*",
"Template",
"{",
"for",
"_",
",",
"t",
":=",
"range",
"wf",
".",
"Spec",
".",
"Templates",
"{",
"if",
"t",
".",
"Name",
"==",
"name",
"{",
"return",
"&",
"t"... | // GetTemplate retrieves a defined template by its name | [
"GetTemplate",
"retrieves",
"a",
"defined",
"template",
"by",
"its",
"name"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L999-L1006 |
134,676 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | NodeID | func (wf *Workflow) NodeID(name string) string {
if name == wf.ObjectMeta.Name {
return wf.ObjectMeta.Name
}
h := fnv.New32a()
_, _ = h.Write([]byte(name))
return fmt.Sprintf("%s-%v", wf.ObjectMeta.Name, h.Sum32())
} | go | func (wf *Workflow) NodeID(name string) string {
if name == wf.ObjectMeta.Name {
return wf.ObjectMeta.Name
}
h := fnv.New32a()
_, _ = h.Write([]byte(name))
return fmt.Sprintf("%s-%v", wf.ObjectMeta.Name, h.Sum32())
} | [
"func",
"(",
"wf",
"*",
"Workflow",
")",
"NodeID",
"(",
"name",
"string",
")",
"string",
"{",
"if",
"name",
"==",
"wf",
".",
"ObjectMeta",
".",
"Name",
"{",
"return",
"wf",
".",
"ObjectMeta",
".",
"Name",
"\n",
"}",
"\n",
"h",
":=",
"fnv",
".",
"... | // NodeID creates a deterministic node ID based on a node name | [
"NodeID",
"creates",
"a",
"deterministic",
"node",
"ID",
"based",
"on",
"a",
"node",
"name"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L1009-L1016 |
134,677 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | ContinuesOn | func (t *DAGTask) ContinuesOn(phase NodePhase) bool {
return continues(t.ContinueOn, phase)
} | go | func (t *DAGTask) ContinuesOn(phase NodePhase) bool {
return continues(t.ContinueOn, phase)
} | [
"func",
"(",
"t",
"*",
"DAGTask",
")",
"ContinuesOn",
"(",
"phase",
"NodePhase",
")",
"bool",
"{",
"return",
"continues",
"(",
"t",
".",
"ContinueOn",
",",
"phase",
")",
"\n",
"}"
] | // ContinuesOn returns whether the DAG should be proceeded if the task fails or errors. | [
"ContinuesOn",
"returns",
"whether",
"the",
"DAG",
"should",
"be",
"proceeded",
"if",
"the",
"task",
"fails",
"or",
"errors",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L1041-L1043 |
134,678 | argoproj/argo | pkg/apis/workflow/v1alpha1/types.go | ContinuesOn | func (s *WorkflowStep) ContinuesOn(phase NodePhase) bool {
return continues(s.ContinueOn, phase)
} | go | func (s *WorkflowStep) ContinuesOn(phase NodePhase) bool {
return continues(s.ContinueOn, phase)
} | [
"func",
"(",
"s",
"*",
"WorkflowStep",
")",
"ContinuesOn",
"(",
"phase",
"NodePhase",
")",
"bool",
"{",
"return",
"continues",
"(",
"s",
".",
"ContinueOn",
",",
"phase",
")",
"\n",
"}"
] | // ContinuesOn returns whether the StepGroup should be proceeded if the task fails or errors. | [
"ContinuesOn",
"returns",
"whether",
"the",
"StepGroup",
"should",
"be",
"proceeded",
"if",
"the",
"task",
"fails",
"or",
"errors",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/pkg/apis/workflow/v1alpha1/types.go#L1046-L1048 |
134,679 | argoproj/argo | cmd/argo/commands/logs.go | PrintWorkflowLogs | func (p *logPrinter) PrintWorkflowLogs(workflow string) error {
wfClient := InitWorkflowClient()
wf, err := wfClient.Get(workflow, metav1.GetOptions{})
if err != nil {
return err
}
timeByPod := p.printRecentWorkflowLogs(wf)
if p.follow {
p.printLiveWorkflowLogs(wf.Name, wfClient, timeByPod)
}
return nil
} | go | func (p *logPrinter) PrintWorkflowLogs(workflow string) error {
wfClient := InitWorkflowClient()
wf, err := wfClient.Get(workflow, metav1.GetOptions{})
if err != nil {
return err
}
timeByPod := p.printRecentWorkflowLogs(wf)
if p.follow {
p.printLiveWorkflowLogs(wf.Name, wfClient, timeByPod)
}
return nil
} | [
"func",
"(",
"p",
"*",
"logPrinter",
")",
"PrintWorkflowLogs",
"(",
"workflow",
"string",
")",
"error",
"{",
"wfClient",
":=",
"InitWorkflowClient",
"(",
")",
"\n",
"wf",
",",
"err",
":=",
"wfClient",
".",
"Get",
"(",
"workflow",
",",
"metav1",
".",
"Get... | // PrintWorkflowLogs prints logs for all workflow pods | [
"PrintWorkflowLogs",
"prints",
"logs",
"for",
"all",
"workflow",
"pods"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/logs.go#L103-L114 |
134,680 | argoproj/argo | cmd/argo/commands/logs.go | PrintPodLogs | func (p *logPrinter) PrintPodLogs(podName string) error {
namespace, _, err := clientConfig.Namespace()
if err != nil {
return err
}
var logs []logEntry
err = p.getPodLogs(context.Background(), "", podName, namespace, p.follow, p.tail, p.sinceSeconds, p.sinceTime, func(entry logEntry) {
logs = append(logs, ent... | go | func (p *logPrinter) PrintPodLogs(podName string) error {
namespace, _, err := clientConfig.Namespace()
if err != nil {
return err
}
var logs []logEntry
err = p.getPodLogs(context.Background(), "", podName, namespace, p.follow, p.tail, p.sinceSeconds, p.sinceTime, func(entry logEntry) {
logs = append(logs, ent... | [
"func",
"(",
"p",
"*",
"logPrinter",
")",
"PrintPodLogs",
"(",
"podName",
"string",
")",
"error",
"{",
"namespace",
",",
"_",
",",
"err",
":=",
"clientConfig",
".",
"Namespace",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}... | // PrintPodLogs prints logs for a single pod | [
"PrintPodLogs",
"prints",
"logs",
"for",
"a",
"single",
"pod"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/logs.go#L117-L133 |
134,681 | argoproj/argo | cmd/argo/commands/logs.go | printRecentWorkflowLogs | func (p *logPrinter) printRecentWorkflowLogs(wf *v1alpha1.Workflow) map[string]*time.Time {
var podNodes []v1alpha1.NodeStatus
err := util.DecompressWorkflow(wf)
if err != nil {
log.Warn(err)
return nil
}
for _, node := range wf.Status.Nodes {
if node.Type == v1alpha1.NodeTypePod && node.Phase != v1alpha1.No... | go | func (p *logPrinter) printRecentWorkflowLogs(wf *v1alpha1.Workflow) map[string]*time.Time {
var podNodes []v1alpha1.NodeStatus
err := util.DecompressWorkflow(wf)
if err != nil {
log.Warn(err)
return nil
}
for _, node := range wf.Status.Nodes {
if node.Type == v1alpha1.NodeTypePod && node.Phase != v1alpha1.No... | [
"func",
"(",
"p",
"*",
"logPrinter",
")",
"printRecentWorkflowLogs",
"(",
"wf",
"*",
"v1alpha1",
".",
"Workflow",
")",
"map",
"[",
"string",
"]",
"*",
"time",
".",
"Time",
"{",
"var",
"podNodes",
"[",
"]",
"v1alpha1",
".",
"NodeStatus",
"\n",
"err",
":... | // Prints logs for workflow pod steps and return most recent log timestamp per pod name | [
"Prints",
"logs",
"for",
"workflow",
"pod",
"steps",
"and",
"return",
"most",
"recent",
"log",
"timestamp",
"per",
"pod",
"name"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/logs.go#L136-L190 |
134,682 | argoproj/argo | cmd/argo/commands/logs.go | printLiveWorkflowLogs | func (p *logPrinter) printLiveWorkflowLogs(workflowName string, wfClient workflowv1.WorkflowInterface, timeByPod map[string]*time.Time) {
logs := make(chan logEntry)
streamedPods := make(map[string]bool)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
processPods := func(wf *v1alpha1.Workfl... | go | func (p *logPrinter) printLiveWorkflowLogs(workflowName string, wfClient workflowv1.WorkflowInterface, timeByPod map[string]*time.Time) {
logs := make(chan logEntry)
streamedPods := make(map[string]bool)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
processPods := func(wf *v1alpha1.Workfl... | [
"func",
"(",
"p",
"*",
"logPrinter",
")",
"printLiveWorkflowLogs",
"(",
"workflowName",
"string",
",",
"wfClient",
"workflowv1",
".",
"WorkflowInterface",
",",
"timeByPod",
"map",
"[",
"string",
"]",
"*",
"time",
".",
"Time",
")",
"{",
"logs",
":=",
"make",
... | // Prints live logs for workflow pods, starting from time specified in timeByPod name. | [
"Prints",
"live",
"logs",
"for",
"workflow",
"pods",
"starting",
"from",
"time",
"specified",
"in",
"timeByPod",
"name",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/cmd/argo/commands/logs.go#L193-L256 |
134,683 | argoproj/argo | workflow/validate/validate.go | ValidateWorkflow | func ValidateWorkflow(wf *wfv1.Workflow, opts ValidateOpts) error {
ctx := wfValidationCtx{
ValidateOpts: opts,
wf: wf,
globalParams: make(map[string]string),
results: make(map[string]bool),
}
err := validateWorkflowFieldNames(wf.Spec.Templates)
if err != nil {
return errors.Errorf(errors.C... | go | func ValidateWorkflow(wf *wfv1.Workflow, opts ValidateOpts) error {
ctx := wfValidationCtx{
ValidateOpts: opts,
wf: wf,
globalParams: make(map[string]string),
results: make(map[string]bool),
}
err := validateWorkflowFieldNames(wf.Spec.Templates)
if err != nil {
return errors.Errorf(errors.C... | [
"func",
"ValidateWorkflow",
"(",
"wf",
"*",
"wfv1",
".",
"Workflow",
",",
"opts",
"ValidateOpts",
")",
"error",
"{",
"ctx",
":=",
"wfValidationCtx",
"{",
"ValidateOpts",
":",
"opts",
",",
"wf",
":",
"wf",
",",
"globalParams",
":",
"make",
"(",
"map",
"["... | // ValidateWorkflow accepts a workflow and performs validation against it. | [
"ValidateWorkflow",
"accepts",
"a",
"workflow",
"and",
"performs",
"validation",
"against",
"it",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/validate.go#L55-L114 |
134,684 | argoproj/argo | workflow/validate/validate.go | validateTemplateType | func validateTemplateType(tmpl *wfv1.Template) error {
numTypes := 0
for _, tmplType := range []interface{}{tmpl.Container, tmpl.Steps, tmpl.Script, tmpl.Resource, tmpl.DAG, tmpl.Suspend} {
if !reflect.ValueOf(tmplType).IsNil() {
numTypes++
}
}
switch numTypes {
case 0:
return errors.New(errors.CodeBadReq... | go | func validateTemplateType(tmpl *wfv1.Template) error {
numTypes := 0
for _, tmplType := range []interface{}{tmpl.Container, tmpl.Steps, tmpl.Script, tmpl.Resource, tmpl.DAG, tmpl.Suspend} {
if !reflect.ValueOf(tmplType).IsNil() {
numTypes++
}
}
switch numTypes {
case 0:
return errors.New(errors.CodeBadReq... | [
"func",
"validateTemplateType",
"(",
"tmpl",
"*",
"wfv1",
".",
"Template",
")",
"error",
"{",
"numTypes",
":=",
"0",
"\n",
"for",
"_",
",",
"tmplType",
":=",
"range",
"[",
"]",
"interface",
"{",
"}",
"{",
"tmpl",
".",
"Container",
",",
"tmpl",
".",
"... | // validateTemplateType validates that only one template type is defined | [
"validateTemplateType",
"validates",
"that",
"only",
"one",
"template",
"type",
"is",
"defined"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/validate.go#L184-L199 |
134,685 | argoproj/argo | workflow/validate/validate.go | checkValidWorkflowVariablePrefix | func checkValidWorkflowVariablePrefix(tag string) bool {
for _, rootTag := range common.GlobalVarValidWorkflowVariablePrefix {
if strings.HasPrefix(tag, rootTag) {
return true
}
}
return false
} | go | func checkValidWorkflowVariablePrefix(tag string) bool {
for _, rootTag := range common.GlobalVarValidWorkflowVariablePrefix {
if strings.HasPrefix(tag, rootTag) {
return true
}
}
return false
} | [
"func",
"checkValidWorkflowVariablePrefix",
"(",
"tag",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"rootTag",
":=",
"range",
"common",
".",
"GlobalVarValidWorkflowVariablePrefix",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"tag",
",",
"rootTag",
")",
"{",
... | // checkValidWorkflowVariablePrefix is a helper methood check variable starts workflow root elements | [
"checkValidWorkflowVariablePrefix",
"is",
"a",
"helper",
"methood",
"check",
"variable",
"starts",
"workflow",
"root",
"elements"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/validate.go#L284-L291 |
134,686 | argoproj/argo | workflow/validate/validate.go | validateArgumentsValues | func validateArgumentsValues(prefix string, arguments wfv1.Arguments) error {
for _, param := range arguments.Parameters {
if param.Value == nil {
return errors.Errorf(errors.CodeBadRequest, "%s%s.value is required", prefix, param.Name)
}
}
for _, art := range arguments.Artifacts {
if art.From == "" && !art... | go | func validateArgumentsValues(prefix string, arguments wfv1.Arguments) error {
for _, param := range arguments.Parameters {
if param.Value == nil {
return errors.Errorf(errors.CodeBadRequest, "%s%s.value is required", prefix, param.Name)
}
}
for _, art := range arguments.Artifacts {
if art.From == "" && !art... | [
"func",
"validateArgumentsValues",
"(",
"prefix",
"string",
",",
"arguments",
"wfv1",
".",
"Arguments",
")",
"error",
"{",
"for",
"_",
",",
"param",
":=",
"range",
"arguments",
".",
"Parameters",
"{",
"if",
"param",
".",
"Value",
"==",
"nil",
"{",
"return"... | // validateArgumentsValues ensures that all arguments have parameter values or artifact locations | [
"validateArgumentsValues",
"ensures",
"that",
"all",
"arguments",
"have",
"parameter",
"values",
"or",
"artifact",
"locations"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/validate.go#L362-L374 |
134,687 | argoproj/argo | workflow/validate/validate.go | validateBaseImageOutputs | func (ctx *wfValidationCtx) validateBaseImageOutputs(tmpl *wfv1.Template) error {
switch ctx.ContainerRuntimeExecutor {
case "", common.ContainerRuntimeExecutorDocker:
// docker executor supports all modes of artifact outputs
case common.ContainerRuntimeExecutorPNS:
// pns supports copying from the base image, b... | go | func (ctx *wfValidationCtx) validateBaseImageOutputs(tmpl *wfv1.Template) error {
switch ctx.ContainerRuntimeExecutor {
case "", common.ContainerRuntimeExecutorDocker:
// docker executor supports all modes of artifact outputs
case common.ContainerRuntimeExecutorPNS:
// pns supports copying from the base image, b... | [
"func",
"(",
"ctx",
"*",
"wfValidationCtx",
")",
"validateBaseImageOutputs",
"(",
"tmpl",
"*",
"wfv1",
".",
"Template",
")",
"error",
"{",
"switch",
"ctx",
".",
"ContainerRuntimeExecutor",
"{",
"case",
"\"",
"\"",
",",
"common",
".",
"ContainerRuntimeExecutorDoc... | // validateBaseImageOutputs detects if the template contains an output from | [
"validateBaseImageOutputs",
"detects",
"if",
"the",
"template",
"contains",
"an",
"output",
"from"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/validate.go#L572-L614 |
134,688 | argoproj/argo | workflow/validate/validate.go | validateOutputParameter | func validateOutputParameter(paramRef string, param *wfv1.Parameter) error {
if param.ValueFrom == nil {
return errors.Errorf(errors.CodeBadRequest, "%s.valueFrom not specified", paramRef)
}
paramTypes := 0
for _, value := range []string{param.ValueFrom.Path, param.ValueFrom.JQFilter, param.ValueFrom.JSONPath, pa... | go | func validateOutputParameter(paramRef string, param *wfv1.Parameter) error {
if param.ValueFrom == nil {
return errors.Errorf(errors.CodeBadRequest, "%s.valueFrom not specified", paramRef)
}
paramTypes := 0
for _, value := range []string{param.ValueFrom.Path, param.ValueFrom.JQFilter, param.ValueFrom.JSONPath, pa... | [
"func",
"validateOutputParameter",
"(",
"paramRef",
"string",
",",
"param",
"*",
"wfv1",
".",
"Parameter",
")",
"error",
"{",
"if",
"param",
".",
"ValueFrom",
"==",
"nil",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"errors",
".",
"CodeBadRequest",
",",
"... | // validateOutputParameter verifies that only one of valueFrom is defined in an output | [
"validateOutputParameter",
"verifies",
"that",
"only",
"one",
"of",
"valueFrom",
"is",
"defined",
"in",
"an",
"output"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/validate.go#L617-L635 |
134,689 | argoproj/argo | workflow/validate/validate.go | verifyNoCycles | func verifyNoCycles(tmpl *wfv1.Template, nameToTask map[string]wfv1.DAGTask) error {
visited := make(map[string]bool)
var noCyclesHelper func(taskName string, cycle []string) error
noCyclesHelper = func(taskName string, cycle []string) error {
if _, ok := visited[taskName]; ok {
return nil
}
task := nameToT... | go | func verifyNoCycles(tmpl *wfv1.Template, nameToTask map[string]wfv1.DAGTask) error {
visited := make(map[string]bool)
var noCyclesHelper func(taskName string, cycle []string) error
noCyclesHelper = func(taskName string, cycle []string) error {
if _, ok := visited[taskName]; ok {
return nil
}
task := nameToT... | [
"func",
"verifyNoCycles",
"(",
"tmpl",
"*",
"wfv1",
".",
"Template",
",",
"nameToTask",
"map",
"[",
"string",
"]",
"wfv1",
".",
"DAGTask",
")",
"error",
"{",
"visited",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"var",
"noCyclesHe... | // verifyNoCycles verifies there are no cycles in the DAG graph | [
"verifyNoCycles",
"verifies",
"there",
"are",
"no",
"cycles",
"in",
"the",
"DAG",
"graph"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/validate/validate.go#L799-L833 |
134,690 | argoproj/argo | workflow/artifacts/http/http.go | Load | func (h *HTTPArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
// Download the file to a local file path
return common.RunCommand("curl", "-sS", "-L", "-o", path, inputArtifact.HTTP.URL)
} | go | func (h *HTTPArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
// Download the file to a local file path
return common.RunCommand("curl", "-sS", "-L", "-o", path, inputArtifact.HTTP.URL)
} | [
"func",
"(",
"h",
"*",
"HTTPArtifactDriver",
")",
"Load",
"(",
"inputArtifact",
"*",
"wfv1",
".",
"Artifact",
",",
"path",
"string",
")",
"error",
"{",
"// Download the file to a local file path",
"return",
"common",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\... | // Load download artifacts from an HTTP URL | [
"Load",
"download",
"artifacts",
"from",
"an",
"HTTP",
"URL"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/artifacts/http/http.go#L13-L16 |
134,691 | argoproj/argo | util/file/fileutil.go | ExistsInTar | func ExistsInTar(sourcePath string, tarReader TarReader) bool {
sourcePath = strings.Trim(sourcePath, "/")
for {
hdr, err := tarReader.Next()
if err == io.EOF {
break
}
if err != nil {
return false
}
if hdr.FileInfo().IsDir() && strings.Contains(sourcePath, strings.Trim(hdr.Name, "/")) {
return t... | go | func ExistsInTar(sourcePath string, tarReader TarReader) bool {
sourcePath = strings.Trim(sourcePath, "/")
for {
hdr, err := tarReader.Next()
if err == io.EOF {
break
}
if err != nil {
return false
}
if hdr.FileInfo().IsDir() && strings.Contains(sourcePath, strings.Trim(hdr.Name, "/")) {
return t... | [
"func",
"ExistsInTar",
"(",
"sourcePath",
"string",
",",
"tarReader",
"TarReader",
")",
"bool",
"{",
"sourcePath",
"=",
"strings",
".",
"Trim",
"(",
"sourcePath",
",",
"\"",
"\"",
")",
"\n",
"for",
"{",
"hdr",
",",
"err",
":=",
"tarReader",
".",
"Next",
... | // ExistsInTar return true if file or directory exists in tar | [
"ExistsInTar",
"return",
"true",
"if",
"file",
"or",
"directory",
"exists",
"in",
"tar"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/file/fileutil.go#L20-L38 |
134,692 | argoproj/argo | util/file/fileutil.go | close | func close(f io.Closer) {
err := f.Close()
if err != nil {
log.Warnf("Failed to close the file/writer/reader. %v", err)
}
} | go | func close(f io.Closer) {
err := f.Close()
if err != nil {
log.Warnf("Failed to close the file/writer/reader. %v", err)
}
} | [
"func",
"close",
"(",
"f",
"io",
".",
"Closer",
")",
"{",
"err",
":=",
"f",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}"
] | //Close the file | [
"Close",
"the",
"file"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/file/fileutil.go#L41-L46 |
134,693 | argoproj/argo | util/file/fileutil.go | CompressEncodeString | func CompressEncodeString(content string) string {
return base64.StdEncoding.EncodeToString(CompressContent([]byte(content)))
} | go | func CompressEncodeString(content string) string {
return base64.StdEncoding.EncodeToString(CompressContent([]byte(content)))
} | [
"func",
"CompressEncodeString",
"(",
"content",
"string",
")",
"string",
"{",
"return",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"CompressContent",
"(",
"[",
"]",
"byte",
"(",
"content",
")",
")",
")",
"\n",
"}"
] | // CompressEncodeString will return the compressed string with base64 encoded | [
"CompressEncodeString",
"will",
"return",
"the",
"compressed",
"string",
"with",
"base64",
"encoded"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/file/fileutil.go#L49-L51 |
134,694 | argoproj/argo | util/file/fileutil.go | DecodeDecompressString | func DecodeDecompressString(content string) (string, error) {
buf, err := base64.StdEncoding.DecodeString(content)
if err != nil {
return "", err
}
dBuf, err := DecompressContent(buf)
if err != nil {
return "", err
}
return string(dBuf), nil
} | go | func DecodeDecompressString(content string) (string, error) {
buf, err := base64.StdEncoding.DecodeString(content)
if err != nil {
return "", err
}
dBuf, err := DecompressContent(buf)
if err != nil {
return "", err
}
return string(dBuf), nil
} | [
"func",
"DecodeDecompressString",
"(",
"content",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"buf",
",",
"err",
":=",
"base64",
".",
"StdEncoding",
".",
"DecodeString",
"(",
"content",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
... | // DecodeDecompressString will return decode and decompress the | [
"DecodeDecompressString",
"will",
"return",
"decode",
"and",
"decompress",
"the"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/file/fileutil.go#L54-L65 |
134,695 | argoproj/argo | util/file/fileutil.go | CompressContent | func CompressContent(content []byte) []byte {
var buf bytes.Buffer
zipWriter := gzip.NewWriter(&buf)
_, err := zipWriter.Write(content)
if err != nil {
log.Warnf("Error in compressing: %v", err)
}
close(zipWriter)
return buf.Bytes()
} | go | func CompressContent(content []byte) []byte {
var buf bytes.Buffer
zipWriter := gzip.NewWriter(&buf)
_, err := zipWriter.Write(content)
if err != nil {
log.Warnf("Error in compressing: %v", err)
}
close(zipWriter)
return buf.Bytes()
} | [
"func",
"CompressContent",
"(",
"content",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"zipWriter",
":=",
"gzip",
".",
"NewWriter",
"(",
"&",
"buf",
")",
"\n\n",
"_",
",",
"err",
":=",
"zipWriter",
".",
... | // CompressContent will compress the byte array using zip writer | [
"CompressContent",
"will",
"compress",
"the",
"byte",
"array",
"using",
"zip",
"writer"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/file/fileutil.go#L68-L78 |
134,696 | argoproj/argo | util/file/fileutil.go | DecompressContent | func DecompressContent(content []byte) ([]byte, error) {
buf := bytes.NewReader(content)
gZipReader, _ := gzip.NewReader(buf)
defer close(gZipReader)
return ioutil.ReadAll(gZipReader)
} | go | func DecompressContent(content []byte) ([]byte, error) {
buf := bytes.NewReader(content)
gZipReader, _ := gzip.NewReader(buf)
defer close(gZipReader)
return ioutil.ReadAll(gZipReader)
} | [
"func",
"DecompressContent",
"(",
"content",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"buf",
":=",
"bytes",
".",
"NewReader",
"(",
"content",
")",
"\n",
"gZipReader",
",",
"_",
":=",
"gzip",
".",
"NewReader",
"(",
"buf",
... | // DecompressContent will return the uncompressed content | [
"DecompressContent",
"will",
"return",
"the",
"uncompressed",
"content"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/util/file/fileutil.go#L81-L87 |
134,697 | argoproj/argo | workflow/executor/common/common.go | GetContainerID | func GetContainerID(container *v1.ContainerStatus) string {
i := strings.Index(container.ContainerID, containerShimPrefix)
if i == -1 {
return ""
}
return container.ContainerID[i+len(containerShimPrefix):]
} | go | func GetContainerID(container *v1.ContainerStatus) string {
i := strings.Index(container.ContainerID, containerShimPrefix)
if i == -1 {
return ""
}
return container.ContainerID[i+len(containerShimPrefix):]
} | [
"func",
"GetContainerID",
"(",
"container",
"*",
"v1",
".",
"ContainerStatus",
")",
"string",
"{",
"i",
":=",
"strings",
".",
"Index",
"(",
"container",
".",
"ContainerID",
",",
"containerShimPrefix",
")",
"\n",
"if",
"i",
"==",
"-",
"1",
"{",
"return",
... | // GetContainerID returns container ID of a ContainerStatus resource | [
"GetContainerID",
"returns",
"container",
"ID",
"of",
"a",
"ContainerStatus",
"resource"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/common/common.go#L25-L31 |
134,698 | argoproj/argo | workflow/executor/common/common.go | TerminatePodWithContainerID | func TerminatePodWithContainerID(c KubernetesClientInterface, containerID string, sig syscall.Signal) error {
pod, container, err := c.GetContainerStatus(containerID)
if err != nil {
return err
}
if container.State.Terminated != nil {
log.Infof("Container %s is already terminated: %v", container.ContainerID, co... | go | func TerminatePodWithContainerID(c KubernetesClientInterface, containerID string, sig syscall.Signal) error {
pod, container, err := c.GetContainerStatus(containerID)
if err != nil {
return err
}
if container.State.Terminated != nil {
log.Infof("Container %s is already terminated: %v", container.ContainerID, co... | [
"func",
"TerminatePodWithContainerID",
"(",
"c",
"KubernetesClientInterface",
",",
"containerID",
"string",
",",
"sig",
"syscall",
".",
"Signal",
")",
"error",
"{",
"pod",
",",
"container",
",",
"err",
":=",
"c",
".",
"GetContainerStatus",
"(",
"containerID",
")... | // TerminatePodWithContainerID invoke the given SIG against the PID1 of the container.
// No-op if the container is on the hostPID | [
"TerminatePodWithContainerID",
"invoke",
"the",
"given",
"SIG",
"against",
"the",
"PID1",
"of",
"the",
"container",
".",
"No",
"-",
"op",
"if",
"the",
"container",
"is",
"on",
"the",
"hostPID"
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/common/common.go#L72-L88 |
134,699 | argoproj/argo | workflow/executor/common/common.go | KillGracefully | func KillGracefully(c KubernetesClientInterface, containerID string) error {
log.Infof("SIGTERM containerID %q: %s", containerID, syscall.SIGTERM.String())
err := TerminatePodWithContainerID(c, containerID, syscall.SIGTERM)
if err != nil {
return err
}
err = WaitForTermination(c, containerID, time.Second*KillGra... | go | func KillGracefully(c KubernetesClientInterface, containerID string) error {
log.Infof("SIGTERM containerID %q: %s", containerID, syscall.SIGTERM.String())
err := TerminatePodWithContainerID(c, containerID, syscall.SIGTERM)
if err != nil {
return err
}
err = WaitForTermination(c, containerID, time.Second*KillGra... | [
"func",
"KillGracefully",
"(",
"c",
"KubernetesClientInterface",
",",
"containerID",
"string",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"containerID",
",",
"syscall",
".",
"SIGTERM",
".",
"String",
"(",
")",
")",
"\n",
"err",
":=",
"... | // KillGracefully kills a container gracefully. | [
"KillGracefully",
"kills",
"a",
"container",
"gracefully",
"."
] | 4e37a444bde2a034885d0db35f7b38684505063e | https://github.com/argoproj/argo/blob/4e37a444bde2a034885d0db35f7b38684505063e/workflow/executor/common/common.go#L91-L113 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.