Some Useful Scripts

Alternatieve WMS

# Connect proxy with alternative wms service
WMS=https://wms.grid.sara.nl:7443/glite_wms_wmproxy_server
glite-wms-job-delegate-proxy -e $WMS -d $USER

# Submit job with alternative wms service
glite-wms-job-submit -e $WMS -d $USER -o myjobs myprogram.jdl

Testing if a module is available

testModule.sh is a script that checks whether a given module is installed on the computer, assuming that the the software packages are installed using the modules environment: If available, it loads the module (using module load) and displays the new PATH and LD_LIBRARY_PATH variables.

This is useful to test if a given software package is installed on clusters (see more here).

Download: testModule.sh

Run:

testModule.sh <module name>

Example:

testModule.sh matlab

Submitting a given job to all available clusters

submit-jobs-all-ces.sh is a script that lists all the available queues (CE) for a given VO and submits the same job to all of them. The job ids and CE names are stored in two files ( jobdis.txt and ces.txt). All input and output files are stored in the current directory.

NOTE: the first line in both files (with jobIDs and names) are ignored.

Download: submit-jobs-all-ces.sh

Run:

submit-jobs-all-ces.sh <vo> <jdl>

Retrieving the outputs of many jobs

get-outputs-jobs.sh is a script that gets the outputs of all jobs and stores them in directories with names given by a "name" file, both in text format (e.g., as generated by submit-jobs-all-ces.sh.

The script first tests if all jobs have reached the status Done. The user can decide to proceed or stop.

A new directory ./outputs is created in the current dir and all the files are stored in subdirectories with the given names. A file is created ./outputs/summary.txt

Download: get-outputs-jobs.sh

Run:

get-outputs-jobs.sh <jobs file> <names file>

Example (all together)

Goal: to run the testModule.sh script as a job (using testMCR.jdl) on each node to check the presence of the MCR software (runtime libs for matlab):

submit-jobs-all-ces.sh vlemed testMCR.jdl

This will generate the files ./jobids.txt and ./ces.txt, which can be used to retrieve the job outputs with

get-outputs-jobs.sh jobids.txt ces.txt

The output files will be stored as illustrated below:

silviado$ ll -R outputs/
outputs/:
total 56
drwxr-xr-x 2 silviado silviado 4096 May 26 19:09 trekker.nikhef.nl:2119-jobmanager-pbs-qshort/
-rw-r--r-- 1 silviado silviado 1546 May 26 19:08 summary.txt

outputs/trekker.nikhef.nl:2119-jobmanager-pbs-qshort:
total 4
-rw-r--r-- 1 silviado silviado 0 May 26 19:09 std.err
-rw-r--r-- 1 silviado silviado 373 May 26 19:09 std.out >

Test if Matlab is correctly running on all CEs

The script above can be used to check if MCR is installed and matlab is correctly running.

Download files here: testMCRMatlab.zip

Similar to above, say:

submit-jobs-all-ces.sh vlemed testMCRMatlab.jdl

Wait for all jobs to end, check via glite-wms-job-status -i jobids.txt

cd to outputs directory and retrieve and parse results:

get-outputs-jobs.sh jobids.txt ces.txt
cd outputs
results-jobs-all-ces.sh

Example output:

deimos.htc.biggrid.nl:2119-jobmanager-pbs-long/mcaan_44EY4-YQ3BKLBsRYreT63Q/std.out:****** ERROR: mcr/7.11 not available

ce.grid.rug.nl:2119-jobmanager-pbs-long/mcaan_5goGiBNUlmZ2ejWCRC4Hpg/std.out:****** ERROR: can't run matlab binary

ce.gina.sara.nl:2119-jobmanager-lcgpbs-medium/mcaan_hgN0FKc-gkvMrAUBE6xM6w/std.out:######################### Job completed successfully (0)

First CE has MCR/7.11 not installed. Second has broken MCR installation. Third is doing fine.

Change permissions on SRM level

Usage: ./lcg-rec-lr -vo vlemed -cp /grid/vlemed/mydirectory | ./change-permissions.sh

Input: list of srm file locations

Description: Finds out on which SE the file is located. Sets the DPNS_HOST variable to this SE. Changes the permission with the command dpns-setacl. At the end of the script the original value for the DPNS_HOST variable is restored.

Download: change-permissions.sh

Replicating to a list of SEs

Parameter Meaning
$1 First VO
$2 Second SEs file
for example use this to create a file:
lcg-infosites --vo vlemed se -v 1 &gt; se.txt
$3 Third file url to replicate

Usage:

./lcg-rep-all.sh vlemed se.txt lfn:/grid/vlemed/AMC-e-BioScience/freesurfer/freesurfer.tar.gz

Download: lcg-rep-all.sh

Topic attachments
I Attachment Action Size Date Who Comment
Unix shell scriptsh change-permissions.sh manage 0.6 K 2010-12-06 - 13:26 BarberaVanSchaik change permission on srm level
Unix shell scriptsh get-outputs-jobs.sh manage 2.0 K 2009-11-26 - 14:47 MatthanCaan Get job outputs and stores in dirs with given names
Unix shell scriptsh lcg-rep-all.sh manage 0.4 K 2011-03-02 - 17:12 ShayanShahand lcg-rep-all.sh
Unix shell scriptsh submit-jobs-all-ces.sh manage 1.3 K 2009-05-26 - 16:15 SilviaOlabarriaga Submit the same job to all CEs
Unknown file formatjdl testMCR.jdl manage 0.2 K 2009-11-26 - 15:35 MatthanCaan JDL for testing presence of MCR module on grid nodes
Compressed Zip archivezip testMCRMatlab.zip manage 66.3 K 2009-11-27 - 11:28 MatthanCaan Test if matlab runs correctly on all CEs
Unix shell scriptsh testModule.sh manage 1.1 K 2009-05-26 - 16:02 SilviaOlabarriaga Program to test if a module is installed on the computer
Topic revision: r10 - 2011-03-02 - ShayanShahand
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback