ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerCondor.py
Revision: 1.3
Committed: Tue May 27 22:03:29 2008 UTC (16 years, 11 months ago) by ewv
Content type: text/x-python
Branch: MAIN
CVS Tags: PRODCOMMON_0_10_7_testCS2
Changes since 1.2: +39 -2 lines
Log Message:
Fix isCreating crash on undefined, add exit function for vanilla condor

File Contents

# User Rev Content
1 ewv 1.3 __revision__ = "$Id: SchedulerCondor.py,v 1.2 2008/05/21 19:27:30 ewv Exp $"
2     __version__ = "$Revision: 1.2 $"
3 ewv 1.1
4     from Scheduler import Scheduler
5     from SchedulerLocal import SchedulerLocal
6     from crab_exceptions import *
7     from crab_util import *
8     from crab_logger import Logger
9     import common
10    
11     import os
12    
13     # Naming convention:
14     # methods starting with 'ws' are responsible to provide
15     # corresponding part of the job script ('ws' stands for 'write script').
16    
17     class SchedulerCondor(SchedulerLocal) :
18    
19     def __init__(self):
20     Scheduler.__init__(self,"CONDOR")
21     return
22    
23 ewv 1.3
24 ewv 1.1 def configure(self, cfg_params):
25     SchedulerLocal.configure(self, cfg_params)
26     self.environment_unique_identifier ='${HOSTNAME}_${CONDOR_ID}_' + common._db.queryTask('name')
27     return
28    
29 ewv 1.3
30 ewv 1.1 def sched_parameter(self,i,task):
31     """
32     Return scheduler-specific parameters
33     """
34     index = int(common._db.nJobs()) - 1
35     sched_param= ''
36    
37     for i in range(index):
38     pass
39    
40     return sched_param
41    
42 ewv 1.3
43 ewv 1.2 def realSchedParams(self,cfg_params):
44     """
45     Return dictionary with specific parameters, to use
46     with real scheduler
47     """
48    
49     tmpDir = os.path.join(common.work_space.shareDir(),'.condor_temp')
50     params = {'tmpDir':tmpDir}
51     return params
52    
53 ewv 1.3
54 ewv 1.1 def loggingInfo(self, id):
55     """ return logging info about job nj """
56     cmd = 'something'
57     #cmd_out = runCommand(cmd)
58     return ''
59 ewv 1.3
60    
61     def wsExitFunc(self):
62     """
63     """
64     txt = '\n'
65     txt += '#\n'
66     txt += '# EXECUTE THIS FUNCTION BEFORE EXIT \n'
67     txt += '#\n\n'
68    
69     txt += 'func_exit() { \n'
70     txt += ' if [ $PYTHONPATH ]; then \n'
71     txt += ' update_fjr\n'
72     txt += ' fi\n'
73     txt += ' for file in $filesToCheck ; do\n'
74     txt += ' if [ -e $file ]; then\n'
75     txt += ' echo "tarring file $file in $out_files"\n'
76     txt += ' else\n'
77     txt += ' echo "WARNING: output file $file not found!"\n'
78     txt += ' fi\n'
79     txt += ' done\n'
80     txt += ' final_list=$filesToCheck\n'
81     txt += ' echo "JOB_EXIT_STATUS = $job_exit_code"\n'
82     txt += ' echo "JobExitCode=$job_exit_code" >> $RUNTIME_AREA/$repo\n'
83     txt += ' dumpStatus $RUNTIME_AREA/$repo\n'
84     txt += ' tar zcvf ${out_files}.tgz ${final_list}\n'
85     txt += ' cp ${out_files}.tgz $ORIG_WD/\n'
86     txt += ' cp crab_fjr_$NJob.xml $ORIG_WD/\n'
87    
88     txt += ' exit $job_exit_code\n'
89     txt += '}\n'
90    
91     return txt