Created
July 26, 2019 07:43
-
-
Save mmusich/7ed30362770d11299f8aad5235cb5871 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from os import listdir | |
from os.path import isfile, join | |
def writeMetaData(iovs): | |
script="""{{ | |
"destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", | |
"destinationTags": {{ | |
"SiPixelQuality_v07_offline": {{}} | |
}}, | |
"inputTag": "SiPixelQuality_v07_offline", | |
"since": null, | |
"userText": "append IOVs {iovs} to SiPixelQuality_v07_offline" | |
}}""".format(iovs=iovs) | |
return script | |
def main(): | |
mypath="." | |
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] | |
#print onlyfiles | |
for file in onlyfiles: | |
if file.endswith(".db"): | |
tokens=file.split(".")[0].split("_") | |
iovs=tokens[len(tokens)-1]+":"+tokens[len(tokens)-2] | |
#print iovs | |
metadataFileName = file.replace(".db",".txt") | |
print metadataFileName | |
metadataFile = open(metadataFileName,'w') | |
metadataFile.write( writeMetaData(iovs) ) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment