Skip to content

Commit d9d06c6

Browse files
authored
Merge pull request #77 from trickest/feature/output-dir-and-nodes
Add output-dir and nodes flag to the output command
2 parents 1e59950 + b3d255e commit d9d06c6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Example GitHub action usage
215215
Use the **output** command to download the outputs of your particular workflow execution(s) to your local environment.
216216

217217
```
218-
trickest output --workflow <workflow_name> --space <space_name> [--config <config_file_path>] [--runs <number>]
218+
trickest output --workflow <workflow_name> --space <space_name> [--nodes <comma_separated_list_of_nodes>] [--config <config_file_path>] [--runs <number>] [--output-dir <output_path_directory>]
219219
```
220220
| Flag | Type | Default | Description |
221221
| ---------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
@@ -224,6 +224,8 @@ trickest output --workflow <workflow_name> --space <space_name> [--config <confi
224224
| --config | file | / | YAML file for run configuration |
225225
| --run | string | / | Download output data of a specific run |
226226
| --runs | integer | 1 | The number of executions to be downloaded sorted by newest |
227+
| --output-dir | string | / | Path to directory which should be used to store outputs |
228+
| --nodes | string | / | A comma separated list of nodes whose outputs should be downloaded |
227229

228230

229231
## Output Structure

cmd/output/output.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ var (
3838
allRuns bool
3939
numberOfRuns int
4040
runID string
41+
outputDir string
42+
nodesFlag string
4143
)
4244

4345
// OutputCmd represents the download command
@@ -59,6 +61,11 @@ The YAML config file should be formatted like:
5961
`,
6062
Run: func(cmd *cobra.Command, args []string) {
6163
nodes := make(map[string]NodeInfo, 0)
64+
if nodesFlag != "" {
65+
for _, node := range strings.Split(nodesFlag, ",") {
66+
nodes[strings.ReplaceAll(node, "/", "-")] = NodeInfo{ToFetch: true, Found: false}
67+
}
68+
}
6269

6370
path := util.FormatPath()
6471
if path == "" {
@@ -147,6 +154,9 @@ The YAML config file should be formatted like:
147154
return
148155
}
149156

157+
if outputDir != "" {
158+
path = outputDir
159+
}
150160
for _, run := range runs {
151161
if run.Status == "SCHEDULED" {
152162
continue
@@ -161,6 +171,8 @@ func init() {
161171
OutputCmd.Flags().BoolVar(&allRuns, "all", false, "Download output data for all runs")
162172
OutputCmd.Flags().IntVar(&numberOfRuns, "runs", 1, "Number of recent runs which outputs should be downloaded")
163173
OutputCmd.Flags().StringVar(&runID, "run", "", "Download output data of a specific run")
174+
OutputCmd.Flags().StringVar(&outputDir, "output-dir", "", "Path to directory which should be used to store outputs")
175+
OutputCmd.Flags().StringVar(&nodesFlag, "nodes", "", "A comma-separated list of nodes whose outputs should be downloaded")
164176
}
165177

166178
func DownloadRunOutput(run *types.Run, nodes map[string]NodeInfo, version *types.WorkflowVersionDetailed, destinationPath string) {

0 commit comments

Comments
 (0)