seqeralabs / tower-cli

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

Augment `runs list --filter` help text with more accurate guidance #389

Closed gwright99 closed 5 months ago

gwright99 commented 8 months ago

The actual filtering occurring on payloads retrieved by the tw cli does not appear to be the same as how the help text describes the behaviour.

How to reproduce

Existing runs in workspace:

$ tw runs list --workspace SampleOrg3/SampleWorkspace

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

     ID             | Status    | Project Name               | Run Name           | Username      | Submit Date                  
    ----------------+-----------+----------------------------+--------------------+---------------+------------------------------
     3HEYDrsrnGbyP0 | SUCCEEDED | gwright99/nextflow_scratch | high_borg          | graham-wright | Sat, 2 Mar 2024 18:25:57 GMT 
     2WDW01bxCUE1J4 | SUCCEEDED | gwright99/nextflow_scratch | grave_ptolemy      | graham-wright | Sat, 2 Mar 2024 18:02:58 GMT 
     4sz7JaBRVX1jTs | SUCCEEDED | gwright99/nextflow_scratch | voluminous_laplace | graham-wright | Sat, 2 Mar 2024 17:14:54 GMT 
     4Bz6NwFl2f7qmx | FAILED    | gwright99/nextflow_scratch | evil_heisenberg    | graham-wright | Sat, 2 Mar 2024 17:11:11 GMT 
     3btWPQ6hZRN5M0 | SUCCEEDED | gwright99/nextflow_scratch | wise_bassi         | graham-wright | Sat, 2 Mar 2024 17:07:47 GMT 
     2oXI0Qpd75wxTI | FAILED    | gwright99/nextflow_scratch | hungry_gutenberg   | graham-wright | Sat, 2 Mar 2024 17:01:07 GMT 
     1LBJDk3gRIgej5 | SUCCEEDED | gwright99/nextflow_scratch | voluminous_volhard | graham-wright | Sat, 2 Mar 2024 16:23:30 GMT 
     34CPpxWrvGZhBk | SUCCEEDED | gwright99/nextflow_scratch | hopeful_fermi      | graham-wright | Sat, 2 Mar 2024 16:20:36 GMT 
     49W4DYKTKVovCD | SUCCEEDED | gwright99/nextflow_scratch | disturbed_liskov   | graham-wright | Sat, 2 Mar 2024 16:08:48 GMT 
     1OzDI0AI5q87zI | FAILED    | gwright99/nextflow_scratch | elated_wiles_2     | graham-wright | Sat, 2 Mar 2024 16:03:20 GMT 
     e5QpbZ7rruZdZ  | SUCCEEDED | gwright99/nextflow_scratch | pensive_williams   | graham-wright | Sat, 2 Mar 2024 15:01:42 GMT 
     nLQ9f8vgZQcUF  | FAILED    | gwright99/nextflow_scratch | hopeful_mcclintock | graham-wright | Sat, 2 Mar 2024 14:53:10 GMT 
     BCRHhdlWKNqTX  | FAILED    | gwright99/nextflow_scratch | exotic_keller      | graham-wright | Sat, 2 Mar 2024 14:50:45 GMT 
     eckzORZKEEgVl  | SUCCEEDED | gwright99/nextflow_scratch | crazy_dalembert    | graham-wright | Sat, 2 Mar 2024 14:40:56 GMT 
     4abXJgQSIGs1Kl | SUCCEEDED | gwright99/nextflow_scratch | goofy_joliot       | graham-wright | Sat, 2 Mar 2024 14:38:20 GMT 
     bxhw8Q1Zxvocu  | SUCCEEDED | nextflow-io/hello          | angry_carson       | graham-wright | Sat, 2 Mar 2024 14:04:45 GMT 
     1NrBbl2dqKYiqr | SUCCEEDED | nextflow-io/hello          | awesome_poincare   | graham-wright | Sat, 2 Mar 2024 13:53:23 GMT 
     4KV7mPg9OjnTH7 | SUCCEEDED | nextflow-io/hello          | awesome_solvay     | graham-wright | Sat, 2 Mar 2024 13:49:56 GMT 
     46CXINjKq6Hhd3 | SUCCEEDED | nextflow-io/hello          | stupefied_koch     | graham-wright | Sat, 2 Mar 2024 13:48:07 GMT 
     4Grkz7XbBYzOuN | SUCCEEDED | nextflow-io/hello          | loving_rubens      | graham-wright | Sat, 2 Mar 2024 13:34:08 GMT 
     1bKH7ppp68PiW7 | FAILED    | nextflow-io/hello          | marvelous_feynman  | graham-wright | Sat, 2 Mar 2024 13:04:39 GMT 
     5tWrTSAoZg5df6 | FAILED    | nextflow-io/hello          | big_ekeblad        | graham-wright | Sat, 2 Mar 2024 12:57:25 GMT 
     4HWnrJ1MpAPvtz | SUCCEEDED | nextflow-io/hello          | prickly_dubinsky   | graham-wright | Sat, 2 Mar 2024 12:47:48 GMT 

