ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/PRODREQUEST/Applications/ProdRequestUtils.py
Revision: 1.1
Committed: Tue Dec 19 15:40:10 2006 UTC (18 years, 4 months ago) by eulisse
Content type: text/x-python
Branch: MAIN
CVS Tags: V00-01-00
Log Message:
First added to repository.

File Contents

# User Rev Content
1 eulisse 1.1 import os
2     import sys
3     import getopt
4     import popen2
5     import time
6    
7     from MCPayloads.WorkflowSpec import WorkflowSpec
8     from MCPayloads.LFNAlgorithm import unmergedLFNBase, mergedLFNBase
9     from CMSConfigTools.CfgInterface import CfgInterface
10     from MCPayloads.DatasetExpander import splitMultiTier
11     import MCPayloads.WorkflowTools as WorkflowTools
12     import MCPayloads.UUID as MCPayloadsUUID
13    
14     # Fixme: do the same for createProdWorkflow
15     def createPreProdWorkflow (pycfg = None,
16     psetHash = None,
17     prodName = None,
18     version = None,
19     category = "PreProd",
20     timestamp = int(time.time()),
21     fakeHash = False,
22     pileupDS = None,
23     pileupFilesPerJob = 1,
24     dbsAddress = None,
25     dbsUrl = None,
26     dlsAddress = None,
27     dlsType = None,
28     pileupSkipLocation = False):
29     spec = WorkflowSpec()
30     spec.setWorkflowName(prodName)
31     spec.setRequestCategory(category)
32     spec.setRequestTimestamp(timestamp)
33    
34     # //
35     # // This value was created by running the EdmConfigHash tool
36     # // on the original cfg file.
37    
38    
39     cmsRun = spec.payload
40     cmsRun.name = "cmsRun1" # every node in the workflow needs a unique name
41     cmsRun.type = "CMSSW" # Nodes that are CMSSW based should set the name
42     cmsRun.application["Project"] = "CMSSW" # project
43     cmsRun.application["Version"] = version # version
44     cmsRun.application["Architecture"] = "slc3_ia32_gcc323" # arch (not needed)
45     cmsRun.application["Executable"] = "cmsRun" # binary name
46     cmsRun.configuration = pycfg # Python PSet file
47    
48    
49     # //
50     # // Pileup sample?
51     # //
52     if pileupDS != None:
53     puPrimary = pileupDS.split("/")[1]
54     puTier = pileupDS.split("/")[2]
55     puProc = pileupDS.split("/")[3]
56     puDataset = cmsRun.addPileupDataset(puPrimary, puTier, puProc)
57     puDataset['FilesPerJob'] = pileupFilesPerJob
58     if customDBSDLS:
59     puDataset['DBSAddress'] = dbsAddress
60     puDataset['DBSURL'] = dbsUrl
61     puDataset['DLSType'] = dlsType
62     puDataset['DLSAddress'] = dlsAddress
63     if pileupSkipLocation:
64     puDataset['SkipLocation'] = pileupSkipLocation
65    
66     # //
67     # // Pull all the output modules from the configuration file,
68     #// treat the output module name as DataTier and AppFamily,
69     # //since there isnt a standard way to derive these things yet.
70     # //
71     #// For each module a dataset declaration is created in the spec
72     cfgInt = CfgInterface(cmsRun.configuration, True)
73     datasetList = []
74     for outModName, val in cfgInt.outputModules.items():
75     # //
76     # // Check for Multi Tiers.
77     #// If Output module contains - characters, we split based on it
78     # //And create a different tier for each basic tier
79     # //
80     #//
81    
82     tierList = splitMultiTier(outModName)
83     for dataTier in tierList:
84     processedDS = "%s-%s-%s-unmerged" % (
85     cmsRun.application['Version'], outModName, timestamp)
86     outDS = cmsRun.addOutputDataset(prodName,
87     processedDS,
88     outModName)
89    
90     outDS['DataTier'] = dataTier
91     outDS["ApplicationName"] = cmsRun.application["Executable"]
92     outDS["ApplicationProject"] = cmsRun.application["Project"]
93     outDS["ApplicationVersion"] = cmsRun.application["Version"]
94     outDS["ApplicationFamily"] = outModName
95     if fakeHash:
96     guid = MCPayloadsUUID.uuidgen()
97     if guid == None:
98     guid = MCPayloadsUUID.uuid()
99     hashValue = "hash=%s;guid=%s" % (psetHash, guid)
100     outDS['PSetHash'] = hashValue
101     else:
102     outDS['PSetHash'] = psetHash
103     datasetList.append(outDS.name())
104    
105     stageOut = cmsRun.newNode("stageOut1")
106     stageOut.type = "StageOut"
107     stageOut.application["Project"] = ""
108     stageOut.application["Version"] = ""
109     stageOut.application["Architecture"] = ""
110     stageOut.application["Executable"] = "RuntimeStageOut.py" # binary name
111     stageOut.configuration = ""
112    
113     mergedLFNBase(spec)
114     unmergedLFNBase(spec)
115    
116     return spec.makeIMProv().makeDOMElement().toprettyxml()