コード例 #1
0
ファイル: report_kh.py プロジェクト: desihub/desilo
    def nl_submit(self):

        if not self.current_nl():
            self.nl_text.text = 'You cannot submit a Night Log to the eLog until you have connected to an existing Night Log or initialized tonights Night Log'
        else:
            try:
                from ECLAPI import ECLConnection, ECLEntry
            except ImportError:
                ECLConnection = None
                self.nl_text.text = "Can't connect to eLog"

            f = self.nl_file[:-5]
            nl_file=open(f,'r')
            lines = nl_file.readlines()
            nl_html = ' '
            for line in lines:
                nl_html += line

            e = ECLEntry('Synopsis_Night', text=nl_html, textile=True)

            subject = 'Night Summary {}-{}-{}'.format(self.date_init.value[0:4], self.date_init.value[4:6], self.date_init.value[6:])
            e.addSubject(subject)
            url = 'http://desi-www.kpno.noao.edu:8090/ECL/desi'
            user = '******'
            pw = 'dosuser'
            if self.test:
                pass
            else:
                elconn = ECLConnection(url, user, pw)
                response = elconn.post(e)
                elconn.close()
                if response[0] != 200:
                   raise Exception(response)
                   self.nl_text.text = "You cannot post to the eLog on this machine"

            self.save_telem_plots = True
            self.current_nl()

            nl_text = "Night Log posted to eLog and emailed to collaboration" + '</br>'
            self.nl_text.text = nl_text
            if self.test:
                self.email_nightsum(user_email = ["*****@*****.**","*****@*****.**"])
            else:
                self.email_nightsum(user_email = ["*****@*****.**","*****@*****.**","*****@*****.**"])
コード例 #2
0
    #Find if there is a new run or output

    DAQUptimePlots="/home/minerva/cmtuser/Minerva_v10r9p1/Tools/ControlRoomTools/SmartShift/images/DAQ_live_time.png"
    ShiftName=FindShift(DAQUptimePlots)

    e = ECLEntry(category='Shift_Notes/Control_Room_Shifts',
                tags=['DAQUptimePlots'],
                formname='default',
                text="""{0}. Automated posting.""".format(ShiftName),
                preformatted=False)

    e.addImage("DAQ Clock Livetime Plots",DAQUptimePlots)
    
    if not print_only:
        # Define connection
        elconn = ECLConnection(url=URL, username=user, password=password)
        #
        # The user should be a special user created with the "raw password" by administrator.
        # This user cannot login via GUI

        # Post test entry created above
        response = elconn.post(e)

        # Print what we have got back from the server
        print response

        # Close the connection
        elconn.close()
        
    else:
        # Just print prepared XML
コード例 #3
0
ファイル: ecl_post.py プロジェクト: mibass/ubooneNearLine
    PATH2 = './QCandQA_100tracks.pdf'
    if path.isfile(PATH1) and access(PATH1, R_OK):
        e.addImage('QCQA', PATH1, image=None)
    else:
        print "Either file is missing or is not readable"

    if path.isfile(PATH2) and access(PATH2, R_OK):
        e.addImage('QCandQA', PATH2, image=None)
    else:
        print "Either file is missing or is not readable"

    if not print_only:
        # Define connection        print "here4"
        #        print URL
        #        print "here3"
        elconn = ECLConnection(URL, user, password)
        print "here4", user, password
        #
        # The user should be a special user created with the "raw password" by administrator.
        # This user cannot login via GUI
        # The password should be kept in some file protected from other users, like postgres does with .pgpass file.
        # Postgres checks if .pgpass mode <= 0600 before uses the file.

        # Post test entry created above
        response = elconn.post(e)
        #        print "here5"
        # Print what we have got back from the server
        print response
        #        print "here6"
        # Close the connection
        elconn.close()
コード例 #4
0
        print "Either file is missing or is not readable"  

    PATH='/home/bcarls/purityMonAnalysis/QC_1.png'
    if path.isfile(PATH) and access(PATH, R_OK):
        e.addImage('fourteen',PATH, image=None)
    else:
        print "Either file is missing or is not readable"  




    if not print_only:
        # Define connection        print "here4"
#        print URL
#        print "here3"
        elconn = ECLConnection(URL, user, password)
#        print "here4",user,password
        #
        # The user should be a special user created with the "raw password" by administrator.
        # This user cannot login via GUI
        # The password should be kept in some file protected from other users, like postgres does with .pgpass file.
        # Postgres checks if .pgpass mode <= 0600 before uses the file.

        # Post test entry created above
        response = elconn.post(e)
#        print "here5"
        # Print what we have got back from the server
        print response
#        print "here6"
        # Close the connection
        elconn.close()
コード例 #5
0
URL = "http://dbweb6.fnal.gov:8080/ECL/demo"
user = "******"
password = "******"

cat = None
form = None
limit = None
tag = None
after = None

opts, args = getopt.getopt(sys.argv[1:], 'c:f:l:t:a:U:')
for opt, val in opts:
    if opt == '-c':
        cat = val
    elif opt == '-f':
        form = val
    elif opt == '-l':
        limit = int(val)
    elif opt == '-t':
        tag = val
    elif opt == '-a':
        after = val
    elif opt == '-U':
        URL = val

conn = ECLConnection(URL, user, password)
lst = conn.list(category=cat, form=form, limit=limit, tag=tag, after=after)
for i in lst:
    print(i)
コード例 #6
0
from ECLAPI import ECLConnection
import getopt, sys

Usage = """
python ecl_get.py [-U <url>] <entry-id>
"""

if not sys.argv[1:]:
    print Usage
    sys.exit(1)

URL = "http://dbweb4.fnal.gov:8080/ECL/demo"
user = "******"
password = "******"

opts, args = getopt.getopt(sys.argv[1:], '-U')
for opt, val in opts:
    if opt == '-U': URL = val

conn = ECLConnection(URL, user, password)
xml = conn.get(int(sys.argv[1]))
print xml