Giter Club home page Giter Club logo

batchrun's Introduction

batchrun

A simple workflow for launching, tracking, and resuming jobs with varying argument values and parameter sweeps.

Quickstart

Launch multiple jobs

Given a runfile containing a list of shell commands:

sleep 1; echo "First!"
sleep 1; echo "Second!"
sleep 1; echo "Third!"

we can launch them line by line as follows:

batchrun launch runfile --n_jobs 2

Batchrun will run the commands in parallel with n_jobs workers and keep track of the jobs. By default, it will write the logs of each command to runs/runfile/logs/<hash of command>, and keep the metadata in runs/runfile/metadata.json. The metadata file contains the mapping from the commands to their hashes, and status information about the jobs.

Resuming where we left and adding new jobs

In the case of shutdown, batchrun will by default resume the jobs which have not finished. Similarly, if we add more jobs to the runlist, batchrun will only run the new ones. The way batchrun tells if a job is new or not is by the command itself. If the command has changed in any way, e.g., the order of arguments is different, batchrun will assume it's a new job.

Create a parameter sweep

Given a specification of a parameter value grid gridspec.yml:

program: python3 my_script.py
parameters:
  alpha:
    values:
      - 1
      - 2
      - 5
  beta:
    values: [0.1, 0.25, 0.5]
  gamma:
    value: 100

we can generate a list of commands corresponding to all possible parameter value combinations:

python3 my_script.py --alpha=1 --beta=0.1 --gamma=100
python3 my_script.py --alpha=1 --beta=0.25 --gamma=100
python3 my_script.py --alpha=1 --beta=0.5 --gamma=100
python3 my_script.py --alpha=2 --beta=0.1 --gamma=100
...

by running the following command:

batchrun sweep gridspec.yml

The runfile containing the commands by default will be written to gridspec.runfile. You can then launch the sweep using the batchrun launch gridspec.runfile as detailed before.

batchrun's People

Contributors

bogdan-kulynych avatar

Stargazers

 avatar Edoardo Debenedetti avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.