Skip to content

XSEDE 2013 SAGA Tutorial

shantenujha edited this page Jul 21, 2013 · 23 revisions

Preparation

This tutorial will use the TACC Virtual Machine (VM) repex1. Log-in via SSH using the username/password you received at the beginning of the tutorial:

ssh <username>@repex1.tacc.utexas.edu

Installation

Next, you need to install SAGA-Python in your user account on repex1. Since saga-python - as the name suggests - is written in Python, you can use virtualenv to create a local installation:

virtualenv $HOME/sagaenv
. $HOME/sagaenv/bin/activate

The SAGA-Python package on PyPi (Python Package Index) that we are using is called saga-python and can be installed via pip:

pip install saga-python

Code Example 1: Local Job Submission

Preparation

  1. Take a look at the full example code on GitHub.

  2. Create a new file in your home directory, copy & paste the code into it and save it, e.g., as saga_example_local.py.

Execution

Execute the Python script:

python saga_example_local.py

The output will look something like this:

Job ID    : None
Job State : New

...starting job...

Job ID    : [fork://localhost]-[31981]
Job State : Done

...waiting for job...

Job State : Done
Exitcode  : 0

Code Example 2: Remote Example

Preparation

  1. Take a look at the full example code on GitHub.

  2. Create a new file in your home directory, copy & paste the code into it and save it, e.g., as saga_example_remote.py.

Execution

Execute the Python script:

python saga_example_remote.py

The output will look something like this:

Job ID    : None
Job State : New

...starting job...

Job ID    : [ssh://localhost]-[32704]
Job State : Done

...waiting for job...

Job State : Done
Exitcode  : 0

Discussion

If you want, try to replace ssh://localhost with another machine you have access to. Look for the saga.Context object in the code if you need to define specific login credentials.

SAGA-Python provides many other backend adaptors besides ssh and fork. Check out the adaptor section of the documentation if you want to learn more: http://saga-project.github.io/saga-python/doc/adaptors/saga.adaptor.index.html.

Code Example 3: Remote Example + File Staging

Preparation

  1. Take a look at the full example code on GitHub.

  2. Create a new file in your home directory, copy & paste the code into it and save it, e.g., as saga_example_remote_staging.py.

Execution

Execute the Python script:

python saga_example_remote_staging.py

The output will look something like this:

Job ID    : None
Job State : New

...starting job...

Job ID    : [ssh://localhost]-[4319]
Job State : Done

...waiting for job...

Job State : Done
Exitcode  : 0

Staged out sftp://localhost/tmp/mysagajob-tutorial-00.stdout to file:///home/tutorial-00/ (size: 16 bytes)

You will find a .stdout file in your working directory that contains the output of your job.

Discussion

As in the previous example, you can replace ssh://localhost with another (remote) machine you have access to.

Clone this wiki locally