Ejemplo n.º 1
0
    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 = ["*****@*****.**","*****@*****.**","*****@*****.**"])
        if opt=='-p':           # User password
            password = val
        if opt=='-u':           # User name
            user = val
        if opt == '-U':         # ECL instance URL to use for the posts
            URL = val

##########################################################################
    #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)
Ejemplo n.º 3
0
    opts, args = getopt.getopt(sys.argv[1:], 'nU:')

    print_only = False

    for opt, val in opts:
        if opt == '-n':
            print_only = True

        if opt == '-U':
            URL = val

#################
#   Create test entry
    e = ECLEntry(category='Purity Monitor',
                 tags=[],
                 formname='default',
                 text='<b> Nearline lifetime plots! </b> <BR>',
                 preformatted=True)

    #       Optional. Set the author username. The user must be registered CRL user
    e.setAuthor('xmlmicro')

    #   Attach some file
    #    e.addAttachment('attached-file', '/bin/zcat',
    #        data='Data may come here as an argument. The file will not be read in this case')

    #   Attach some image
    # Image data also can be passed as a parameter here using 'image' argument.
    PATH1 = './QCQA_100tracks.pdf'
    PATH2 = './QCandQA_100tracks.pdf'
    if path.isfile(PATH1) and access(PATH1, R_OK):
    print_only = False

    for opt, val in opts:
        if opt=='-n':
            print_only = True
            
        if opt == '-U':
            URL = val

#################
#   Create test entry
    # e = ECLEntry(category='Cryogenics Operations', tags=[], formname='default', 
    #             text='<font face="arial"> <b> DAILY PLOT! </b> <BR> Plots of the contamination (Oxygen, Water, Nitrogen) level in the last 24 hours.<BR> For the latest plots check <a href="http://www-microboone.fnal.gov/at_work/gas_analyzers_plot.php">here</a>. <BR> Each filename indicates which contaminant is shown in the plot and which subsystem the gas analyzer device is connected to:  <BR> <i> AFL </i> is the Ar fill line; <BR> <i> PD </i> is the pump discharge; <BR> <i> HVC </i> is the high voltage cryostat; <BR> <i> BDLO </i> is the buffer dewar liquid outlet; <BR> <i> MS1(2) </i> is the molecular sieve 1(2); <BR> <i> CS1(2) </i> is the Oxygen filter 1(2);<BR> <i> UG </i> is the utility gas. <BR> Prefix <i> HR </i> stands for High Resolution (ppb level) device. </font>', preformatted=True)

    e = ECLEntry(category='Purity Monitor', tags=[], formname='default', 
                text='<font face="arial"> <b>Eight Hour Plots!</b> <BR> Plots from the long purity monitor for QA/QC, QA, QC, lifetime, and average lifetime. </font>', preformatted=True)
#       Optional. Set the author username. The user must be registered CRL user 
    e.setAuthor('bcarls')





#   Attach some file
#    e.addAttachment('attached-file', '/bin/zcat', 
#        data='Data may come here as an argument. The file will not be read in this case')

#   Attach some image
# Image data also can be passed as a parameter here using 'image' argument.
#    e.addImage('one','/afs/fnal.gov/files/expwww/microboone/html/at_work/gas_analyzers/ECL/GAS_Plots/O2_AFL.png', image=None)    
#    e.addImage('two','/afs/fnal.gov/files/expwww/microboone/html/at_work/gas_analyzers/ECL/GAS_Plots/O2_PD.png', image=None)
Ejemplo n.º 5
0
    with open(fileToSend) as f2send:
        for line in f2send.readlines():
            if 'user' in line:
                #            print(line)
                textStr = textStr + line
            if 'keyword' in line:
                #            print(line)
                textStr = textStr + line
            if 'comment' in line:
                #            print(line)
                textStr = textStr + line

    print(textStr)

    e = ECLEntry(category='Runs',
                 formname='default',
                 text=textStr,
                 preformatted=False)

    if True:
        # Optional. Set the entry comment
        e.addSubject('New run started: ' + runN)

    if False:
        # Assume the form has the fields named 'firstname', 'lastname', 'email'
        # Fill some fields in the form
        e.setValue(name="firstname", value='John')
        e.setValue(name="lastname", value='Doe')
        e.setValue(name="email", value='*****@*****.**')

    if True:
        # Attach some file; tried and successful      Andrew Chen, 2019/07/25
        if opt == "--toaddr":  #Sets the email address
            toAddr = val

##########################################################################
#Not an efficient way of doing this, but...
    nNewRuns = 0

    #Find if there is a new run or output
    run = NewRuns()
    if update_run > -1:
        run.SetRunRef(update_run)
    for subrun in run.GetNewRuns(any_subrun):
        nNewRuns += 1
        e = ECLEntry(category='Shift_Notes/Control_Room_Shifts',
                     tags=['MinosRunSeries'],
                     formname='ShiftForms/Start_Run_Series',
                     text="""This is an automated posting""",
                     preformatted=False)

        e.setValue(name="Run number", value=run.RunNum)
        e.setValue(name="Run Mode", value=run.RunMode)
        e.setValue(name="HW config", value=run.RunConfig)
        e.setValue(
            name="Comments",
            value=
            "Automated ECL entry for MINOS Run {0} Subrun {1}\n Last logfile mod: {2}\n Logfile Run: {3}"
            .format(run.RunNum, run.Subrun, run.RunComment, run.ReadRunRef()))

        if not print_only:
            # Define connection
            elconn = ECLConnection(url=URL, username=user, password=password)
Ejemplo n.º 7
0
    for opt, val in opts:
        if opt=='-n':           # Print the entry to screen, not to post it
            print_only = True
        if opt=='-p':           # User password
            password = val
        if opt=='-u':           # User name
            user = val
        if opt == '-U':         # ECL instance URL to use for the posts
            URL = val


##########################################################################
#   Create test entry
    e = ECLEntry(category='Sandbox',
                 tags=['Muon'],
                 formname='default',
                 text="""This is just a test of automated posting""",
                 preformatted=False)

    if True:
        # Optional. Set the entry comment
        e.addSubject('Simple entry subject, Simple entry subject, Simple entry subject, Simple entry subject')

    if False:
        # Assume the form has the fields named 'firstname', 'lastname', 'email'
        # Fill some fields in the form
        e.setValue(name="firstname", value='John')
        e.setValue(name="lastname", value='Doe')
        e.setValue(name="email", value='*****@*****.**')

    if False:
Ejemplo n.º 8
0
        if opt == '-u':  # User name
            user = val
        if opt == '-U':  # ECL instance URL to use for the posts
            URL = val

##########################################################################
#Find if there is a new run or output

    ShiftSummaryPlots = "/home/minerva/cmtuser/Minerva_v10r9p1/Tools/ControlRoomTools/SmartShift/images/ShiftSummaryPlots.gif"
    ReferenceShiftSummaryPlots = "/home/minerva/cmtuser/Minerva_v10r9p1/Tools/ControlRoomTools/SmartShift/images/ReferenceShiftSummaryPlots.gif"
    ShiftName = FindShift(ShiftSummaryPlots)

    e = ECLEntry(
        category='Shift_Notes/Control_Room_Shifts',
        tags=['ShiftSummaryPlots'],
        formname='default',
        text=
        """{0}. Please compare with reference plot (Figure 1). Automated posting."""
        .format(ShiftName),
        preformatted=False)

    e.addImage("Shift Summary Plots", ShiftSummaryPlots)
    e.addImage("Reference Shift Summary Plots", ReferenceShiftSummaryPlots)

    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