-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaketask.csh
More file actions
executable file
·107 lines (93 loc) · 2.29 KB
/
maketask.csh
File metadata and controls
executable file
·107 lines (93 loc) · 2.29 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#! /bin/csh -f
echo $0 $*
if ($?WORKFLOW_ROOT) then
set WFDIR = $WORKFLOW_DATA
set WFCODE = $WORKFLOW_ROOT
else
echo Need WORKFLOW_ROOT variable to be set.
exit 1
endif
# Call with at least task, target, and task as key=value pairs
# e.g. maketasks.csh task=<taskname> target=<target> command=<command>
# Any of the following keywords can be set on the calling line.
# set defaults and collect args
set task = "NOT_SPECIFIED"
set parallelOK = 0
set maxrange = NaN #
set target = "NOT_SPECIFIED"
set retain = 1
set note = ""
set state = 0
set command = "NOT_SPECIFIED"
set manager = taskmanager.csh
while ( $#argv > 0)
foreach keyname (task parallelOK maxrange retain target note command manager )
if ($1 =~ $keyname=*) then
set $1
break
endif
end # foreach
shift
end #while
echo $task "$task"
if ("$task" == "NOT_SPECIFIED") then
echo task must be specified
exit
endif
if ("$target" == "NOT_SPECIFIED") then
echo product must be specified
exit
endif
if ("$command" == "NOT_SPECIFIED") then
echo command must be specified
exit
else if (!( -x $WFCODE/$command)) then
echo STOP - in task $task the command $command must be executable.
exit 1
endif
if ("$maxrange" == "NaN") then
echo maxrange must be specified
exit
endif
if (!( -x $WFCODE/$manager)) then
echo STOP - in task $task the taskmanager $manager must be executable.
exit 1
endif
set isdash = `echo $task | grep '-' | wc -l`
if ($isdash) then
echo STOP, the task name may not contain a dash, $task
exit
endif
set isdash = `echo $target | grep '-' | wc -l`
if ($isdash) then
echo STOP, the target gate name may not contain a dash, $target
exit
endif
set taskid = $task"-19930101-000"
cd $WFDIR
if (-e tasks/$task) then
echo task $task already exists, remove then repeat command
exit
endif
mkdir tasks/$task
cd tasks/$task
echo "$task" > task
echo "$parallelOK" > parallelOK
echo "$maxrange" > maxrange
echo "$retain" > retain
echo "$target" > target
echo "$note" > note
echo "$state" > state
echo "$taskid" > taskid
echo "$command" > command
echo "$manager" > manager
mkdir preconditions
mkdir active
mkdir done
mkdir archive
mkdir archive/ok
mkdir archive/failed
mkdir archive/logs
mkdir logs
# If and only if, completed OK task records are to be kept, uncomment the following
# touch DEBUG