Module bussilab.cli_documentation

Documentation for command line tools

This module only contains the documentation of the subcommands used in the command line interface. For all the subcommands, a short help identical to that generated by the -h option is shown. In addition, if present, the docstring of the function is also shown here.

list

usage: bussilab list [-h]

List available python modules.

options:
  -h, --help  show this help message and exit

check

usage: bussilab check [-h] [--import]

Check installed features

options:
  -h, --help  show this help message and exit
  --import    check if all the submodules can be imported

wham

usage: bussilab wham [-h] -b BIAS [-o OUT] [--use-frame-weight]
                     [--traj-weight [TRAJ_WEIGHT ...]] [-T T] [-m MAXITER]
                     [-t THRESHOLD] [-v]

Perform binless WHAM

options:
  -h, --help            show this help message and exit
  -b BIAS, --bias BIAS  File containing bias potential (default: None)
  -o OUT, --out OUT     Output file with weights (default: None)
  --use-frame-weight
  --traj-weight [TRAJ_WEIGHT ...]
  -T T, --temperature T
                        system temperature in energy units (default: 1.0)
  -m MAXITER, --maxiter MAXITER
                        maximum number of iterations (default: 1000)
  -t THRESHOLD, --threshold THRESHOLD
                        threshold for convergence (default: 1e-40)
  -v, --verbose

jrun

usage: bussilab jrun [-h] [-d] [--lab] [--port PORT] [--screen-cmd SCREEN_CMD]
                     [--screen-log SCREEN_LOG] [--python-exec PYTHON_EXEC]
                     [-S SOCKNAME] [--no-screen] [--keep-ld-library-path]
                     [--detach]

Run jupyter server

options:
  -h, --help            show this help message and exit
  -d, --dry-run         show command instead of executing it (default: False)
  --lab                 use jupyterlab (default: False)
  --port PORT           set port (default: 0)
  --screen-cmd SCREEN_CMD
                        screen command (default: screen)
  --screen-log SCREEN_LOG
                        screen logfile (no logfile by default) (default: )
  --python-exec PYTHON_EXEC
                        python executable (default: )
  -S SOCKNAME, --sockname SOCKNAME
                        screen sockname (default: (path):(port):jupyter)
  --no-screen           do not run screen (default: False)
  --keep-ld-library-path
                        (ignored, this is the default now) (default: False)
  --detach              detach screen (default: False)

This is a tool to run a jupyter server within a screen command. The typical usage would be

cd /path/to/your/notebook/dir
bussilab jrun

A free port is identified first (can be overridden with the --port option) and a jupyter server is then run inside a screen instance. You will thus have to type CTRL+aCTRL+d in order to detach the screen letting it run in the background.

Alternatively, you can immediately detach the screen with

cd /path/to/your/notebook/dir
bussilab jrun --detach

Notice that, since the server is run inside a screen instance, in order to visualize python outputs that has been sent directly to the terminal you should connect to the screen instance later. By default, a socket name containing the path where the server is running is used, with / replaced by :. It should thus be easy to use screen -ls to find the proper screen instance.

jremote

usage: bussilab jremote [-h] [-d] [-l] [--port PORT] [-i INDEX]
                        [--python-exec PYTHON_EXEC] [--server-url SERVER_URL]
                        [--open-cmd OPEN_CMD]
                        server

Run jupyter client

positional arguments:
  server                server URL (e.g. giorgione.phys.sissa.it)

options:
  -h, --help            show this help message and exit
  -d, --dry-run         show command instead of executing it (default: False)
  -l, --list-only       only report a list or servers (default: False)
  --port PORT           set port (default: 0)
  -i INDEX, --index INDEX
                        choose server, by default interactive choice (default:
                        0)
  --python-exec PYTHON_EXEC
                        remote python executable (e.g. module load python3
                        python-home; python) (default: python)
  --server-url SERVER_URL
                        URL on server (default: choose interactively)
                        (default: )
  --open-cmd OPEN_CMD   open command (detected automatically by default)
                        (default: )

This is a tool to connect to a remote running jupyter server. The typical usage would be

bussilab jremote server.url

A list of jupyter servers running on the selected machines will be shown, and one of them can be picked typing its progressive number. In case there is a single server running, it will be opened by default.

Notice that if the name of the python executable on the server is different from plain python you can override it with --python-exec. You can also run other scripts before, for instance loading relevant modules:

bussilab jremote giorgione.phys.sissa.it --python-exec            --python-exec "module load python3 python-home; python3"

If you recurrently connect to the same workstation, it is convenient to write a small script like this one, call it jremote and put it in your path:

