Home | Trees | Indices | Help |
---|
|
1 ############################################################################### 2 # Ganga Project. http://cern.ch/ganga 3 # 4 # $Id: GenericSplitter.py,v 1.2 2008-09-09 15:11:35 moscicki Exp $ 5 ############################################################################### 6 7 import inspect 8 9 from Ganga.GPIDev.Adapters.ISplitter import ISplitter 10 from Ganga.GPIDev.Schema import * 1113 14 """ 15 Split job by changing arbitrary job attribute. 16 17 This splitter allows the creation of a series of subjobs where 18 the only difference between different jobs can be defined by giving 19 the "attribute" and "values" of the splitter object. 20 21 For example, to split a job according to the given application arguments: 22 23 s = GenericSplitter() 24 s.attribute = 'application.args' 25 s.values = [["hello","1"],["hello","2"]] 26 ... ... 27 j = Job(splitter=s) 28 j.submit() 29 30 To split a job into two LCG jobs running on two different CEs: 31 32 s = GenericSplitter() 33 s.attribute = 'backend.CE' 34 s.value = ["quanta.grid.sinica.edu.tw:2119/jobmanager-lcgpbs-atlas","lcg00125.grid.sinica.edu.tw:2119/jobmanager-lcgpbs-atlas"] 35 ... ... 36 j = Job(backend=LCG(),splitter=s) 37 j.submit() 38 39 Known issues of this generic splitter: 40 - it will not work if specifying different backends for the subjobs 41 42 """ 43 _name = "GenericSplitter" 44 _schema = Schema(Version(1,0), { 45 'attribute' : SimpleItem(defvalue='',doc='The attribute on which the job is splitted'), 46 'values' : SimpleItem(defvalue=[],typelist=None,checkset="_checkset_values",sequence=1,doc='A list of the values corresponding to the attribute of the subjobs') 47 } ) 4874 # 75 # 76 # $Log: not supported by cvs2svn $ 77 # Revision 1.1 2008/07/17 16:41:00 moscicki 78 # migration of 5.0.2 to HEAD 79 # 80 # the doc and release/tools have been taken from HEAD 81 # 82 # Revision 1.3.4.3 2008/07/03 08:36:16 wreece 83 # Typesystem fix for Splitters 84 # 85 # Revision 1.3.4.2 2008/03/12 12:42:38 wreece 86 # Updates the splitters to check for File objects in the list 87 # 88 # Revision 1.3.4.1 2008/02/06 17:04:58 moscicki 89 # disabled type checking for GenericSplitter 90 # 91 # Revision 1.3 2007/07/10 13:08:32 moscicki 92 # docstring updates (ganga devdays) 93 # 94 # Revision 1.2 2007/01/25 16:25:59 moscicki 95 # mergefrom_Ganga-4-2-2-bugfix-branch_25Jan07 (GangaBase-4-14) 96 # 97 # Revision 1.1.2.2 2006/10/30 16:15:47 hclee 98 # change the in-code documentation 99 # 100 # Revision 1.1.2.1 2006/10/30 16:10:51 hclee 101 # Add GenericSplitter 102 # 103 # 104 # 10550 self._checksetNestedLists(value) 51 # TODO: here we may implement advanced validation of type against the type of selected attribute 52 pass5355 56 subjobs = [] 57 58 for value in self.values: 59 60 j = self.createSubjob(job) 61 62 attrs = self.attribute.split('.') 63 obj = j 64 for attr in attrs[:-1]: 65 obj = getattr(obj,attr) 66 attr = attrs[-1] 67 68 setattr(obj,attr,value) 69 70 logger.debug('set %s = %s to subjob.' % (self.attribute,getattr(obj,attr))) 71 subjobs.append(j) 72 73 return subjobs
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Jun 25 10:35:28 2012 | http://epydoc.sourceforge.net |