wiki:DRM4G/Tutorial

Version 11 (modified by carlos, 6 years ago) (diff)

--

About DRM4G

DRM4G is an open platform, based on GridWay , to define, submit, and manage computational jobs. DRM4G is a Python (2.6+, 3.3+) implementation that provides a single point of control for computing resources without installing any intermediate middlewares. As a result, a user is able to run the same job on laptops, desktops, workstations, clusters, supercomputers, and any grid.

Start Guide

In order to install DRM4G, an installation script is provided. Type the command below on your shell terminal:

$ wget --no-check-certificate -O- https://meteo.unican.es/work/DRM4G/install.sh | bash

==========================
DRM4G installation script
==========================

--> Checking the last version of DRM4G ...

--> DRM4G version selected: 2.4.1

--> Downloading drm4g-2.4.1.tar.gz ...

--> Unpacking drm4g-2.4.1.tar.gz in directory /home/USER ...

--> Installing DRM4G python requirements locally ...

====================================
Installation of DRM4G 2.4.1 is done!
====================================

In order to work with DRM4G you have to enable its 
environment with the command:

    . /home/USER/drm4g/bin/drm4g_init.sh

You need to run the above command on every new shell you 
open before using DRM4G, but just once per session.

By default, it will install DRM4G on your current directory. But, you can download the installation script:

$ wget --no-check-certificate https://meteo.unican.es/work/DRM4G/install.sh

And run it manually:

$ bash ./install.sh [options]

The options available are:

  • -d, --dir DIRECTORY: Install DRM4G into a directory.
  • -V, --version: Version to install.
  • -h, --help: Print help text.

My first job

If the the directory ~/.drm4g does not exist, drm4g will create one with a local configuration

  1. Enable DRM4G:
    [user@mycomputer~]$. /home/user/drm4g/bin/drm4g_init.sh
    
  1. Start up DRM4G :
    [user@mycomputer~]$ drm4g start
    Creating a DRM4G local configuration in '/home/user/.drm4g'
    Creating '/home/user/.drm4g/var/acct' directory
    Coping from '/home/user/drm4g/etc' to '/home/user/.drm4g/etc'
    Starting DRM4G .... 
     OK
    Starting ssh-agent ...
     OK
    
  2. Show information about all available resources and their host :
    [user@mycomputer~]$ drm4g resource list
    RESOURCE            STATE               
    localmachine        enabled
    
    [user@mycomputer~]$ drm4g host list
    HID ARCH       JOBS(R/T) LRMS       HOST                
    0   x86_64           0/0 fork       localmachine
    
    [user@mycomputer~]$ drm4g host list 0
    HID ARCH       JOBS(R/T) LRMS       HOST                
    0   x86_64           0/0 fork       localmachine        
    
    QUEUENAME      JOBS(R/T) WALLT CPUT  MAXR  MAXQ 
    default              0/0 0     0     1     1               
    
  3. Create a job template :
    [user@mycomputer~]$ echo "EXECUTABLE=/bin/date" > date.job
    
  4. Submit the job :
    [user@mycomputer~]$ drm4g job submit date.job
    ID: 0
    
  5. Check the evolution of the job :
    [user@mycomputer~]$ drm4g job list 0
    JID DM   EM   START    END      EXEC    XFER    EXIT NAME            HOST                                          
    0   pend ---- 19:39:09 --:--:-- 0:00:00 0:00:00 --   date.job        --                        
    
    If you execute successive drm4g job list 0, you will see the different states of this job:
    0   pend ---- 19:39:09 --:--:-- 0:00:00 0:00:00 --   date.job        --                                            
    0   prol ---- 19:39:09 --:--:-- 0:00:00 0:00:00 --   date.job        --                                                            
    0   wrap pend 19:39:09 --:--:-- 0:00:00 0:00:00 --   date.job localhost/fork                                                                         
    0   wrap actv 19:39:09 --:--:-- 0:00:05 0:00:00 --   date.job localhost/fork                                                         
    0   epil ---- 19:39:09 --:--:-- 0:00:10 0:00:00 --   date.job localhost/fork
    0   done ---- 19:39:09 19:39:27 0:00:10 0:00:01 0    date.job localhost/fork         
    
    • pend: The job is waiting for a resource to run on.
    • prol :The remote system is being prepared for execution.
    • wrap pend :The job has been successfully submitted to the computing resource and it is waiting.
    • wrap actv:The job is being executed by the computing resource.
    • epil:The job is finalizing.
    • done:The job has finished.
  6. Results are standard output (stdout) and standard error (stderr), both files will be in the same directory of job template:
    [user@mycomputer~]$ cat stdout.0
    Mon Jul 28 12:29:43 CEST 2014
    
    [user@mycomputer~]$ cat stderr.0
    
    

How to configure a TORQUE/PBS resource

In order to configure a TORQUE/PBS cluster accessed through ssh protocol, you should follow the next steps:

  1. Configure the meteo resource. If you do not have a private_key file, you can generate one by executing ssh-keygen. This command will generate a public key (~/.ssh/id_rsa.pub) that will be necessary later on.
    [user@mycomputer~]$ drm4g resource edit
    [meteo]
    enable            = true
    communicator      = ssh
    username          = user
    frontend          = mar.meteo.unican.es
    private_key       = ~/.ssh/id_rsa
    lrms              = pbs
    queue             = short
    max_jobs_running  = 2
    max_jobs_in_queue = 6
    
  2. List and check if resource has been created successfully :
    [user@mycomputer~]$ drm4g resource list
    RESOURCE            STATE               
    meteo               enabled
    
    
  3. Copy the public key (~/.ssh/id_rsa.pub) to authorized_keys file on the remote frond-end, and adds the private key to the agent for the ssh authorization:
    [user@mycomputer~]$ drm4g id meteo init 
    Starting ssh-agent ...
     WARNING: ssh-agent is already running
    --> Add '/home/user/.ssh/id_rsa' into ssh-agent for 168 hours
     Lifetime set to 7 days, 0:00:00
    --> Copy '/home/user/.ssh/id_rsa' to ~/.ssh/authorized_keys file on 'ui.macc.unican.es'
    
    
  4. Show information about the identity:
    [user@mycomputer~]$ drm4g id meteo info
    --> Display '/home/user/.ssh/id_rsa' key
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQAABAQDcUYc9tDOYptqAWf7YzgN2NY9F+AtObtVvgh0PsIWZvDx1ml6j9n7zihiHFwnNIQh1q1EpIku/Jg8kyKOnbpm+2prnIhURoAWxO+rlzCF0Q4hHHW5svNNR6doCZ9mNNswi1uHaVpwhu8EKgfPyH+oNI/inSnJ/QQRHILyjUvaNbQPuXwVBpYjpvOAFOYA2VZqi+IfTq13lks7DCBfv3DK1w38aDQ9xFP/hYlQKwC/DwJo1q2CWxg5WZhgHFRG/1nyVH/nTbjOMTRZS61Gre58UUab/wSZQc6rTkrTitnCdAujIUx5eiOhM90JfDj+VUriLTnXCkwUC4+h
    

That's it! Now, you can summit jobs to meteo.

User Scenarios

Single Jobs

Array Jobs

MPI Jobs

Attachments (2)

Download all attachments as: .zip