ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/PRODREQUEST/Applications/ProdRequestUtils.py
Revision: 1.2
Committed: Thu Jan 11 17:18:11 2007 UTC (18 years, 3 months ago) by eulisse
Content type: text/x-python
Branch: MAIN
CVS Tags: V00-04-02, V00-04-01, V00-04-00, V00-03-14, V00-03-13, V00-03-12, V00-03-11, V00-03-10, V00-03-09, V00-03-08, V00-03-07, V00-03-06, V00-03-05, V00-03-04, V00-03-03, V00-03-02, V00-03-01, V00-03-00, V00-02-00
Changes since 1.1: +26 -14 lines
Log Message:
New version of PRODREQUEST, synced from my personal subversion repository.

- Integration with a local PRODMANAGER. Now it's actually able to submit jobs.
- Better integration with DBS (couple of bug fixed).
- Removal of legacy js stuff (old IGUANA stuff)
- New "Home" page.
- Integrated with WEBTOOLS masthead and css.
- Several bug fixes.

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