Documentation ¶
Index ¶
- Variables
- func DownloadRunOutput(run *types.Run, nodes map[string]NodeInfo, files []string, ...)
- func GetRunByID(id uuid.UUID) *types.Run
- func GetRuns(workflowID uuid.UUID, pageSize int) []types.Run
- func GetWorkflowVersionByID(versionID, fleetID uuid.UUID) *types.WorkflowVersionDetailed
- func GetWorkflowVersionMaxMachines(version, fleet uuid.UUID) (types.Machines, error)
- type LabelCnt
- type NodeInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var OutputCmd = &cobra.Command{ Use: "output", Short: "Download workflow outputs", Long: `This command downloads sub-job outputs of a completed workflow run. Downloaded files will be stored into space/project/workflow/run-timestamp directory. Every node will have it's own directory named after it's label or ID (if the label is not unique), and an optional prefix ("<num>-") if it's connected to a splitter. Use raw command line arguments or a config file to specify which nodes' output you would like to fetch. If there is no node names specified, all outputs will be downloaded. The YAML config file should be formatted like: outputs: - foo - bar `, Run: func(cmd *cobra.Command, args []string) { _, _, workflow, found := util.GetObjects(args) if !found { return } nodes := make(map[string]NodeInfo, 0) if nodesFlag != "" { for _, node := range strings.Split(nodesFlag, ",") { nodes[strings.ReplaceAll(node, "/", "-")] = NodeInfo{ToFetch: true, Found: false} } } var files []string if filesFlag != "" { for _, file := range strings.Split(filesFlag, ",") { files = append(files, file) } } if configFile != "" { file, err := os.Open(configFile) if err != nil { fmt.Println("Couldn't open config file to read outputs!") return } bytes, err := ioutil.ReadAll(file) if err != nil { fmt.Println("Couldn't read outputs config!") return } var conf types.OutputsConfig err = yaml.Unmarshal(bytes, &conf) if err != nil { fmt.Println("Couldn't unmarshal outputs config!") return } for _, node := range conf.Outputs { nodes[strings.ReplaceAll(node, "/", "-")] = NodeInfo{ToFetch: true, Found: false} } } runs := make([]types.Run, 0) if runID == "" && util.URL != "" { workflowURLRunID, err := util.GetRunIDFromWorkflowURL(util.URL) if err == nil { runID = workflowURLRunID } } if allRuns { numberOfRuns = math.MaxInt } if runID == "" { wfRuns := GetRuns(workflow.ID, numberOfRuns) if wfRuns != nil && len(wfRuns) > 0 { runs = append(runs, wfRuns...) } else { fmt.Println("This workflow has not been executed yet!") return } } else { runUUID, err := uuid.Parse(runID) if err != nil { fmt.Println("Invalid run ID") return } run := GetRunByID(runUUID) runs = []types.Run{*run} } if numberOfRuns == 1 && runs[0].Status == "SCHEDULED" { runs = GetRuns(workflow.ID, numberOfRuns+1) runs = append(runs, runs...) } path := util.FormatPath() if outputDir != "" { path = outputDir } for _, run := range runs { if run.Status == "SCHEDULED" { continue } DownloadRunOutput(&run, nodes, files, path) } }, }
OutputCmd represents the download command
Functions ¶
func DownloadRunOutput ¶
func GetWorkflowVersionByID ¶
func GetWorkflowVersionByID(versionID, fleetID uuid.UUID) *types.WorkflowVersionDetailed
Types ¶
Click to show internal directories.
Click to hide internal directories.