pepkit / looper

A job submitter for Portable Encapsulated Projects
http://looper.databio.org
BSD 2-Clause "Simplified" License
20 stars 7 forks source link

CLI simple args #259

Closed nsheff closed 4 years ago

nsheff commented 4 years ago

Now that we have the command-extra thing going, I think we should add short-form arguments for most of the looper args...

nsheff commented 4 years ago

This last commit gets almost all looper run usage docs onto 1 line. I'm not sure what to do about 'command-extra-override' though. I'm not really happy with that one... I but --x-override, which is shorter, but I don't like either...

stolarczyk commented 4 years ago

I think, I would just leave it as it was. From the cli usage perspective, people would use -y anyway if they care about option strings shortness. From the config usage perspective, Project.looper.run.command-extra-override is more descriptive.

nsheff commented 4 years ago

yeah -- I get you, but then it's so long that it makes that help line take up 2 lines... I was trying to just get it to within 1 line...

nsheff commented 4 years ago
 optional arguments:
  -h, --help                show this help message and exit
  -f, --ignore-flags        Ignore run status flags? Default: False
  -t S, --time-delay S      Time delay in seconds between job submissions
  -p P, --package P         Divvy: Name of computing resource package to use
  -s S, --settings S        Divvy: Path to a YAML settings file with compute settings
  -m C, --compute C         Divvy: Comma-separated list of key-value pairs (k1=v1,k2=v2)
  -l N, --limit N           Limit to n samples
  -x S, --command-extra S   String to append to every command
  -y S, --command-extra-override S
                            String to append to every command, overriding values in PEP
  -u X, --lump X            Total input file size in GB to batch into a single job
  -n N, --lumpn N           Number of individual commands to batch into a single job

it would just be nice if we could get everything onto 1 line in the usage help, since there are so many options.

nsheff commented 4 years ago

Here's the current complete usage. I'm still not really happy with the really long args that require 2 lines. do you have any ideas? We could change the usage format to add more space to the left column, but this is also dangerous because it extends things out to the right which is bad for short screens.

 looper run --help
usage: looper run [-h] [-f] [-d] [-k] [-t S] [-l N] [-x S] [-y S] [-p P] [-s S] [-c C] [-u X] [-n N]
                  [-g K] [-o DIR] [--submission-subdir DIR] [--results-subdir DIR]
                  [--pipeline-interfaces-key K] [--pipeline-interfaces P [P ...]] [--sel-attr ATTR]
                  [--sel-excl [E [E ...]] | --sel-incl [I [I ...]]] [-a A [A ...]]
                  [config_file]

Run or submit sample jobs.

positional arguments:
  config_file               Project configuration file (YAML)

optional arguments:
  -h, --help                show this help message and exit
  -f, --ignore-flags        Ignore run status flags? Default: False
  -d, --dry-run             Don't actually submit the jobs. Default=False
  -k, --file-checks         Perform input file checks. Default=True
  -t S, --time-delay S      Time delay in seconds between job submissions
  -l N, --limit N           Limit to n samples
  -x S, --command-extra S   String to append to every command
  -y S, --command-extra-override S
                            Same as command-extra, but overrides values in PEP
  -u X, --lump X            Total input file size (GB) to batch into a single job
  -n N, --lumpn N           Number of commands to batch into a single job
  -g K, --toggle-key K      Sample attribute specifying toggle. Default: toggle
  -o DIR, --output-dir DIR  Path to the output directory
  --submission-subdir DIR   Submission subdirectory name
  --results-subdir DIR      Results subdirectory name
  --pipeline-interfaces-key K
                            Sample attribute specifying pipeline interface sources
  --pipeline-interfaces P [P ...]
                            Paths to pipeline interface files
  -a A [A ...], --amendments A [A ...]
                            List of amendments to activate

divvy arguments:
  Configure divvy to change computing settings

  -p P, --package P         Name of computing resource package to use
  -s S, --settings S        Path to a YAML settings file with compute settings
  -c C, --compute C         Comma-separated list of key-value pairs (k1=v1,k2=v2)

sample selection arguments:
  Specify samples to include or exclude based on sample attribute values

  --sel-attr ATTR           Specify the attribute for sample exclusion OR inclusion
  --sel-excl [E [E ...]]    Exclude samples with these values
  --sel-incl [I [I ...]]    Include only samples with these values
nsheff commented 4 years ago

I extended to 36 chars and have this now:

