예제 #1
0
logfile.write("starlist = %s\n" % starlist)
logfile.write("idlenv = %s\n" % idlenv)

while True:

    todolist = glob.glob(os.path.join(watchdir,'*.fits'))

    # first stuff the queue
    # this ends when either the queue is full or the todo list is empty
    while(len(todolist)):
        logfile.write("New files found:\n")
        logfile.write(" ".join(todolist) + "\n")
        filename = todolist.pop()
        logfile.write("Starting %s\n" % filename)
        
        msg,plan = run_spec.buildandrunplan(filename,watchdir,stddir,pipelist,calibs,stars,idlenv,flag)
        if msg == '':
            logfile.write("ran plan = %s at %s\n" % (plan.display_name,plan.finalpath) )
            donename = os.path.join(watchdir,"done",os.path.basename(filename))
            print filename, "=>" ,donename
            logfile.write("copying " + filename + " => " +donename + '\n')
            watchdir_setup.movetodone(filename,donename)
            logfile.write("Running lris_senstd for %s at %s\n"  % (plan.display_name,plan.finalpath) )
            msg = run_sens.run_sensstd(plan,stddir,idlenv)
            print msg
            logfile.write(msg+"\n")

        else:
            print msg
            print "%s appears to be have an issue, moving to done" % (filename)
            logfile.write(msg+"\n")
예제 #2
0
if correct_executable in executable and os.path.isfile(os.path.join(testdir, correct_planfile)):
    print "Success in writeplan"
    cleanup_calfile(testcalfile, os.path.join(testdir, testfiledir))
elif executable == correct_executable and not os.path.isfile(os.path.join(testdir, correct_planfile)):
    print "FAILED in writeplan, no planfile written, %s" % correctplan
    cleanup_calfile(testcalfile, os.path.join(testdir, testfiledir))
elif executable != correct_executable and os.path.isfile(os.path.join(testdir, correct_planfile)):
    print "FAILED in writeplan, wrong executable string, %s" % executable
    cleanup_calfile(testcalfile, os.path.join(testdir, testfiledir))
else:
    print "FAILED in writeplan"

# eight
print "8 - buildandrunplan"
flag = dict(redo=True)
msg, retplan = run_spec.buildandrunplan(testfile, testdir, testdir, pipes, calframes, stars, idlenv, flag)
if msg == "" and os.path.isfile(os.path.join(testdir, retplan.finalpath, "longreduce.log")):
    print "Success in buildandrunplan"
    cleanup_plandir(retplan, testfile, testdir)
else:
    print "FAILED in buildandrunplan", retplan, msg
    cleanup_plandir(retplan, testfile, testdir)

# nine
msg, retplan = run_spec.buildandrunplan("", testdir, testdir, pipes, calframes, stars, idlenv, flag)
if retplan == False:
    print 'Success in buildandrunplan (bad frame) - Previous line should have a "cannot open" error'
else:
    print "FAILED in buildandrunplan (bad frame)", msg

msg, retplan = run_spec.buildandrunplan(testcalfile, testdir, testdir, pipes, calframes, stars, idlenv, flag)