コード例 #1
0
ファイル: remoteAnalysis.py プロジェクト: Kuenni/tools3a
def checkGridpack(local, remote, gpdir, gpfilestring):
    print "Comparing gridpack files timestamps..."
    gppaths = expandFiles(gpdir, gpfilestring)
    # check time stamps
    outdated = False
    createnew = False
    try:
        timestampzipped = os.path.getmtime(local)
    except OSError:
        print "Local grid pack file does not exist. Creating..."
        createnew=True
    if not createnew:
        for path in gppaths:
            if os.path.getmtime(path)>timestampzipped:
                print "Found outdated file",path
                outdated=True
        if outdated:
            if ask("Local grid pack zip file is outdated. Would you like to create a current version?"):
                createnew=True
    if createnew:
        createGridpack(local, gpdir, gpfilestring)
    # check hashes
    try:
        adlerRemote = gridFunctions.adler32(os.path.join(cesubmit.getCernUserName(), remote))
    except gridFunctions.FileNotFound:
        print "Remote gridpack not found"
        adlerRemote = None
    adlerLocal = adler32(local)
    if adlerLocal!=adlerRemote:
        if ask("Remote gridpack differs from local gridpack. Do you want to upload the current local gridpack now?"):
            cesubmit.uploadGridPack(local, remote)
コード例 #2
0
ファイル: aix3adb2music.py プロジェクト: Kuenni/tools3a
def commandline_parsing():
    import argparse
    from cesubmit import getCernUserName
    user = getCernUserName()
    parser = argparse.ArgumentParser(description='Create music config files from DB')
    parser.add_argument('files', metavar='FILES', type=str, nargs='+',
                   help='A list of input files')
    parser.add_argument('--SkimmerTag',  type=str,
                   help='A timestamp used on dCache')
    parser.add_argument('--user',  type=str, default = user,
                   help='Change user name for dCache position default % s' % user)
    parser.add_argument('--inputType', default='music_crab',
                        choices=['music_crab','television'], # should add simple file lists 'skimid','sampleid','samplename'
                        help='Choose your input file format ') # sampleid and samplename use the latest skim
    #~ parser.add_argument('borders', metavar='N', type=int, nargs='+',
                   #~ help='A list min max  aix3adb Sample IDs [min1 max1 min2 max2]')
    args = parser.parse_args()
    return args