Giter Site home page Giter Site logo

plz's Introduction

plz

Helpers for running native Python functions as qsub jobs on the CLSP grid.

plz uses Dask and Dask-Jobqueue to distribute Python functions as SGE-managed jobs. No need to wrap python scripts into bash scripts anymore!

Installation

pip install git+https://github.com/pzelasko/plz

Examples

CPU jobs:

def task(x):
    return x ** 2

import plz
plz.map(task, range(1000), jobs=10)

GPU jobs:

def task(x):
    import torch
    return torch.tensor([x] * 100, device='cuda').sum()

import plz
plz.map(task, range(1000), jobs=1, gpus=1)

Iterate over multiple sequences:

def task(x, y):
    return (x + y) ** 2
    
import plz
plz.map(task, range(1000), range(1000, 2000), jobs=10)

Using logs:

def task(x):
    import logging
    logging.info(f'Running job with input {x}')
    return x ** 2

import plz
plz.map(task, range(1000), jobs=10, log_dir='/path/to/logs')

Single task:

def task(x):
    return x ** 2

import plz
plz.run(task, 1)

Running on CLSP or COE grid

By default, the map and run methods are configured to run on the CLSP grid. To run on the COE grid, additionally pass the argument grid='coe' to these methods.

Technical details

Under the hood, for each run or map call, it creates your own "mini-cluster" of Python worker "services" where the jobs are being distributed. This cluster has its own scheduling, load balancing etc. It automatically shuts down as soon as all the inputs are processed.

plz's People

Contributors

desh2608 avatar pzelasko avatar

Stargazers

 avatar  avatar  avatar  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.