looper run --help
usage: looper run [-h] [-i] [-d] [-f] [-t S] [-l N] [-x S] [-y S] [-p P] [-s S] [-c C]
                  [-u X] [-n N] [-g K] [-o DIR] [--submission-subdir DIR]
                  [--results-subdir DIR] [--pipeline-interfaces-key K]
                  [--pipeline-interfaces P [P ...]] [--sel-attr ATTR]
                  [--sel-excl [E [E ...]] | --sel-incl [I [I ...]]] [-a A [A ...]]
                  [config_file]

Run or submit sample jobs.

positional arguments:
  config_file                       Project configuration file (YAML)

optional arguments:
  -h, --help                        show this help message and exit
  -i, --ignore-flags                Ignore run status flags? Default=False
  -d, --dry-run                     Don't actually submit the jobs. Default=False
  -f, --file-checks                 Perform input file checks. Default=True
  -t S, --time-delay S              Time delay in seconds between job submissions
  -l N, --limit N                   Limit to n samples
  -x S, --command-extra S           String to append to every command
  -y S, --command-extra-override S  Same as command-extra, but overrides values in PEP
  -u X, --lump X                    Total input file size (GB) to batch into a single job
  -n N, --lumpn N                   Number of commands to batch into a single job
  -g K, --toggle-key K              Sample attribute specifying toggle. Default: toggle
  -o DIR, --output-dir DIR          Path to the output directory
  --submission-subdir DIR           Submission subdirectory name
  --results-subdir DIR              Results subdirectory name
  --pipeline-interfaces-key K       Sample attribute specifying pipeline interface sources
  --pipeline-interfaces P [P ...]   Paths to pipeline interface files
  -a A [A ...], --amend A [A ...]   List of amendments to activate

divvy arguments:
  Configure divvy to change computing settings

  -p P, --package P                 Name of computing resource package to use
  -s S, --settings S                Path to a YAML settings file with compute settings
  -c C, --compute C                 Comma-separated list of key-value pairs (k1=v1,k2=v2)

sample selection arguments:
  Specify samples to include or exclude based on sample attribute values

  --sel-attr ATTR                   Attribute for sample exclusion OR inclusion
  --sel-excl [E [E ...]]            Exclude samples with these values
  --sel-incl [I [I ...]]            Include only samples with these values
stolarczyk commented 4 years ago

using nargs="+" in --compute does not adhere to the one line per option scheme:

[mstolarczyk@MichalsMBP looper](dev): looper run -h
usage: looper run [-h] [-i] [-d] [-f] [-t S] [-l N] [-x S] [-y S] [-p P] [-s S]
                  [-c K=V [K=V ...]] [-u X] [-n N] [-g K] [-o DIR]
                  [--submission-subdir DIR] [--results-subdir DIR]
                  [--pipeline-interfaces-key K] [--pipeline-interfaces P [P ...]]
                  [--sel-attr ATTR] [--sel-excl [E [E ...]] | --sel-incl [I [I ...]]]
                  [-a A [A ...]]
                  [config_file]

Run or submit sample jobs.

positional arguments:
  config_file                       Project configuration file (YAML)

optional arguments:
  -h, --help                        show this help message and exit
  -i, --ignore-flags                Ignore run status flags? Default=False
  -d, --dry-run                     Don't actually submit the jobs. Default=False
  -f, --file-checks                 Perform input file checks. Default=True
  -t S, --time-delay S              Time delay in seconds between job submissions
  -l N, --limit N                   Limit to n samples
  -x S, --command-extra S           String to append to every command
  -y S, --command-extra-override S  Same as command-extra, but overrides values in PEP
  -u X, --lump X                    Total input file size (GB) to batch into one job
  -n N, --lumpn N                   Number of commands to batch into one job
  -g K, --toggle-key K              Sample attribute specifying toggle. Default: toggle
  -o DIR, --output-dir DIR          Path to the output directory
  --submission-subdir DIR           Submission subdirectory name
  --results-subdir DIR              Results subdirectory name
  --pipeline-interfaces-key K       Sample attribute for pipeline interface sources
  --pipeline-interfaces P [P ...]   Paths to pipeline interface files
  -a A [A ...], --amend A [A ...]   List of amendments to activate

divvy arguments:
  Configure divvy to change computing settings

  -p P, --package P                 Name of computing resource package to use
  -s S, --settings S                Path to a YAML settings file with compute settings
  -c K=V [K=V ...], --compute K=V [K=V ...]
                                    List of key-value pairs

sample selection arguments:
  Specify samples to include or exclude based on sample attribute values

  --sel-attr ATTR                   Attribute for sample exclusion OR inclusion
  --sel-excl [E [E ...]]            Exclude samples with these values
  --sel-incl [I [I ...]]            Include only samples with these values
stolarczyk commented 4 years ago

we could move metavar back to the help

nsheff commented 4 years ago

yeah it's shorter in help. then it's not repeated 3 times.