-
Notifications
You must be signed in to change notification settings - Fork 7
/
create-export-jobs
executable file
·71 lines (55 loc) · 1.73 KB
/
create-export-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
#!/bin/bash
# Export overlapping chunks that were independently aligned with a
# transformation that is the linear interpolant of both independently
# estimated transformations in the overlapping range, weights run from 0-1
# across the range.
#
# Call:
# ./create-export-job <file-list> [<chunk-size> <export-dir> <project-base-dir> <num-jobs>]
# Defaults:
# chunks-size: 100
# export-dir: $PWD
# project-base-dir: $PWD
# num-jobs 500
if [ $# -lt 2 ]; then
echo "Usage: $0 <file-list> [<chunk-size=100> <export-dir=$PWD> <project-base-dir=$PWD> <numJobs=500>]"
exit 1
fi
n=`wc -l < ${1}`
mod=${2:-100}
exportDir="${3:-$PWD}"
projectBaseDir="${4:-$PWD}"
numJobs="${5:-500}"
step=$(($mod/2))
first=0
last=$(($n-1))
numTasks=$[$n/$mod]
numTasks=$[2*$numTasks]
tasksPerJob=$[$numTasks/$numJobs]
#echo "numJobs $numJobs"
#echo "numTasks $numTasks"
#echo "tasks per job: $tasksPerJob"
j=1
k=0
mkdir -p jobs
mkdir -p export
job="jobs/export-project-intersection-$k"
echo "#!/bin/bash" > $job
#for i in `seq $first $step $(($last-3*$step))`
for i in `seq $first $step $(($last-$step))`
do
if [ $j -ge $tasksPerJob ]; then
chmod a+x $job # make the previous job executable
j=0
((k++))
job="jobs/export-project-intersection-$k"
echo "#!/bin/bash" > $job
fi
range="$i-$(($i+3*$step-1))"
range1="$i-$(($i+2*$step-1))"
range2="$(($i+$step))-$(($i+3*$step-1))"
echo "${HOME}/bin/xvfb-run -a ${HOME}/packages/Fiji.app/fiji-linux64 -Xms10g -Xmx10g -Ddir1=$projectBaseDir/$range1 -Ddir2=$projectBaseDir/$range2 -Dexport=$exportDir/export -- --no-splash $projectBaseDir/open-and-export-project-intersection.bsh" >> $job
#chmod a+x $job
((j++))
done
chmod a+x $job # make the last job executable