示例#1
0
文件: scaneos.py 项目: anantoni/CMG
#!/bin/env python



from CMGTools.Production.cmgdbApi import CmgdbApi
import CMGTools.Production.eostools as eos
import pprint

db = CmgdbApi()
db.connect()

cols, rows = db.sql("select path_name, file_owner, number_files_bad, number_files_good from dataset_details where path_name like '%V5_4_0'")
# pprint.pprint(rows)

dead = []
good = []

nscanned = 0
for row in rows:
    # print row
    path = row[0]
    owner = row[1]
    nFiles = None
    if row[2] is not None and row[3] is not None:
        nFiles = row[2]+row[3]
    print path, nFiles
    dir = None
    if owner == 'cmgtools_group':
        dir = '/eos/cms/store/cmst3/group/cmgtools/CMG'+path
    elif owner == 'cmgtools':
        dir = '/eos/cms/store/cmst3/user/cmgtools/CMG'+path  
示例#2
0
                      dest="development",
                      default=False,
                      help="Publish on official or test database")

    (options, args) = parser.parse_args()

    # If there are no options selected exit.
    if options.sql is None and options.alias is None:
        parser.print_help()
        sys.exit(1)
    # Allow no less than one argument
    if len(args) < 1:
        parser.print_help()
        sys.exit(1)

    cmgdbApi = CmgdbApi(options.development)
    cmgdbApi.connect()
    description = cmgdbApi.describe()
    parser.usage = """
Table Structure:
""" + description + """

The database server being used is Oracle 11g, so a good idea would be to become farmiliar with the Oracle 11g query semantics.

Here are some example queries explained:
    If you want to get a list of tags that were used by cmgtools on the 7th March 2012, 
    - You will have to first make sure that you use the distinct() method to prevent repetitions
    - Once you have specified the information you want, you will then need to perform a join with the tags_in_sets table on tag_id
    - From the product of this join you then want to join with the dataset_details table, this time on tagset_id
    - You then specify the WHERE clause as where file_owner = 'cmgtools and the date...
    - To give the results of the entire day, you must do two things,
示例#3
0
                      default=False,
                      help="Publish on official or test database"
                      )

    (options, args) = parser.parse_args()
    
    # If there are no options selected exit.
    if options.sql is None and options.alias is None:
        parser.print_help()
        sys.exit(1)
    # Allow no less than one argument
    if len(args)<1:
        parser.print_help()
        sys.exit(1)

    cmgdbApi = CmgdbApi(options.development)
    cmgdbApi.connect()
    description = cmgdbApi.describe()
    parser.usage = """
Table Structure:
"""+description+"""

The database server being used is Oracle 11g, so a good idea would be to become farmiliar with the Oracle 11g query semantics.

Here are some example queries explained:
    If you want to get a list of tags that were used by cmgtools on the 7th March 2012, 
    - You will have to first make sure that you use the distinct() method to prevent repetitions
    - Once you have specified the information you want, you will then need to perform a join with the tags_in_sets table on tag_id
    - From the product of this join you then want to join with the dataset_details table, this time on tagset_id
    - You then specify the WHERE clause as where file_owner = 'cmgtools and the date...
    - To give the results of the entire day, you must do two things,
示例#4
0
import sys
import pprint
import os
import re
import operator
import subprocess
import re

from CMGTools.Production.cmgdbApi import CmgdbApi
from CMGTools.RootTools.utils.getFiles import getFiles

db = CmgdbApi()
db.connect()


def findFirstAncestor(dataset_id, info):
    cols, rows = db.sql(
        "select parent_dataset_id, path_name, primary_dataset_entries, number_total_jobs, task_id, dataset_entries FROM dataset_details where dataset_id={dataset_id}"
        .format(dataset_id=dataset_id))
    if len(rows) == 0:
        print 'cannot find dataset with id', dataset_id
    elif len(rows) > 1:
        assert (False)
    else:
        parent_id = rows[0][0]
        groups = [
            'tauMu_fullsel_tree_CMG', 'tauMu_fullsel_tree',
            'tauEle_fullsel_tree_CMG', 'tauEle_fullsel_tree',
            'diTau_fullsel_tree_CMG', 'diTau_fullsel_tree', 'cmgTuple',
            'htt_fullsel_tree_CMG', 'htt_fullsel_tree', 'PFAOD'
        ]
示例#5
0
os.system(
    "source /afs/cern.ch/cms/slc5_amd64_gcc434/external/oracle/11.2.0.1.0p2/etc/profile.d/init.sh"
)
os.system(
    "source /afs/cern.ch/cms/slc5_amd64_gcc434/external/python/2.6.4-cms16/etc/profile.d/init.sh"
)
os.system(
    "source /afs/cern.ch/cms/slc5_amd64_gcc434/external/py2-cx-oracle/5.1/etc/profile.d/init.sh"
)
import CMGTools.Production.cx_Oracle as cx_Oracle
from CMGTools.Production.cmgdbApi import CmgdbApi

