def main():
    try:
        if sys.argv[1]=='-monitor':
            fname=sys.argv[2]
            condor_log_id="((StarterLog.monitor)|(StarterLog.vm1))"
        elif sys.argv[1].startswith('-slot'):
            if len(sys.argv) < 4:
                # Either slotname or log name not provided
                raise Exception("Insufficent arguments")
            else:
                fname=sys.argv[len(sys.argv)-1]
                slotname=sys.argv[2]
                condor_log_id="(StarterLog.%s)" % slotname
        else:
            fname=sys.argv[len(sys.argv)-1]
            condor_log_id="((StarterLog)|(StarterLog.vm2))"

        matches = gWftLogParser.get_StarterSlotNames(fname)
        if len(matches):
            logs = ', '.join(matches)
            print "StarterLogs available for slots: %s" % logs.replace('StarterLog.', '')
        print gWftLogParser.get_CondorLog(fname,condor_log_id)
    except:
        sys.stderr.write("%s\n"%USAGE)
        sys.exit(1)
def main():
    fname=sys.argv[1]
    condor_log_id="StartdHistoryLog"
        
    try:
        print gWftLogParser.get_CondorLog(fname,condor_log_id)
    except:
        sys.stderr.write("%s\n"%USAGE)
        sys.exit(1)
Exemple #3
0
def main():
    if sys.argv[1]=='-monitor':
        fname=sys.argv[2]
        condor_log_id="MasterLog.monitor"
    else:
        fname=sys.argv[1]
        condor_log_id="MasterLog"
        
    try:
        print gWftLogParser.get_CondorLog(fname,condor_log_id)
    except:
        sys.stderr.write("%s\n"%USAGE)
        sys.exit(1)
Exemple #4
0
def createDecompressedLogs(initialdir,
                           initial_creation_dir,
                           user,
                           entry,
                           jobid,
                           meta_information={},
                           logType='Master'):
    stderrFile = os.path.join(initialdir, user, 'glidein_gfactory_instance',
                              entry, jobid)
    destinationFile = os.path.join(initial_creation_dir, user, entry,
                                   jobid) + "." + logType + ".log"
    condor_log_id = logType
    if logType not in logTypes:
        print "The LogType is not: Master, Starter or Startd, bailing"
        return
    condor_log_id = condor_log_id + "Log"
    try:
        log = gWftLogParser.get_CondorLog(stderrFile, condor_log_id)
    except Exception as e:
        print "Problem creating condor log: %s out of %s" % (logType,
                                                             stderrFile)
        return
    outputfile = open(destinationFile, "w")
    for line in log.split("\n"):
        if len(line) > 0:
            (LogDate, Realmessage) = unParseCondorLine(line)
            meta_information['logDate'] = LogDate
            meta_information['message'] = Realmessage
            meta_information['logType'] = logType
            outputfile.write(json.dumps(meta_information) + '\n')
    outputfile.close()
Exemple #5
0
def main():
    try:
        if sys.argv[1] == '-monitor':
            fname = sys.argv[2]
            condor_log_id = "((StarterLog.monitor)|(StarterLog.vm1))"
        elif sys.argv[1].startswith('-slot'):
            if len(sys.argv) < 4:
                # Either slotname or log name not provided
                raise Exception("Insufficent arguments")
            else:
                fname = sys.argv[len(sys.argv) - 1]
                slotname = sys.argv[2]
                condor_log_id = "(StarterLog.%s)" % slotname
        else:
            fname = sys.argv[len(sys.argv) - 1]
            condor_log_id = "((StarterLog)|(StarterLog.vm2))"

        matches = gWftLogParser.get_StarterSlotNames(fname)
        if len(matches):
            logs = ', '.join(matches)
            print("StarterLogs available for slots: %s" %
                  logs.replace('StarterLog.', ''))
        print(gWftLogParser.get_CondorLog(fname, condor_log_id))
    except:
        sys.stderr.write("%s\n" % USAGE)
        sys.exit(1)
def main():
    fname = sys.argv[1]
    condor_log_id = "StartdHistoryLog"

    try:
        print(gWftLogParser.get_CondorLog(fname, condor_log_id))
    except:
        sys.stderr.write("%s\n" % USAGE)
        sys.exit(1)
Exemple #7
0
def main():
    if sys.argv[1]=='-monitor':
        fname=sys.argv[2]
        condor_log_id="StartdLog.monitor"
    else:
        fname=sys.argv[1]
        condor_log_id="StartdLog"
        
    try:
        print(gWftLogParser.get_CondorLog(fname, condor_log_id))
    except:
        sys.stderr.write("%s\n"%USAGE)
        sys.exit(1)
Exemple #8
0
def main():
    if sys.argv[1] == '-monitor':
        lname = sys.argv[2]
        fname = sys.argv[3]
        # ((name1)|(name2)) allows to check for multiple names
        condor_log_id = "%s.monitor" % (lname, )
    else:
        condor_log_id = sys.argv[1]
        fname = sys.argv[2]

    try:
        print(gWftLogParser.get_CondorLog(fname, condor_log_id))
    except:
        sys.stderr.write("%s\n" % USAGE)
        sys.exit(1)
Exemple #9
0
def main():
    try:
        glideinDescript = parse_args()
    except ValueError as e:
        sys.stderr.write("%s\n\n%s\n" % (e, USAGE))
        sys.exit(1)
    entries = glideinDescript.data['Entries'].split(',')

    log_list = gWftLogParser.get_glidein_logs(glideinDescript.factory_dir,
                                              entries,
                                              glideinDescript.date_arr,
                                              glideinDescript.time_arr, "err")
    for fname in log_list:
        sys.stdout.write("%s\n" % fname)
        sys.stdout.write(
            "===========================================================\n")
        sys.stdout.write("%s\n" %
                         gWftLogParser.get_CondorLog(fname, 'CondorLog'))
        raise ValueError,"%s is not a factory!"%factory_dir

    glideinDescript.factory_dir=factory_dir
    glideinDescript.date_arr=gWftArgsHelper.parse_date(sys.argv[2])
    if len(sys.argv)>=4:
        glideinDescript.time_arr=gWftArgsHelper.parse_time(sys.argv[3])
    else:
        glideinDescript.time_arr=(0,0,0)

    return glideinDescript

def main():
    try:
        glideinDescript=parse_args()
    except ValueError, e:
        sys.stderr.write("%s\n\n%s\n"%(e,USAGE))
        sys.exit(1)
    entries=glideinDescript.data['Entries'].split(',')

    log_list=gWftLogParser.get_glidein_logs(glideinDescript.factory_dir,entries,glideinDescript.date_arr,glideinDescript.time_arr,"err")
    for fname in log_list:
        sys.stdout.write("%s\n"%fname)
        sys.stdout.write("===========================================================\n")
        sys.stdout.write("%s\n"%gWftLogParser.get_CondorLog(fname,'CondorLog'))
        


if __name__ == '__main__':
    main()