Displayed help text:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --help

Usage: tw runs list [OPTIONS]

List all pipeline runs.

Options:
  -w, --workspace=<workspace>   Workspace numeric identifier (TOWER_WORKSPACE_ID as default) or workspace reference as OrganizationName/WorkspaceName
  -f, --filter=<startsWith>     Show only pipeline runs with names that start with the given word.
  -l, --labels                  Show labels.
      --page=<page>             Pages to display [default: 1].
      --offset=<offset>         Rows record offset [default: 0].
      --max=<max>               Maximum number of records to display [default: 100].
  -h, --help                    Show this help message and exit.
  -V, --version                 Print version information and exit.

Expected outcome

A little unclear, actually.

The --filter text says "pipeline runs with names that start with", so I assume that's Run Name column? This is only partially true based on results, however.

Actual outcome

Scenario 1: Successful filter based on Run Name:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter high

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

     ID             | Status    | Project Name               | Run Name  | Username      | Submit Date                  
    ----------------+-----------+----------------------------+-----------+---------------+------------------------------
     3HEYDrsrnGbyP0 | SUCCEEDED | gwright99/nextflow_scratch | high_borg | graham-wright | Sat, 2 Mar 2024 18:25:57 GMT 

Scenario 2: Baseline scenario where nothing matches:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter xx

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

    No pipeline runs found

Scenario 3a: Search for key present in all lines (but not starting in all):

