ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/proj/workflow/maketask.csh
Revision: 1.3
Committed: Thu Feb 24 04:31:13 2011 UTC (12 years, 7 months ago) by phil
Content type: application/x-csh
Branch: MAIN
CVS Tags: Ver_6-0, Ver_6-1, Ver_6-2, Ver_6-3, Ver_6-4, Ver_9-1, Ver_5-14, Ver_5-13, Ver_LATEST, Ver_9-3, Ver_9-41, Ver_9-2, Ver_8-8, Ver_8-2, Ver_8-3, Ver_8-0, Ver_8-1, Ver_8-6, Ver_8-7, Ver_8-4, Ver_8-5, Ver_7-1, Ver_7-0, Ver_9-5, Ver_9-4, Ver_8-10, Ver_8-11, Ver_8-12, Ver_9-0, HEAD
Changes since 1.2: +2 -0 lines
Log Message:
misc, and new gatekeeper.restart

File Contents

# Content
1 #! /bin/csh -f
2
3 echo $0 $*
4
5 if ($?WORKFLOW_ROOT) then
6 set WFDIR = $WORKFLOW_DATA
7 set WFCODE = $WORKFLOW_ROOT
8 else
9 echo Need WORKFLOW_ROOT variable to be set.
10 exit 1
11 endif
12
13 # Call with at least task, target, and task as key=value pairs
14 # e.g. maketasks.csh task=<taskname> target=<target> command=<command>
15 # Any of the following keywords can be set on the calling line.
16
17 # set defaults and collect args
18
19 set task = "NOT_SPECIFIED"
20 set parallelOK = 0
21 set maxrange = NaN #
22 set target = "NOT_SPECIFIED"
23 set retain = 1
24 set note = ""
25 set state = 0
26 set command = "NOT_SPECIFIED"
27 set manager = taskmanager.csh
28
29 while ( $#argv > 0)
30 foreach keyname (task parallelOK maxrange retain target note command manager )
31 if ($1 =~ $keyname=*) then
32 set $1
33 break
34 endif
35 end # foreach
36 shift
37 end #while
38
39 echo $task "$task"
40 if ("$task" == "NOT_SPECIFIED") then
41 echo task must be specified
42 exit
43 endif
44 if ("$target" == "NOT_SPECIFIED") then
45 echo product must be specified
46 exit
47 endif
48 if ("$command" == "NOT_SPECIFIED") then
49 echo command must be specified
50 exit
51 else if (!( -x $WFCODE/$command)) then
52 echo STOP - in task $task the command $command must be executable.
53 exit 1
54 endif
55 if ("$maxrange" == "NaN") then
56 echo maxrange must be specified
57 exit
58 endif
59 if (!( -x $WFCODE/$manager)) then
60 echo STOP - in task $task the taskmanager $manager must be executable.
61 exit 1
62 endif
63
64 set isdash = `echo $task | grep '-' | wc -l`
65 if ($isdash) then
66 echo STOP, the task name may not contain a dash, $task
67 exit
68 endif
69
70 set isdash = `echo $target | grep '-' | wc -l`
71 if ($isdash) then
72 echo STOP, the target gate name may not contain a dash, $target
73 exit
74 endif
75
76 set taskid = $task"-19930101-000"
77
78 cd $WFDIR
79 if (-e tasks/$task) then
80 echo task $task already exists, remove then repeat command
81 exit
82 endif
83 mkdir tasks/$task
84 cd tasks/$task
85
86 echo "$task" > task
87 echo "$parallelOK" > parallelOK
88 echo "$maxrange" > maxrange
89 echo "$retain" > retain
90 echo "$target" > target
91 echo "$note" > note
92 echo "$state" > state
93 echo "$taskid" > taskid
94 echo "$command" > command
95 echo "$manager" > manager
96
97 mkdir preconditions
98 mkdir active
99 mkdir done
100 mkdir archive
101 mkdir archive/ok
102 mkdir archive/failed
103 mkdir archive/logs
104 mkdir logs
105
106 # If and only if, completed OK task records are to be kept, uncomment the following
107 # touch DEBUG