# Make sure is being used as a script
if __name__ == '__main__':
    parser = optparse.OptionParser()
    cmgdbApi = CmgdbApi()
    cmgdbApi.connect()
    description = cmgdbApi.describe()
    parser.usage = """
Table Structure:
""" + description + """

The database server being used is Oracle 11g, so a good idea would be to become farmiliar with the Oracle 11g query semantics.

Here are some example queries explained:
    If you want to get a list of tags that were used by cmgtools on the 7th March 2012, 
    - You will have to first make sure that you use the distinct() method to prevent repetitions
    - Once you have specified the information you want, you will then need to perform a join with the tags_in_sets table on tag_id
    - From the product of this join you then want to join with the dataset_details table, this time on tagset_id
    - You then specify the WHERE clause as where file_owner = 'cmgtools and the date...
    - To give the results of the entire day, you must do two things,
示例#6
0
文件: connect.py 项目: anantoni/CMG
import sys
import pprint
import os
import re
import operator
import subprocess
import re

from CMGTools.Production.cmgdbApi import CmgdbApi
from CMGTools.H2TauTau.proto.samples.getFiles import getFiles

db = CmgdbApi()
db.connect()

def findFirstAncestor(dataset_id, info):
    cols, rows = db.sql("select parent_dataset_id, path_name, primary_dataset_entries, number_total_jobs, task_id, dataset_entries FROM dataset_details where dataset_id={dataset_id}".format(dataset_id=dataset_id))
    if len(rows)==0:
        print 'cannot find dataset with id', dataset_id
    elif len(rows)>1:
        assert(False)
    else:
        parent_id = rows[0][0]
        groups = ['tauMu_fullsel_tree_CMG', 'tauMu_fullsel_tree', 'tauEle_fullsel_tree_CMG',
                  'tauEle_fullsel_tree', 'diTau_fullsel_tree_CMG', 'diTau_fullsel_tree','cmgTuple', 'PFAOD'] 
        igroup = 0
        while 1:
            ginfo = groupInfo(dataset_id, groups[igroup])
            if ginfo != None:
                break
            igroup+=1
        file_group_name, number_files_good, number_files_bad, number_files_missing, dataset_fraction = ginfo
示例#7
0
#!/bin/env python

from CMGTools.Production.cmgdbApi import CmgdbApi
import CMGTools.Production.eostools as eos
import pprint

db = CmgdbApi()
db.connect()

cols, rows = db.sql(
    "select path_name, file_owner, number_files_bad, number_files_good from dataset_details where path_name like '%V5_4_0'"
)
# pprint.pprint(rows)

dead = []
good = []

nscanned = 0
for row in rows:
    # print row
    path = row[0]
    owner = row[1]
    nFiles = None
    if row[2] is not None and row[3] is not None:
        nFiles = row[2] + row[3]
    print path, nFiles
    dir = None
    if owner == 'cmgtools_group':
        dir = '/eos/cms/store/cmst3/group/cmgtools/CMG' + path
    elif owner == 'cmgtools':
        dir = '/eos/cms/store/cmst3/user/cmgtools/CMG' + path
示例#8
0
        action="store_true",
        dest="development",
        help=
        "Choose between publishing to the official or development database",
        default=False)
    group.add_option("-f",
                     "--file",
                     action="store",
                     dest="filename",
                     help="""Specify the name of the file to be created""",
                     default="empty_datasets.txt")

    parser.add_option_group(group)
    (options, args) = parser.parse_args()

    cmgdbApi = CmgdbApi(options.development)
    cmgdbApi.connect()

    columns, rows = cmgdbApi.sql(
        "select file_owner, path_name from dataset_details where dataset_is_open='Y' and (file_owner='cmgtools' or file_owner='cmgtools_group')"
    )

    f = open(options.filename, 'w')

    for row in rows:
        fileown = row[0]
        dsName = row[1]

        if fileown == "--cmgtools":
            fileown = "cmgtools"
        help="Choose between publishing to the official or development database",
        default=False,
    )
    group.add_option(
        "-f",
        "--file",
        action="store",
        dest="filename",
        help="""Specify the name of the file to be created""",
        default="empty_datasets.txt",
    )

    parser.add_option_group(group)
    (options, args) = parser.parse_args()

    cmgdbApi = CmgdbApi(options.development)
    cmgdbApi.connect()

    columns, rows = cmgdbApi.sql(
        "select file_owner, path_name from dataset_details where dataset_is_open='Y' and (file_owner='cmgtools' or file_owner='cmgtools_group')"
    )

    f = open(options.filename, "w")

    for row in rows:
        fileown = row[0]
        dsName = row[1]

        if fileown == "--cmgtools":
            fileown = "cmgtools"