File indexing completed on 2024-04-06 12:02:43
0001 import sqlite3
0002 import json
0003 import subprocess
0004 import shutil
0005
0006
0007 conn = sqlite3.connect('test_myTagName.db')
0008 cursor = conn.cursor()
0009
0010
0011 cursor.execute('SELECT * FROM IOV')
0012
0013
0014 results = cursor.fetchall()
0015
0016
0017 extracted_values = []
0018
0019
0020 for row in results:
0021 value = row[0].split('|')[0].strip()
0022 extracted_values.append(value)
0023
0024
0025 conn.close()
0026
0027
0028 for value in extracted_values:
0029 print("uploading",value)
0030
0031 data = {
0032 "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS",
0033 "destinationTags": {
0034 "SimBeamSpot_" + value + "_v1_mc": {}
0035 },
0036 "inputTag": value,
0037 "since": None,
0038 "userText": value
0039 }
0040
0041
0042 filename = "test_myTagName.txt"
0043 with open(filename, 'w') as file:
0044 json.dump(data, file, indent=4)
0045
0046
0047 subprocess.call(["uploadConditions.py", "test_myTagName.db"])
0048
0049
0050 new_filename = "test_" + value + ".txt"
0051
0052
0053 shutil.move(filename, new_filename)
0054
0055
0056 print("Uploaded conditions for value:", value)