This works but doesn't seem to be matching on the start of the Run Name column.

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter ne

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

     ID             | Status    | Project Name               | Run Name           | Username      | Submit Date                  
    ----------------+-----------+----------------------------+--------------------+---------------+------------------------------
     3HEYDrsrnGbyP0 | SUCCEEDED | gwright99/nextflow_scratch | high_borg          | graham-wright | Sat, 2 Mar 2024 18:25:57 GMT 
     2WDW01bxCUE1J4 | SUCCEEDED | gwright99/nextflow_scratch | grave_ptolemy      | graham-wright | Sat, 2 Mar 2024 18:02:58 GMT 
     4sz7JaBRVX1jTs | SUCCEEDED | gwright99/nextflow_scratch | voluminous_laplace | graham-wright | Sat, 2 Mar 2024 17:14:54 GMT 
     4Bz6NwFl2f7qmx | FAILED    | gwright99/nextflow_scratch | evil_heisenberg    | graham-wright | Sat, 2 Mar 2024 17:11:11 GMT 
     3btWPQ6hZRN5M0 | SUCCEEDED | gwright99/nextflow_scratch | wise_bassi         | graham-wright | Sat, 2 Mar 2024 17:07:47 GMT 
     2oXI0Qpd75wxTI | FAILED    | gwright99/nextflow_scratch | hungry_gutenberg   | graham-wright | Sat, 2 Mar 2024 17:01:07 GMT 
     1LBJDk3gRIgej5 | SUCCEEDED | gwright99/nextflow_scratch | voluminous_volhard | graham-wright | Sat, 2 Mar 2024 16:23:30 GMT 
     34CPpxWrvGZhBk | SUCCEEDED | gwright99/nextflow_scratch | hopeful_fermi      | graham-wright | Sat, 2 Mar 2024 16:20:36 GMT 
     49W4DYKTKVovCD | SUCCEEDED | gwright99/nextflow_scratch | disturbed_liskov   | graham-wright | Sat, 2 Mar 2024 16:08:48 GMT 
     1OzDI0AI5q87zI | FAILED    | gwright99/nextflow_scratch | elated_wiles_2     | graham-wright | Sat, 2 Mar 2024 16:03:20 GMT 
     e5QpbZ7rruZdZ  | SUCCEEDED | gwright99/nextflow_scratch | pensive_williams   | graham-wright | Sat, 2 Mar 2024 15:01:42 GMT 
     nLQ9f8vgZQcUF  | FAILED    | gwright99/nextflow_scratch | hopeful_mcclintock | graham-wright | Sat, 2 Mar 2024 14:53:10 GMT 
     BCRHhdlWKNqTX  | FAILED    | gwright99/nextflow_scratch | exotic_keller      | graham-wright | Sat, 2 Mar 2024 14:50:45 GMT 
     eckzORZKEEgVl  | SUCCEEDED | gwright99/nextflow_scratch | crazy_dalembert    | graham-wright | Sat, 2 Mar 2024 14:40:56 GMT 
     4abXJgQSIGs1Kl | SUCCEEDED | gwright99/nextflow_scratch | goofy_joliot       | graham-wright | Sat, 2 Mar 2024 14:38:20 GMT 
     bxhw8Q1Zxvocu  | SUCCEEDED | nextflow-io/hello          | angry_carson       | graham-wright | Sat, 2 Mar 2024 14:04:45 GMT 
     1NrBbl2dqKYiqr | SUCCEEDED | nextflow-io/hello          | awesome_poincare   | graham-wright | Sat, 2 Mar 2024 13:53:23 GMT 
     4KV7mPg9OjnTH7 | SUCCEEDED | nextflow-io/hello          | awesome_solvay     | graham-wright | Sat, 2 Mar 2024 13:49:56 GMT 
     46CXINjKq6Hhd3 | SUCCEEDED | nextflow-io/hello          | stupefied_koch     | graham-wright | Sat, 2 Mar 2024 13:48:07 GMT 
     4Grkz7XbBYzOuN | SUCCEEDED | nextflow-io/hello          | loving_rubens      | graham-wright | Sat, 2 Mar 2024 13:34:08 GMT 
     1bKH7ppp68PiW7 | FAILED    | nextflow-io/hello          | marvelous_feynman  | graham-wright | Sat, 2 Mar 2024 13:04:39 GMT 
     5tWrTSAoZg5df6 | FAILED    | nextflow-io/hello          | big_ekeblad        | graham-wright | Sat, 2 Mar 2024 12:57:25 GMT 
     4HWnrJ1MpAPvtz | SUCCEEDED | nextflow-io/hello          | prickly_dubinsky   | graham-wright | Sat, 2 Mar 2024 12:47:48 GMT 

Scenario 3b: Search for key present in all lines (but not starting in all), with wildcard:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter ne*

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

     ID             | Status    | Project Name      | Run Name          | Username      | Submit Date                  
    ----------------+-----------+-------------------+-------------------+---------------+------------------------------
     bxhw8Q1Zxvocu  | SUCCEEDED | nextflow-io/hello | angry_carson      | graham-wright | Sat, 2 Mar 2024 14:04:45 GMT 
     1NrBbl2dqKYiqr | SUCCEEDED | nextflow-io/hello | awesome_poincare  | graham-wright | Sat, 2 Mar 2024 13:53:23 GMT 
     4KV7mPg9OjnTH7 | SUCCEEDED | nextflow-io/hello | awesome_solvay    | graham-wright | Sat, 2 Mar 2024 13:49:56 GMT 
     46CXINjKq6Hhd3 | SUCCEEDED | nextflow-io/hello | stupefied_koch    | graham-wright | Sat, 2 Mar 2024 13:48:07 GMT 
     4Grkz7XbBYzOuN | SUCCEEDED | nextflow-io/hello | loving_rubens     | graham-wright | Sat, 2 Mar 2024 13:34:08 GMT 
     1bKH7ppp68PiW7 | FAILED    | nextflow-io/hello | marvelous_feynman | graham-wright | Sat, 2 Mar 2024 13:04:39 GMT 
     5tWrTSAoZg5df6 | FAILED    | nextflow-io/hello | big_ekeblad       | graham-wright | Sat, 2 Mar 2024 12:57:25 GMT 
     4HWnrJ1MpAPvtz | SUCCEEDED | nextflow-io/hello | prickly_dubinsky  | graham-wright | Sat, 2 Mar 2024 12:47:48 GMT 

