CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
popcon2dropbox_job_conf.py
Go to the documentation of this file.
1 from __future__ import absolute_import
2 import FWCore.ParameterSet.Config as cms
3 import FWCore.ParameterSet.VarParsing as VarParsing
4 from . import popcon2dropbox
5 
7 options.register('targetFile',
8  'popcon.db',
9  VarParsing.VarParsing.multiplicity.singleton,
10  VarParsing.VarParsing.varType.string,
11  "the target sqlite file name")
12 options.register('destinationDatabase',
13  '',
14  VarParsing.VarParsing.multiplicity.singleton,
15  VarParsing.VarParsing.varType.string,
16  "the destination database connection string")
17 options.register('destinationTag',
18  '',
19  VarParsing.VarParsing.multiplicity.singleton,
20  VarParsing.VarParsing.varType.string,
21  "the destination tag name")
22 options.parseArguments()
23 
24 def setup_popcon( recordName, tagTimeType ):
25  psetForOutRec = []
26  psetForOutRec.append( cms.PSet( record = cms.string(str( recordName )),
27  tag = cms.string(str( options.destinationTag )),
28  timetype = cms.untracked.string(str(tagTimeType))
29  )
30  )
31 
32  sqliteConnect = 'sqlite:%s' %options.targetFile
33  process = cms.Process("PopCon")
34  process.load("CondCore.CondDB.CondDB_cfi")
35  process.CondDB.DBParameters.messageLevel = cms.untracked.int32( 3 )
36 
37  process.PoolDBOutputService = cms.Service("PoolDBOutputService",
38  DBParameters = cms.PSet( messageLevel = cms.untracked.int32( 3 ),
39  ),
40  connect = cms.string( sqliteConnect ),
41  toPut = cms.VPSet( psetForOutRec )
42  )
43 
44  process.source = cms.Source("EmptyIOVSource",
45  timetype = cms.string('runnumber'),
46  firstValue = cms.uint64(1),
47  lastValue = cms.uint64(1),
48  interval = cms.uint64(1)
49  )
50  return process
51 
52 def psetForRecord( recordName ):
53  psetForRec = []
54  psetForRec.append( cms.PSet( record = cms.string(str(recordName)),
55  tag = cms.string(str( options.destinationTag ))
56  )
57  )
58  return psetForRec
#define str(s)