seqeralabs / tower-cli

Nextflow Tower CLI tool
Apache License 2.0
43 stars 9 forks source link

Fix labels missing from runs dump output #423

Closed JaimeSeqLabs closed 4 months ago

JaimeSeqLabs commented 5 months ago

Description

Closes #384

This PR adds the missing 'labels' query attribute needed to retrieve the workflow labels along with the rest of the metadata. Also, the runs dump sub-cmd has been refactored to improve code readability and test coverage.

Guidelines for testing

In order to test the changes an existing workflow run with labels is needed, however, the example run used in the original issue can be re-used here.

Dump the workflow run:

$> ./tw runs dump -i UkcqQpttWqvPg -w seqeralabs/showcase -o rnaseq-showcase.tar.gz

Extract the files in the current directory:

$> tar -xzf rnaseq-showcase.tar.gz

Check that the file workflow-metadata.json contains a 'labels' field:

{
  "pipelineId" : 232551719896592,
  "workspaceId" : 138659136604200,
  "workspaceName" : "showcase",
  "userId" : 8456,
  "runUrl" : "https://tower.nf/orgs/seqeralabs/workspaces/showcase/watch/UkcqQpttWqvPg",
  "labels" : [ {  // <--- New field!
    "id" : 75554545402364,
    "name" : "aligner_rsem",
    "resource" : false,
    "isDefault" : false
  }, {
    "id" : 142259147750578,
    "name" : "owner",
    "value" : "harshil",
    "resource" : true,
    "isDefault" : false
  }, {
    "id" : 213027699544669,
    "name" : "workspace",
    "value" : "showcase",
    "resource" : true,
    "isDefault" : false
  }, {
    "id" : 153544452690741,
    "name" : "yeast",
    "resource" : false,
    "isDefault" : false
  } ]
}