export PYTHONPATH=/path/to/bussilab/source
python -m bussilab jremote giorgione.phys.sissa.it --python-exec "module load python3 python-home ; python3"

Here replace python with the name of your python interpreter (might be python3.7).

pip_upgrade_all

usage: bussilab pip_upgrade_all [-h] [--user]

Upgrade all packages with pip

options:
  -h, --help  show this help message and exit
  --user      install/upgrade in user location (default: False)

This is a tool to upgrade all your packages with pip. It is a convenient way to upgrade all the packages without the need to list them explicitly.

Warning: this uses pip, so it might not work as expected if you are working in conda.

The typical usage would be

bussilab pip_upgrade_all

If you installed packages in your home you should use

bussilab pip_upgrade_all --user

notify

usage: bussilab notify [-h] [-m MESSAGE]
                       [-c CHANNEL | -u UPDATE | -d DELETE | -r REPLY | -R REPLY_BROADCAST | -X REACT]
                       [-f FILE] [-t TITLE] [--no-footer]
                       [--screenlog SCREENLOG]
                       [--screenlog-maxlines SCREENLOG_MAXLINES] [--type TYPE]
                       [--token TOKEN] [-q]

Send a notification to Slack

options:
  -h, --help            show this help message and exit
  -m MESSAGE, --message MESSAGE
                        message (default: None)
  -c CHANNEL, --channel CHANNEL
                        channel (check ~/.bussilabrc by default) (default:
                        None)
  -u UPDATE, --update UPDATE
                        url of the message to be updated (default: None)
  -d DELETE, --delete DELETE
                        url of the message to be deleted (default: None)
  -r REPLY, --reply REPLY
                        url of the message to be replied (default: None)
  -R REPLY_BROADCAST, --reply-broadcast REPLY_BROADCAST
                        url of the message to be broadcast-replied (default:
                        None)
  -X REACT, --react REACT
                        react to a message (default: None)
  -f FILE, --file FILE  path to a file to be uploaded (incompatible with -u
                        and -d) (default: None)
  -t TITLE, --title TITLE
                        title of the message (default: None)
  --no-footer           ignore footer (default: False)
  --screenlog SCREENLOG
                        screenlog file (default: None)
  --screenlog-maxlines SCREENLOG_MAXLINES
                        maximum number of lines in screenlog (0 means all)
                        (default: 0)
  --type TYPE           'plain_text' or 'mrkdwn' (default: mrkdwn)
  --token TOKEN         token (check ~/.bussilabrc by default (default: None)
  -q, --quiet           quiet (do not write output) (default: False)

This is a tool to send a notification to Slack. See the documentation of bussilab.notify.

cron

usage: bussilab cron [-h] [--quick-start]
                     [--quick-start-skip-steps QUICK_START_SKIP_STEPS]
                     [--quick-start-event QUICK_START_EVENT]
                     [--cron-file CRON_FILE] [--screen-cmd SCREEN_CMD]
                     [--screen-log SCREEN_LOG] [--no-screen]
                     [--keep-ld-library-path] [-S SOCKNAME]
                     [--python-exec PYTHON_EXEC] [--detach] [--unique]
                     [--window] [--period PERIOD] [--max-times MAX_TIMES]

Run cron

options:
  -h, --help            show this help message and exit
  --quick-start         run immediately (default: False)
  --quick-start-skip-steps QUICK_START_SKIP_STEPS
                        skip steps on quick start (default: None)
  --quick-start-event QUICK_START_EVENT
                        event number for quick start (default: None)
  --cron-file CRON_FILE
                        path to cron file (default: None)
  --screen-cmd SCREEN_CMD
                        screen command (default: screen)
  --screen-log SCREEN_LOG
                        screen logfile (no logfile by default) (default: )
  --no-screen           do not run screen (default: False)
  --keep-ld-library-path
                        (ignored, this is the default now) (default: False)
  -S SOCKNAME, --sockname SOCKNAME
                        screen sockname (default: (path):cron)
  --python-exec PYTHON_EXEC
                        python executable (default: )
  --detach              detach screen (default: False)
  --unique              allow only one screen with this socket (default:
                        False)
  --window              run a new window within the same screen (default:
                        False)
  --period PERIOD       period (seconds) default read from cron file or set to
                        3600 (default: None)
  --max-times MAX_TIMES
                        maximum number of calls (default: None)

required

usage: bussilab required [-h] [--macports | --conda] [--pyver PYVER]

print requirements

options:
  -h, --help     show this help message and exit
  --macports     conda syntax (default: False)
  --conda        macports syntax (default: False)
  --pyver PYVER  pyversion (e.g. 38), for macports only (default: )