#!/bin/bash # WLCG Worker Node Environment # PBS Prologue script: clean up the $JOBFEATURES file` # # Config settings for the wlcg-wn-env scripts # # Copyright (c) 2012 by # Jan Just Keijser (janjust@nikhef.nl) # Nikhef # Amsterdam # The Netherlands # a PBS user prologue script is called with up to 7 parameters, out of which we # are only interesed in $1 and $5: # $1 = jobid # $5 = job specifics such as cputime and walltime # e.g. cput=04:00:00,neednodes=1,nodes=1,pvmem=400mb,walltime=04:00:00 # overrule any environment variable setting with the parameter supplied to the script PBS_JOBID=$1 # Get the configuration setting from the /etc/wlcg-wn-env.conf file eval "JOBFEATURES=`sed -n '/^jobfeatures/s/^jobfeatures *= *\(.*\)/\1/p' /etc/wlcg-wn-env.conf 2> /dev/null`" # fallback if setting is missing JOBFEATURES=${TMPDIR:-/tmp}/jobfeatures.${PBS_JOBID} jobstart=`date --utc` cpu_lim=`echo "$5" | cut -d, -f1 | cut -d= -f2 | awk -F: '{ cpu_lim=3600*$1+60*$2+$3 ; printf "%d\n", cpu_lim }'` wall_lim=`echo "$5" | cut -d, -f5 | cut -d= -f2 | awk -F: '{ wall_lim=3600*$1+60*$2+$3 ; printf "%d\n", wall_lim }'` echo "jobstart=${jobstart}" > ${JOBFEATURES} echo "cpu_limit=${cpu_lim}" >> ${JOBFEATURES} echo "wall_limit=${wall_lim}" >> ${JOBFEATURES}