forked from scooperstein/xrootd_scaletest
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_jobs
executable file
·83 lines (66 loc) · 1.85 KB
/
make_jobs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh
logerror() {
echo 2>&1 "$@"
}
check_proxy() {
hours=$1
proxy=$2
if ! [ -f "$proxy" ]; then
logerror
logerror "NOTE: No grid proxy found. (Expecting to find it here: $proxy.)"
return 1
fi
#Issue a warning if less than this many seconds remain:
min_proxy_lifetime=$((3600*$hours))
seconds_left="`voms-proxy-info --timeleft --file=$proxy 2>/dev/null`"
if [ "$seconds_left" = "" ]; then
echo "WARNING: cannot find time remaining for grid proxy."
voms-proxy-info -all -path $proxy
return 0
fi
if [ "$seconds_left" -lt "$min_proxy_lifetime" ]; then
logerror
logerror "NOTE: grid proxy is about to expire:"
logerror "voms-proxy-info"
voms-proxy-info --file=$proxy
return 1
fi
}
if [ "$#" != 3 ]; then
echo "USAGE: $0 jobs file_list url_prefix"
exit 2
fi
proxy=/tmp/x509up_u$UID
if ! check_proxy 2 $proxy; then
exit 1
fi
jobs="$1"
file_list="$2"
xrootd_URL_prefix="$3"
export TMPDIR=`pwd`
file_count=$(wc -l $file_list | awk '{print $1}')
files_per_job=$((file_count/jobs))
jobname=$(basename $file_list | sed 's|\.files||')-$(echo $xrootd_URL_prefix | sed 's|root://\([^/]*\).*|\1|')
sed "s|^|$xrootd_URL_prefix|" $file_list | sort -R > $jobname.randsort
rm -rf ${jobname}.jobs
mkdir ${jobname}.jobs
split --numeric-suffixes --suffix-length=4 --lines=$files_per_job ${jobname}.randsort ${jobname}.jobs/files
rm -f ${jobname}.randsort
for f in ${jobname}.jobs/files*; do
job=$(basename $f)
cat > ${jobname}.jobs/submit.$job <<EOF
executable = /afs/hep.wisc.edu/cms/sw/AAA/scaletest/xrootd_scaletest/xrd_test
arguments = $job 0.5
output = stdout.$job.\$(Cluster)
error = stderr.$job.\$(Cluster)
stream_output = true
stream_error = true
log = ulog
notification = never
should_transfer_files = yes
when_to_transfer_output = on_exit
transfer_input_files = $job
x509userproxy = $proxy
queue
EOF
done