Skip to main content

GitResultsManager

Note: GitResultsManager does not profess to be remotely operable on any operating system besides Linux and Mac. Evidence of success on other OSs is appreciated.

Installing

One line global install:

git clone https://github.com/yosinski/GitResultsManager.git && \
cd GitResultsManager && \
sudo python setup.py install && \
sudo cp resman resman-td git-recreate /usr/local/bin/

Replace /usr/local/bin with another location on your path, if desired. If installing the Python packages in your home directory (perhaps using virtualenv), you should omit the first sudo, and if installing scripts in your home directory, skip the second.

Usage

GitResultsManager may be used in two ways:

  1. (recommended) Using the resman wrapper script to run programs in any language, or
  2. From within Python as a Python module.

(1) is more general, while (2) offers more control. The following examples are available in the examples directory.

Example of using resman wrapper script to run a C program:

First, we'll compile the demo-c program (from the examples directory) and run it without resman:

g++ -o demo-c demo-c.cc   # compile program first if necessary
./demo-c

Output:

Environment variable GIT_RESULTS_MANAGER_DIR is undefined. To demonstrate logging, run this instead as
    resman junk ./demo-c
This line is logged
This line is logged (stderr)
This line is logged
This line is logged (stderr)
This line is logged
This line is logged (stderr)

Notice that it complains it cannot find the GIT_RESULTS_MANAGER_DIR environment variable. This is how the program knows it is not being run from within resman. Now, try using resman to run it:

resman -r run-name ./demo-c

Output:

WARNING: GitResultsManager running in GIT_DISABLED mode: no git information saved! (Is /Users/jason/temp/examples in a git repo?)
  Logging directory: results/121030_183101_run-name
        Command run: ./demo-c
           Hostname: lapaz
  Working directory: /Users/jason/temp/examples
The current GIT_RESULTS_MANAGER_DIR is: results/121030_183101_run-name
This line is logged
This line is logged
This line is logged
This line is logged (stderr)
This line is logged (stderr)
This line is logged (stderr)
       Wall time:  0.024
  Processor time:  0.012

Notice how resman adds a few lines of information to the beginning and ending of the output? Looking at each line in order:

WARNING: GitResultsManager running in GIT_DISABLED mode: no git information saved! (Is /Users/jason/temp/examples in a git repo?)

Warning because we aren't running from within a git repository, removing most of the usefulness of GitResultsManager.

  Logging directory: results/121030_183101_run-name

The directory that was created for this run, in the format <datestamp>_<timestamp>_<name of run>

        Command run: ./demo-c

Which command you actually ran.

           Hostname: lapaz

The host this run was performed on (useful when running on clusters or multiple machines with non-identical configurations)

  Working directory: /Users/jason/temp/examples

The working directory. Next follows the actual output of the program, and then at the end...

       Wall time:  0.024
  Processor time:  0.012

resman notes how long the program took to execute in wall time and processor time.

Simple code change to use resman wrapper script in Python:

Import the os module:

import os

Check if we're running from within resman. If so, use the directory resman provides, else save output to the current directory:

try:
    savedir = os.environ['GIT_RESULTS_MANAGER_DIR']
except KeyError:
    savedir = '.'

# later in code, when saving plots / etc:

savefig(os.path.join(savedir, 'myplot.png'))

Example of using the GitResultsManager class within Python.

See examples/demo-GRM-module.py.

Development task list

To do

  1. Add settings override via ~/.config/gitresultsmanager_config.py or similar
  2. Documentation

Want to help? Pull requests are welcome!

Metadata

Release files for GitResultsManager 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GitResultsManager 0.5.0
File Size Uploaded Provenance
gitresultsmanager-0.5.0.tar.gz 28.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for GitResultsManager 0.5.0
File Interpreter ABI Platform
gitresultsmanager-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.7 kB

Release files / gitresultsmanager-0.5.0.tar.gz

Download URL gitresultsmanager-0.5.0.tar.gz
Size 28.2 kB
Tags Source
SHA-256 checksum
How to use checksums
354468eedc924163db6214bfebe1070d4dbf37dcf34aa064acde7f71343fd9c0
BLAKE2b-256 checksum
How to use checksums
fd0b1d13089da9772482bce465a50b3f96fdbb45033bf94c49bd22de7a98f497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / gitresultsmanager-0.5.0-py3-none-any.whl

Download URL gitresultsmanager-0.5.0-py3-none-any.whl
Size 28.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c6a419f06f24409fc60d0e325e649e8883f12a94c1cff1f1885274011f8c3a4
BLAKE2b-256 checksum
How to use checksums
f19f96d2fe4049145274ae4b320247ee38f0f9d491dcda624919f8b867ffe050
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for GitResultsManager 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page