Skip to content

SAGA Tutorial Part 1: Introduction

oleweidner edited this page Oct 17, 2012 · 30 revisions

This page is part of the SAGA Tutorial.

What is SAGA Python?

The SAGA Python module provides an object-oriented programming interface for job submission and management, resource allocation, file handling and coordination and communication - functionality that is required in the majority of distributed applications, frameworks and tool.

SAGA Layers

SAGA encapsulates the complexity and heterogeneity of different distributed computing systems and 'cyberinfrastructures' by providing a single, coherent API to the application developer. A plug-in mechanism that is transparent to the application translates the API calls to the different middleware interfaces (figure 1). Currently, the following plug-ins are available in SAGA Python:

  • Local - Allows job execution (via fork) and file handling on the local machine.
  • SSH - Allows job execution on remote hosts via SSH.
  • GSISSH - Allows job execution on remote hosts via GSISSH.
  • SFTP - Provides remote filesystem access via the SFTP protocol.
  • PBS, PBS+SSH, PBS+GSISSH - (includes TORQUE). Provides local and remote access (SSH+GSISSH) to PBS/Torque clusters.
  • SGE, SGE+SSH, SGE+GSISSH - Provides local and remote access (SSH+GSISSH) to Sun (Orcale) Grid Engine clusters.

More details about available plug-ins can be found on the SAGA Plugins page.

Additional information about SAGA Python can be found on the website: http://saga-project.github.com/bliss/. A comprehensive API documentation is available at http://saga-project.github.com/bliss/apidoc/.

Environment Set-Up and Installation

Bootstrap your Local Python Environment

Assuming you don't want to mess with your system Python installation, you need a place were you can install SAGA locally. A small tool called virtualenv allows you to create a local Python software repository that behaves exactly like the global Python repository, with the only difference that you have write access to it. To create your local Python environment run the following command (you can install virtualenv on most systems via apt-get or yum, etc.):

virtualenv $HOME/tutorial

If you don't have virtualenv installed and you don't have root access to your machine, you can use the following script instead:

curl --insecure -s https://raw.github.com/pypa/virtualenv/master/virtualenv.py | python - $HOME/tutorial

Activate your Local Python Environment

You need to activate your Python environment in order to make it work. Run the command below. It will temporarily modify your PYTHONPATH so that it points to $HOME/tutorial/lib/python2.7/site-packages/ instead of the the system site-package directory:

source $HOME/tutorial/bin/activate

Activating the virtualenv is very important. If you don't activate your virtual Python environment, the rest of this tutorial will not work. You can usually tell that your environment is activated properly if your bash command-line prompt starts with (tutorial).

Install SAGA-BlisS

The latest SAGA-BlisS Python module is available via the Python Package Index (PyPi). PyPi packages can be installed similar to Linux deb or rpm packages with a tool called pip (which stands for pip installs packages). Pip is installed by default in your virtualenv, so in order to install SAGA-BlisS, the only thing you have to do is this:

pip install bliss

You will see some downloading and unpacking action and if everything worked ok, the last two lines should look like this:

Successfully installed bliss paramiko-on-pypi pycrypto-on-pypi
Cleaning up...

To make sure that your installation works, run the following command to check if the SAGA-BlisS module can be imported by the interpreter (the output should be version number of the bliss module):

python -c "import bliss; print bliss.version"

Note: Your system will need the Python header files installed in order to install bliss. Most machines have them installed by default, but just in case your machine doesn't, just install the correct packages; python-dev.