Giter VIP home page Giter VIP logo

slurmspawner's Introduction

#slurmspawner for Jupyterhub This is a custom spawner for Jupyterhub that is designed for installations on clusters using Slurm scheduling software. Some of the code and inspiration for this came directly from Andrea Zonca's blog post where he explains his implementation for a spawner that uses SSH and Torque. His github repo is found here.

##Dependencies

  • This spawner creates slurm jobs when users log in, so it must be installed in an environment running Slurm.
  • Also, jupyterhub and its dependencies must be installed. See the jupyterhub readme for instructions on setting up jupyterhub

##Installation

  1. from root directory of this repo (where setup.py is), run pip install -e .

  2. add lines in jupyterhub_config.py

       c = get_config()
       c.JupyterHub.spawner_class = 'slurmspawner.SlurmSpawner'

##Configuration There are several values you can set in jupyterhub_config.py that override the default Slurm SBATCH options that get submitted by SlurmSpawner. Currently, the variables you can change are:

  • job_name (String)
  • partition (String)
  • memory (Integer)
  • time (String in format dd-hh:mm:ss)
  • qos (String)
  • output (String output file. Note that this will be appended to /home/$USER, so any subdirectories must already exist in the user's home directory.)
  • cpus_per_task (Integer)
  • ntasks (Integer)

Some of the other SBATCH options are not included because they would interfere with how SlurmSpawner works. For example, workdir needs to be /home/$USER because this is where jupyterhub will land you when you log in. If the submitting user isn't the owner of workdir the job will fail silently. If you would like access to other directories, it may be easiest to use the extra_launch_script variable described below to create soft links for the user on submission of the SlurmSpawner job.

You can add more functionality to the basic job script by specifying a bash script snippet. This is done with the extra_launch_script variable. For example, if you would like to make sure the user has a certain binary added to their path when they log in and also make soft links to an nfs "scratch" directory, your "snippet" would look like:

   export PATH=/path/to/binary:${PATH}
   ln -s /scratch/${USER} ${HOME}

Now just add

   c.SlurmSpawner.extra_launch_script = /path/to/snippet

to your jupyterhub_config.py file and that's it! When you run jupyterhub and a user logs in, it will set the path and soft links every time.

##Logging There is quite verbose debug logging in SlurmSpawner (probably too verbose), so when testing this out it might help to set c.Spawner.debug = True in jupyterhub_config.py. This way you can see exactly what script is being sent to Slurm, and the jobid and status of all running servers each time they are polled.

slurmspawner's People

Contributors

mkgilbert avatar

Stargazers

 avatar

Watchers

 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.