ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerPbs.py
Revision: 1.3
Committed: Mon Sep 5 18:00:22 2011 UTC (13 years, 7 months ago) by mcinquil
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_8_2_pre2, CRAB_2_8_2_pre1, CRAB_2_8_1, CRAB_2_8_0, CRAB_2_8_0_pre1, CRAB_2_7_10_pre3, CRAB_2_7_9_patch2_pre1, CRAB_2_7_10_pre2, CRAB_2_7_10_pre1, CRAB_2_7_9_patch1, CRAB_2_7_9, CRAB_2_7_9_pre5, CRAB_2_7_9_pre4, CRAB_2_7_9_pre3
Changes since 1.2: +6 -2 lines
Log Message:
Changes to upgrade pbs_python plus adding epilogue to pbs_jobs - savannah #21633

File Contents

# Content
1 from Scheduler import Scheduler
2 from SchedulerLocal import SchedulerLocal
3 from crab_exceptions import *
4 from crab_util import *
5 import common
6
7 import os,string
8
9 # PBS/torque interface for CRAB (dave.newbold@cern.ch, June 09)
10 #
11 #
12 # In the [CRAB] section of crab.cfg, use:
13 #
14 # scheduler = pbs
15 #
16 # In the [PBS] section of crab.cfg, use the following optional parameters
17 #
18 # queue= pbs_queue_to_use [default, use the default queue in your local PBS config]
19 # resources = resource_1=value,resource_2=value, etc [like qsub -l syntax]
20 # wnBase = /tmp (top level directory where CRAB should unpack on worker nodes. $HOME is a bad default for many)
21 #
22 # NB: - the scheduler uses a wrapper script to create a local dir (see BossLite scheduler module)
23 # Both wrapper stdout/stderr and job script output files are placed in your crab_*/res directory by default
24 #
25
26 #
27 # Naming convention:
28 # methods starting with 'ws' are responsible to provide
29 # corresponding part of the job script ('ws' stands for 'write script').
30 #
31
32 class SchedulerPbs(SchedulerLocal) :
33
34 def __init__(self):
35 Scheduler.__init__(self,"PBS")
36
37 def configure(self, cfg_params):
38 SchedulerLocal.configure(self, cfg_params)
39 if "PBS.queue" in cfg_params:
40 if len(cfg_params["PBS.queue"]) == 0 or cfg_params["PBS.queue"] == "default":
41 common.logger.info(" The default queue of local PBS configuration will be used")
42 else:
43 common.logger.info(" The default queue of local PBS configuration will be used")
44
45 return
46
47
48 def envUniqueID(self):
49 id = "https://"+common.scheduler.name()+":/${PBS_JOBID}-"+ \
50 string.replace(common._db.queryTask('name'),"_","-")
51 return id
52
53 def realSchedParams(self,cfg_params):
54 """
55 Return dictionary with specific parameters, to use
56 with real scheduler
57 """
58
59 params={'jobScriptDir':common.work_space.jobDir(),
60 'jobResDir':common.work_space.resDir()
61 }
62
63 # update parameters
64 for s in ('resources', 'queue'):
65 params[s] = cfg_params.get( self.name().upper()+'.'+s,'' )
66
67 params['workDir'] = cfg_params.get(self.name().upper()+'.wnbase','')
68
69 return params
70
71 def listMatch(self, dest, full):
72 return [str(getLocalDomain(self))]
73
74 def wsCopyOutput(self):
75 return self.wsCopyOutput_comm()
76
77 def wsExitFunc(self):
78 """
79 """
80 s=[]
81 s.append('func_exit(){')
82 s.append(self.wsExitFunc_common())
83 s.append('tar zcvf '+common.work_space.resDir()+'${out_files}.tgz ${filesToCheck}')
84 s.append('exit $job_exit_code')
85 s.append('}')
86 return '\n'.join(s)
87
88 def envUniqueID(self):
89 id = "https://"+common.scheduler.name()+":/${PBS_JOBID}-"+ \
90 string.replace(common._db.queryTask('name'),"_","-")
91 return id
92