API Main Practical

From Grid5000
Jump to: navigation, search
See also: API | API Main Practical | API all in one Tutorial | Monitoring API


This practical will show you how to interact with the Grid'5000 API, using a range of tools that goes in increasing degrees of abstraction.

This practical is targeted at people who want to remotely and programmatically (i.e. without Human interaction) access the Grid'5000 tools to monitor nodes, submit jobs and deploy environments.

If you are not familiar with the HTTP protocol, you are strongly advised to have a look at the introductory page about the Grid'5000 API.

This practical will use the latest stable version of the API: 2.1.


The following examples will use the cURL tool, which is the swiss-army knife for interacting (among other things) with HTTP APIs. On debian systems, it can be installed with:

 sudo apt-get install curl

The advanced examples will all use the Ruby language (a cousin to the Python language), and the Ruby package manager Rubygems. On a debian system, they can be installed with:

 sudo apt-get install ruby libopenssl-ruby rubygems

Note that if gem -v returns a version number lower than 1.3.5, you may need to install rubygems from sources to get a more recent version.

Warning.png Warning

If you are installing ruby gems as a non-privileged user, you may encounter a warning similar to the following:

  WARNING:  Installing to ~/.gem since /var/lib/gems/1.9.1 and
  	  /var/lib/gems/1.9.1/bin aren't both writable.
  WARNING:  You don't have /users1/g5k-30/.gem/ruby/1.9.1/bin in your PATH,
  	  gem executables will not run.

In this case, do not forget to add the specified directory to your PATH, so that binaries are easily accessible:

  echo "export PATH=\"$HOME/.gem/ruby/1.9.1/bin:\$PATH\"" >> ~/.profile && source ~/.profile


The tutorials are self-hosted in a git repository at GitHub, so that you can easily get a copy (either by cloning the repository or downloading an archive of the files) and make changes to the source files.

Go to http://grid5000.github.io/tutorials/ to start the tutorials.


Do not hesitate to ask for help in the devel mailing-list, and share your code!