Scenario 4a: Search for full key exclusive in a column:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter graham-wright

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

    No pipeline runs found

Scenario 4b: Search for full key with qualifier:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter username:graham-wright

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

     ID             | Status    | Project Name               | Run Name           | Username      | Submit Date                  
    ----------------+-----------+----------------------------+--------------------+---------------+------------------------------
     3HEYDrsrnGbyP0 | SUCCEEDED | gwright99/nextflow_scratch | high_borg          | graham-wright | Sat, 2 Mar 2024 18:25:57 GMT 
     2WDW01bxCUE1J4 | SUCCEEDED | gwright99/nextflow_scratch | grave_ptolemy      | graham-wright | Sat, 2 Mar 2024 18:02:58 GMT 
     4sz7JaBRVX1jTs | SUCCEEDED | gwright99/nextflow_scratch | voluminous_laplace | graham-wright | Sat, 2 Mar 2024 17:14:54 GMT 
     4Bz6NwFl2f7qmx | FAILED    | gwright99/nextflow_scratch | evil_heisenberg    | graham-wright | Sat, 2 Mar 2024 17:11:11 GMT 
     3btWPQ6hZRN5M0 | SUCCEEDED | gwright99/nextflow_scratch | wise_bassi         | graham-wright | Sat, 2 Mar 2024 17:07:47 GMT 
     2oXI0Qpd75wxTI | FAILED    | gwright99/nextflow_scratch | hungry_gutenberg   | graham-wright | Sat, 2 Mar 2024 17:01:07 GMT 
     1LBJDk3gRIgej5 | SUCCEEDED | gwright99/nextflow_scratch | voluminous_volhard | graham-wright | Sat, 2 Mar 2024 16:23:30 GMT 
     34CPpxWrvGZhBk | SUCCEEDED | gwright99/nextflow_scratch | hopeful_fermi      | graham-wright | Sat, 2 Mar 2024 16:20:36 GMT 
     49W4DYKTKVovCD | SUCCEEDED | gwright99/nextflow_scratch | disturbed_liskov   | graham-wright | Sat, 2 Mar 2024 16:08:48 GMT 
     1OzDI0AI5q87zI | FAILED    | gwright99/nextflow_scratch | elated_wiles_2     | graham-wright | Sat, 2 Mar 2024 16:03:20 GMT 
     e5QpbZ7rruZdZ  | SUCCEEDED | gwright99/nextflow_scratch | pensive_williams   | graham-wright | Sat, 2 Mar 2024 15:01:42 GMT 
     nLQ9f8vgZQcUF  | FAILED    | gwright99/nextflow_scratch | hopeful_mcclintock | graham-wright | Sat, 2 Mar 2024 14:53:10 GMT 
     BCRHhdlWKNqTX  | FAILED    | gwright99/nextflow_scratch | exotic_keller      | graham-wright | Sat, 2 Mar 2024 14:50:45 GMT 
     eckzORZKEEgVl  | SUCCEEDED | gwright99/nextflow_scratch | crazy_dalembert    | graham-wright | Sat, 2 Mar 2024 14:40:56 GMT 
     4abXJgQSIGs1Kl | SUCCEEDED | gwright99/nextflow_scratch | goofy_joliot       | graham-wright | Sat, 2 Mar 2024 14:38:20 GMT 
     bxhw8Q1Zxvocu  | SUCCEEDED | nextflow-io/hello          | angry_carson       | graham-wright | Sat, 2 Mar 2024 14:04:45 GMT 
     1NrBbl2dqKYiqr | SUCCEEDED | nextflow-io/hello          | awesome_poincare   | graham-wright | Sat, 2 Mar 2024 13:53:23 GMT 
     4KV7mPg9OjnTH7 | SUCCEEDED | nextflow-io/hello          | awesome_solvay     | graham-wright | Sat, 2 Mar 2024 13:49:56 GMT 
     46CXINjKq6Hhd3 | SUCCEEDED | nextflow-io/hello          | stupefied_koch     | graham-wright | Sat, 2 Mar 2024 13:48:07 GMT 
     4Grkz7XbBYzOuN | SUCCEEDED | nextflow-io/hello          | loving_rubens      | graham-wright | Sat, 2 Mar 2024 13:34:08 GMT 
     1bKH7ppp68PiW7 | FAILED    | nextflow-io/hello          | marvelous_feynman  | graham-wright | Sat, 2 Mar 2024 13:04:39 GMT 
     5tWrTSAoZg5df6 | FAILED    | nextflow-io/hello          | big_ekeblad        | graham-wright | Sat, 2 Mar 2024 12:57:25 GMT 
     4HWnrJ1MpAPvtz | SUCCEEDED | nextflow-io/hello          | prickly_dubinsky   | graham-wright | Sat, 2 Mar 2024 12:47:48 GMT

