1 |
sekhri |
1.1 |
|
2 |
|
|
import dbsclient
|
3 |
|
|
|
4 |
|
|
client = dbsclient.DBSClient()
|
5 |
|
|
def stringp(inStr) :
|
6 |
|
|
return client.str(inStr)
|
7 |
|
|
|
8 |
|
|
def delStringp(inStr) :
|
9 |
|
|
dbsclient.delete_stringp(inStr)
|
10 |
|
|
|
11 |
|
|
def string(key) :
|
12 |
|
|
return dbsclient.ASTR(key)
|
13 |
|
|
|
14 |
|
|
def integer(key) :
|
15 |
|
|
return dbsclient.AINT(key)
|
16 |
|
|
|
17 |
|
|
def character(key) :
|
18 |
|
|
return dbsclient.ACHR(key)
|
19 |
|
|
|
20 |
|
|
def setStrValue(aRow, key, value) :
|
21 |
|
|
if(value != None and key != None):
|
22 |
|
|
key = stringp(key)
|
23 |
|
|
aRow.setValue(key, string(value))
|
24 |
|
|
delStringp(key)
|
25 |
|
|
|
26 |
|
|
def setIntValue(aRow, key, value) :
|
27 |
|
|
key = stringp(key)
|
28 |
|
|
aRow.setValue(key, integer(int(value)))
|
29 |
|
|
delStringp(key)
|
30 |
|
|
|
31 |
|
|
def setChrValue(aRow, key, value) :
|
32 |
|
|
key = stringp(key)
|
33 |
|
|
aRow.setValue(key, character(value))
|
34 |
|
|
delStringp(key)
|
35 |
|
|
|
36 |
|
|
def getStrValue(table, key, index) :
|
37 |
|
|
if(index != None and key != None):
|
38 |
|
|
if(index > -1) :
|
39 |
|
|
key = stringp(key)
|
40 |
|
|
value = table.getStrValue(index, key)
|
41 |
|
|
delStringp(key)
|
42 |
|
|
return value
|
43 |
afaq |
1.2 |
def writeFile():
|
44 |
|
|
|
45 |
|
|
table = dbsclient.FileviewMultiTable()
|
46 |
|
|
aRow = dbsclient.Fileviewmultirow()
|
47 |
|
|
fileVector = dbsclient.FileVector()
|
48 |
|
|
|
49 |
|
|
setStrValue(aRow, "t_file_status.name", "afile")
|
50 |
|
|
setStrValue(aRow, "t_file.guid", "Test-1234-Guid")
|
51 |
|
|
setStrValue(aRow, "t_file.checksum", "1234")
|
52 |
|
|
setStrValue(aRow, "t_file.logical_name", "afilexgetLogicalFileNamex")
|
53 |
|
|
setIntValue(aRow, "t_file.inblock", 10)
|
54 |
|
|
setStrValue(aRow, "t_file_type.name", "ROOT_All")
|
55 |
|
|
setStrValue(aRow, "t_file.filesize", "sucks")
|
56 |
|
|
setIntValue(aRow, "t_evcoll_file.evcoll", 1840)
|
57 |
|
|
fileVector.push_back(aRow)
|
58 |
|
|
client.insertFiles(fileVector, table)
|
59 |
|
|
|
60 |
sekhri |
1.1 |
|
61 |
|
|
|
62 |
|
|
def writePrimary() :
|
63 |
|
|
aRow = dbsclient.Primarydatasetmultirow()
|
64 |
|
|
table = dbsclient.PrimarydatasetMultiTable()
|
65 |
|
|
|
66 |
|
|
setStrValue(aRow, "t_desc_mc.description", "dummy_value")
|
67 |
|
|
setStrValue(aRow, "t_desc_trigger.description", "t_desc_trigger.descriptiondummy_value")
|
68 |
|
|
setStrValue(aRow, "t_desc_mc.decay_chain", "dummyt_desc_mc.decay_chain")
|
69 |
|
|
setStrValue(aRow, "t_desc_mc.production", "dummyt_desc_mc.production")
|
70 |
|
|
setStrValue(aRow, "t_physics_group.name", "t_physics_group.namedummy_value")
|
71 |
|
|
setChrValue(aRow, "t_desc_primary.is_mc_data", "y")
|
72 |
|
|
|
73 |
|
|
a = client.createPrimaryDataset(aRow, table)
|
74 |
|
|
print "ID is ",a
|
75 |
|
|
#key = stringp("t_primary_dataset.id")
|
76 |
|
|
#print "table.getStrValue ", table.getStrValue(0,key)
|
77 |
|
|
#delStringp(key)
|
78 |
|
|
|
79 |
|
|
def readPrimary() :
|
80 |
|
|
aRow = dbsclient.Primarydatasetmultirow()
|
81 |
|
|
table = dbsclient.PrimarydatasetMultiTable()
|
82 |
|
|
setStrValue(aRow, "t_desc_mc.description", "dummy_value")
|
83 |
|
|
|
84 |
|
|
client.readPrimaryDataset(aRow, table)
|
85 |
|
|
noOfRows = table.getNoOfRows()
|
86 |
|
|
print "no of Rows ",noOfRows
|
87 |
|
|
for j in range(noOfRows) :
|
88 |
|
|
print "table.getStrValue", getStrValue(table, "t_desc_mc.description", j)
|
89 |
|
|
table.dispose()
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
def writeProcessed() :
|
93 |
|
|
aRow = dbsclient.Processingpathmultirow()
|
94 |
|
|
table = dbsclient.ProcessingpathMultiTable()
|
95 |
|
|
|
96 |
|
|
setStrValue(aRow, "t_processed_dataset.name", "dummy_valuet_processed_dataset.name")
|
97 |
|
|
setStrValue(aRow, "t_app_family.name", "dummyvaluet_app_family.name")
|
98 |
|
|
setStrValue(aRow, "t_data_tier.name", "t_data_tier.namedummy_value")
|
99 |
|
|
setStrValue(aRow, "t_application.executable", "t_application.executablemmy_value")
|
100 |
|
|
setStrValue(aRow, "t_app_config.parameter_set", "dummyt_app_config.parameter_set")
|
101 |
|
|
setChrValue(aRow, "t_processed_dataset.is_open", "y")
|
102 |
|
|
setStrValue(aRow, "t_application.app_version", "dummyt_application.app_version")
|
103 |
|
|
setStrValue(aRow, "t_app_config.conditions_version", "dummyt_app_config.conditions_version")
|
104 |
|
|
setStrValue(aRow, "t_processing_path.full_path", "dummyt_processing_path.full_path")
|
105 |
|
|
setStrValue(aRow, "t_primary_dataset.name", "t_primary_dataset.name")
|
106 |
|
|
setStrValue(aRow, "t_collection_type.name.t_application.output_type", "dummyt_collection_type.name.t_application.output_type")
|
107 |
|
|
setStrValue(aRow, "t_collection_type.name.t_application.input_type", "dummyt_collection_type.name.t_application.input_type")
|
108 |
|
|
|
109 |
|
|
a = client.createProcessedDataset(aRow, table)
|
110 |
|
|
print "ID is ",a
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
def readProcessed() :
|
114 |
|
|
aRow = dbsclient.Processingpathmultirow()
|
115 |
|
|
table = dbsclient.ProcessingpathMultiTable()
|
116 |
|
|
|
117 |
|
|
setStrValue(aRow, "t_primary_dataset.name", "t_primary_dataset.name")
|
118 |
|
|
|
119 |
|
|
client.readProcessedDataset(aRow, table)
|
120 |
|
|
noOfRows = table.getNoOfRows()
|
121 |
|
|
print "no of Rows ",noOfRows
|
122 |
|
|
for j in range(noOfRows) :
|
123 |
|
|
print "table.getStrValue", getStrValue(table, "t_primary_dataset.name", j)
|
124 |
|
|
table.dispose()
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
def writeEC() :
|
128 |
|
|
aRow = dbsclient.Processingpathmultirow()
|
129 |
|
|
table = dbsclient.ProcessingpathMultiTable()
|
130 |
|
|
|
131 |
|
|
setStrValue(aRow, "t_processed_dataset.name", "dummy_valuet_processed_dataset.name")
|
132 |
|
|
|
133 |
|
|
def readCrabEC() :
|
134 |
|
|
aRow = dbsclient.Crabevcollviewmultirow()
|
135 |
|
|
table = dbsclient.CrabevcollviewMultiTable()
|
136 |
|
|
|
137 |
|
|
setIntValue(aRow, "t_block.id", 270)
|
138 |
|
|
|
139 |
|
|
client.readCrabEC(aRow, table)
|
140 |
|
|
noOfRows = table.getNoOfRows()
|
141 |
|
|
print "no of Rows ",noOfRows
|
142 |
|
|
for j in range(noOfRows) :
|
143 |
|
|
print "table.getStrValue", getStrValue(table, "t_info_evcoll.name", j)
|
144 |
|
|
table.dispose()
|
145 |
|
|
|
146 |
|
|
#while(1):
|
147 |
|
|
for i in range(1) :
|
148 |
afaq |
1.2 |
#readPrimary()
|
149 |
sekhri |
1.1 |
#writePrimary()
|
150 |
|
|
#writeProcessed()
|
151 |
|
|
#readProcessed()
|
152 |
|
|
#readCrabEC()
|
153 |
afaq |
1.2 |
writeFile()
|