ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerGlidein.py
Revision: 1.16
Committed: Wed Jun 10 16:56:30 2009 UTC (15 years, 10 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_6_0_pre8
Changes since 1.15: +57 -40 lines
Log Message:
incorporate the JobRunCount environment (from Sanjay)

File Contents

# User Rev Content
1 spiga 1.16 #!/usr/bin/env python
2 ewv 1.14 """
3 spiga 1.16 _SchedulerGlidein_
4 ewv 1.14 """
5    
6 spiga 1.16 __revision__ = "$Id: SchedulerGlidein.py,v 1.11 2008/12/22 21:16:52 ewv Exp $"
7     __version__ = "$Revision: 1.11 $"
8 ewv 1.14
9 spiga 1.16 from ProdCommon.BossLite.Scheduler.SchedulerCondorCommon import SchedulerCondorCommon
10     import os
11 ewv 1.1
12 spiga 1.16 class SchedulerGlidein(SchedulerCondorCommon) :
13     """
14     basic class to handle glite jobs through wmproxy API
15     """
16     def __init__( self, **args ):
17    
18     # call super class init method
19     super(SchedulerGlidein, self).__init__(**args)
20    
21     def singleApiJdl( self, job, requirements='' ):
22     """
23     build a job jdl easy to be handled by the wmproxy API interface
24     and gives back the list of input files for a better handling
25     """
26    
27     jdl = 'Universe = vanilla\n'
28     superJdl, filelist, ce \
29     = super(SchedulerGlidein, self).singleApiJdl(job, requirements)
30     jdl += superJdl
31    
32     x509 = None
33     x509tmp = '/tmp/x509up_u'+str(os.getuid())
34     if 'X509_USER_PROXY' in os.environ:
35     x509 = os.environ['X509_USER_PROXY']
36     elif os.path.isfile(x509tmp):
37     x509 = x509tmp
38    
39     if x509:
40     jdl += 'x509userproxy = %s\n' % x509
41    
42     # Glidein parameters
43     jdl += 'Environment = JobRunCount=$$([ GJobRunCount ])\n'
44     jdl += '+GJobRunCount=ifThenElse(isUndefined(JobRunCount),0,JobRunCount)\n'
45     jdl += '+JOB_Site = "$$(GLIDEIN_Site:Unknown)" \n'
46     jdl += '+JOB_VM = "$$(Name:Unknown)" \n'
47     #jdl += '+JOB_Machine_KFlops = \"\$\$(KFlops:Unknown)\" \n");
48     #jdl += '+JOB_Machine_Mips = \"\$\$(Mips:Unknown)\" \n");
49     jdl += '+JOB_GLIDEIN_Schedd = "$$(GLIDEIN_Schedd:Unknown)" \n'
50     jdl += '+JOB_GLIDEIN_ClusterId = "$$(GLIDEIN_ClusterId:Unknown)" \n'
51     jdl += '+JOB_GLIDEIN_ProcId = "$$(GLIDEIN_ProcId:Unknown)" \n'
52     jdl += '+JOB_GLIDEIN_Factory = "$$(GLIDEIN_Factory:Unknown)" \n'
53     jdl += '+JOB_GLIDEIN_Name = "$$(GLIDEIN_Name:Unknown)" \n'
54     jdl += '+JOB_GLIDEIN_Frontend = "$$(GLIDEIN_Client:Unknown)" \n'
55     jdl += '+JOB_Gatekeeper = "$$(GLIDEIN_Gatekeeper:Unknown)" \n'
56     jdl += '+JOB_GridType = "$$(GLIDEIN_GridType:Unknown)" \n'
57     jdl += '+JOB_GlobusRSL = "$$(GLIDEIN_GlobusRSL:Unknown)" \n'
58     jdl += 'since=(CurrentTime-EnteredCurrentStatus)\n'
59     jdl += 'Periodic_Remove = (((JobStatus == 2) && ((CurrentTime - JobCurrentStartDate) > (MaxWallTimeMins*60))) =?= True) || '
60     jdl += '(JobStatus==5 && $(since)>691200) || (JobStatus==1 && $(since)>691200)\n'
61 ewv 1.11
62 spiga 1.16
63     return jdl, filelist, 'Unknown'