Table Of Contents

Previous topic

mmf.utils.pymacs

Next topic

mmf.utils.script

This Page

mmf.utils.run

get_hg_checksum([strict]) Return a string of the form <rev>_<checksum> where <rev> is the local revision number and <checksum> is the checksum of the current revision.
run_cmd() Return the run command for running python with this module as the
get_pip_requirements() Return the pip requirements file as a string.

Running Programs

This module is intended to be used to manage important runs that generate data for a paper, etc.

For interactive use, start python as follows:

python -im mmf.utils.run

If you need to run a script, then use this module as the startup file with one of the following commands:

PYTHONSTARTUP=path_to_mmf/mmf/utils/run.py python file.py
PYTHONSTARTUP=path_to_mmf/mmf/utils/run.py python -c "import blah;..."

To find the full path for the previous commands, run:

python -c"import sys;sys._pymmf_no_init=True;import mmf;print mmf.run_cmd()"

This can be aliased for easy use.

Purpose

The aim of this module is reproducibility:

  1. This module assumes that the application be run in an appropriately named directory: no special sub-directory will be created (other than those associated with mmf.archive.DataSet instances).
  2. The command must be run in a mercurial repository with no outstanding commits. The current revision number and checksum is used for output. These checks can be temporarily disabled by setting the environmental variable STRICT=false, but this should be avoided except during testing as it breaks the reproducibility.
  3. All input and output is recorded.
  4. pip is used to record the versions of libraries installed when the program is run.
mmf.utils.run.get_hg_checksum(strict=True)[source]

Return a string of the form <rev>_<checksum> where <rev> is the local revision number and <checksum> is the checksum of the current revision. (Note: <rev> is not unique and may vary from repository to repository, but provides a simple chronological ordering for runs that is not intuitively deducible from the <checksum>.)

Parameters :

strict : bool

If True, then this will raise a ValueError exception if the there are uncommited changes.

mmf.utils.run.run_cmd()[source]

Return the run command for running python with this module as the startup file.

mmf.utils.run.get_pip_requirements()[source]

Return the pip requirements file as a string.

This is the output of pip freeze.