Scenario 4c: Search for partial key with qualifier:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter username:graham-w

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

    No pipeline runs found

Scenario 4d: Search for partial key with qualifier, with wildcard:

$ tw runs list --workspace SampleOrg3/SampleWorkspace --filter username:graham-w*

  Pipeline runs at [SampleOrg3 / SampleWorkspace] workspace:

Conclusion

More filtering criteria must be getting applied behind the scenes. It would be good to be clear in the help text so folks don't need trial-and-error experimentation / reverse-engineer via tw -v ....

robnewman commented 6 months ago

Also need to add that multiple filters can be concatenated and they work:

tw runs list \                                                                               
--filter="after:2024-05-01T00:00:00.000Z before:2024-05-05T00:00:00.000Z" \                                             
--workspace="seqeralabs/showcase"

  Pipeline runs at [seqeralabs / showcase] workspace:

     ID             | Status    | Project Name         | Run Name           | Username   | Submit Date                  
    ----------------+-----------+----------------------+--------------------+------------+------------------------------
     12qJlhI8eHTJ6M | SUCCEEDED | nf-core/rnaseq       | boring_panini      | esha-joshi | Fri, 3 May 2024 16:40:45 GMT 
     1IyAQIibMoLSE8 | SUCCEEDED | nf-core/rnaseq       | angry_bernard      | esha-joshi | Thu, 2 May 2024 19:43:40 GMT 
     3ytnGaw6UeSdp  | SUCCEEDED | nf-core/rnaseq       | sleepy_volta       | esha-joshi | Thu, 2 May 2024 16:51:56 GMT 
     2MpiAQTGwMVU8R | SUCCEEDED | seqeralabs/nf-dragen | nostalgic_roentgen | esha-joshi | Wed, 1 May 2024 20:53:02 GMT 
canny[bot] commented 6 months ago

This issue has been linked to a Canny post: Allow the CLI command 'tw runs list' to filter by date :tada:

jordeu commented 5 months ago

This filtering is done at server-side and it maps directly to the search capability described here: https://docs.seqera.io/platform/23.4.0/monitoring/overview#search

(when it was added to the CLI it was a simple "starts with", but now is much more powerful).

robnewman commented 5 months ago

Agreed, but it doesn't match perfectly (for example, the before and after need to be fully qualified ISO 8601 datetimes and not just YYYY-MM-DD). I've got a PR incoming.