Esempio n. 1
0
 def __init__(self, ex):
     Exception.__init__(self, ex)
     
     if isinstance(ex, AddeException):
         self.hasErrorCode = ex.hasAddeErrorCode()
         self.addeErrorCode = ex.getAddeErrorCode()
     else:
         self.hasAddeErrorCode = False
         self.addeErrorCode = 0
def check_currents(rebid, pwr_chan, reb_chan, low_lim, high_lim, chkreb):

    print "Retrieving REB PS current %s " % pwr_chan
    cur_ps = pwrsub.synchCommand(
        10,
        "getChannelValue REB%d.%s.IaftLDO" % (rebid, pwr_chan)).getResult()
    print "Retrieving REB current %s " % reb_chan
    cur_reb = ts8sub.synchCommand(
        10, "getChannelValue R00.Reb%d.%s" % (rebid, reb_chan)).getResult()

    print "verifying that the current is within limits"
    if (chkreb):
        stat = "%s: - checking %10.10s : OK - PS value is %8.3f mAmps, REB value is %8.3f mAmps" % (
            rebname, pwr_chan, cur_ps, cur_reb)
    else:
        stat = "%s: - checking %10.10s : OK - PS value is %8.3f mAmps, REB not yet ON" % (
            rebname, pwr_chan, cur_ps)

        print " ... stat = ", stat
    if (cur_ps < low_lim or cur_ps > high_lim):
        pwrsub.synchCommand(10,
                            "sequencePower %d False" % (rebid)).getResult()
        stat = "%s: Current %s with value %f mA NOT in range %f mA to %f mA. POWER TO THIS CHANNEL HAS BEEN SHUT OFF!" % (
            rebname, pwr_chan, cur_ps, low_lim, high_lim)
        raise Exception(stat)
    if (abs(cur_ps) > 0.0 and chkreb):
        if (abs(cur_reb - cur_ps) / cur_ps > 0.10 and abs(cur_reb) > 0.5):
            stat = "%s: Current %s with value %f differs by > 10%% to current from reb channel %s with value %f!" % (
                rebname, pwr_chan, cur_ps, reb_chan, cur_reb)

    print stat

    return
 def __checkMetadataPayload(self):
     try:
         # Simple check for its existance
         self.object.getPayload("formData.tfpackage")
         self.firstHarvest = False
     except Exception:
         self.firstHarvest = True
         # We need to create it
         self.log.info(
             "Creating 'formData.tfpackage' payload for object '{}'",
             self.oid)
         # Prep data
         data = {
             "viewId": "default",
             "workflow_source": "Edgar Import",
             "packageType": "dataset",
             "redbox:formVersion": self.redboxVersion,
             "redbox:newForm": "true"
         }
         package = JsonSimple(JsonObject(data))
         # Store it
         inStream = IOUtils.toInputStream(package.toString(True), "UTF-8")
         try:
             self.object.createStoredPayload("formData.tfpackage", inStream)
             self.packagePid = "formData.tfpackage"
         except StorageException, e:
             self.log.error(
                 "Error creating 'formData.tfpackage' payload for object '{}'",
                 self.oid, e)
             raise Exception("Error creating package payload: ", e)
Esempio n. 4
0
 def set(self, *args):  # @ReservedAssignment
     if self.readFromNexus:
         raise Exception("Unsupported with readFromNexus == True")
         # This could be implemented by iterating over existing scannables, removing those not in args
         # and adding those in args.
     _check_all_scannable(args)
     self.scannables_to_read = list(args)
     return self.ls()
 def validate(ra):
     if ra.name is None or ra.name is None:
         raise Exception("Failed getting value for template key (" +
                         ra.name + ") and " + "dictionary key (" +
                         ra.dictionaryName + ") of type (" + ra.type + ")")
     else:
         pass
     return True
Esempio n. 6
0
	def testProcessScanWithJythonException(self):
		concurrentScan = Mock()
		concurrentScan.getUserListedScannables.side_effect = Exception("e")
		sdp = ScanDataProcessor([], {}, scanDataPointCache=self.sdpc)
		result = sdp.processScan(concurrentScan)
		print "***"
		print result
		print "***"
Esempio n. 7
0
 def __init__(self, description):
     self.protocol = current_protocol
     self.test = current_test
     self.description = description
     sw = StringWriter()
     Exception('Stack trace').printStackTrace(PrintWriter(sw))
     self.stack_trace = sw.toString()
     self.tb = '\n'.join(
         (line.strip() for line in traceback.format_stack()))
Esempio n. 8
0
	def fullLog(self, controller, msg, exceptionType=None, exception=None, traceback=None, Raise=False):
		msg = self.createMessage(msg, exceptionType, exception, traceback);
		if controller != None:
			controller.update(None, msg);
		if exception != None:
			self.logger.error(msg);
		else:
			self.logger.info(msg);
			
		InterfaceProvider.getTerminalPrinter().print(msg);
		if Raise:
			if isinstance(msg, Exception):
				raise msg;
			raise Exception(msg);
Esempio n. 9
0
    def fullLog(self,
                controller,
                msg,
                exceptionType=None,
                exception=None,
                traceback=None,
                Raise=False):
        shortmsg = self.createMessage(msg, None, exception, None)
        msg = self.createMessage(msg, exceptionType, exception, traceback)
        if controller != None:
            controller.update(None, msg)
        if exception != None:
            self.logger.error(msg)
        else:
            self.logger.info(msg)

        print shortmsg
        if Raise:
            if isinstance(msg, Exception):
                raise msg
            raise Exception(msg)
Esempio n. 10
0
def check_currents(rebid,pwr_chan,reb_chan,low_lim,high_lim,chkreb):

#    print "Retrieving REB PS current %s " % pwr_chan
    cur_ps = pwrsub.synchCommand(10,"getChannelValue REB%d.%s.IaftLDO" % (rebid,pwr_chan)).getResult()
#    print "Retrieving REB current %s " % reb_chan
    cur_reb = ts8sub.synchCommand(10,"getChannelValue R00.Reb%d.%s" % (rebid,reb_chan)).getResult()

#    print "verifying that the current is with limits"
    stat = "%10.10s : OK - PS value is %8.3f , REB value is %8.3f" % (pwr_chan,cur_ps,cur_reb)
#    if (cur_ps < low_lim or 
    if (cur_ps> high_lim) :
        pwrsub.synchCommand(10,"setNamedPowerOn %d %s False" % (rebid,pwr))
        stat = "Current %s with value %f mA NOT in range %f mA to %f mA. POWER TO THIS CHANNEL HAS BEEN SHUT OFF!" % (pwr_chan,cur_ps,low_lim,high_lim)
        raise Exception
    if (abs(cur_ps)>0.0 and chkreb) :
        if (abs(cur_reb-cur_ps)/cur_ps > 0.20) :
            pwrsub.synchCommand(10,"setNamedPowerOn %d %s False" % (rebid,pwr))
            stat = "Current %s with value %f differs by > 10%% to current from reb channel %s with value %f. POWER TO THIS CHANNEL HAS BEEN SHUT OFF!" % (pwr_chan,cur_ps,reb_chan,cur_reb)
            raise Exception(stat)

    print stat

    return
Esempio n. 11
0
 def __init__(self, details):
     Exception.__init__(self, details)
Esempio n. 12
0
if npoints >= 6:

    print "calibration check successful"

    fp = open("%s/status.out" % (cdir), "w")

    ts_version = "NA"
    ts_revision = "NA"
    ts5_version = "NA"
    ts5_revision = "NA"

    istate = 0
    fp.write( ` istate ` + "\n")
    fp.write("%s\n" % ts_version)
    fp.write("%s\n" % ts_revision)
    fp.write("%s\n" % ts5_version)
    fp.write("%s\n" % ts5_revision)
    fp.close()

else:

    print "calibration check FAILED!"

    raise Exception("calibration check FAILED")

print " =====================================================\n"
print "            TS5 KEYENCE METROLOGY SCAN DONE\n"
print " =====================================================\n"

print "Keyence_Calobration: COMPLETED"
Esempio n. 13
0
 def __init__(self, msg, exception = None):
     self._msg = msg
     self._exception = exception
     Exception.__init__(self, msg)
                print "%s: FAILED TO TURN POWER OFF! \r\r %s" % (rebname, e)
                raise e

            time.sleep(5.0)

            pwron = ""
            chkreb = False

            try:
                print "%s: turning on REB power at %s" % (
                    rebname, time.ctime().split()[3])
                pwrsub.synchCommand(10, "sequencePower %d true" % (i))
            except Exception, e:
                print "%s: failed to turn on REB power!" % (rebname)
                raise Exception(e)

#            time.sleep(2.0)
            print "Rebooting the RCE after a 5s wait"
            time.sleep(10.0)
            sout = subprocess.check_output("$HOME/rebootrce.sh", shell=True)
            print sout
            time.sleep(3.0)

            try:
                #                print "checking currents"

                if 'digital' in pwron:
                    check_currents(i, "digital", "DigI", 6., 800., chkreb)
                if 'analog' in pwron:
                    check_currents(i, "analog", "AnaI", 6., 610., chkreb)
Esempio n. 15
0
    def searchNla(self):
        # Start row
        start = self.formData.get("start")
        if start is None:
            start = "1"

        # Row limit
        rows = self.formData.get("rows")
        if rows is None:
            rows = "10"

        # Query
        query = ""
        # Test searches
        #query = "pa.surname=\"Smith\""
        #query = "cql.anywhere=\"monash\""

        if query == "":
            # Surname
            surname = self.formData.get("surname")
            if surname is not None:
                query = "pa.surname=\"%s\"" % (surname)

            # Firstname
            firstName = self.formData.get("firstName")
            if firstName is not None:
                if query != "":
                    query += " AND "
                query += "pa.firstname=\"%s\"" % (firstName)

        if query != "":
            query += " AND "
        query += "pa.type=\"person\""

        # Some basic metadata we already know
        self.metadata.put("searchString", query)
        self.metadata.put("startRecord", start)
        self.metadata.put("rowsRequested", rows)

        # Search NLA
        self.log.debug("Submitting query to NLA: '{}', Start: '{}', Rows: '{}'", [query, start, rows])
        sru = SRUClient()
        # If using the NLA's test server, comment out the line above and uncomment the line below
        # sru = SRUClient("http://www-test.nla.gov.au/apps/srw/search/peopleaustralia")
        
        response =  sru.nlaGetResponseBySearch(query, start, rows)
        if response is None:
            raise Exception("Error searching NLA. Please check system logs for details.")

        self.metadata.put("rowsReturned", response.getRows())
        self.metadata.put("totalHits", response.getTotalResults())

        identities = NLAIdentity.convertNodesToIdentities(response.getResults())
        for id in identities:
            idEntry = JsonObject()
            idEntry.put("nlaId", id.getId())
            idEntry.put("displayName", id.getDisplayName())
            idEntry.put("firstName", id.getFirstName())
            idEntry.put("surname", id.getSurame())
            idEntry.put("institution", id.getInstitution())
            knownIds = JSONArray()
            idEntry.put("knownIdentities", knownIds)

            for knownId in id.getKnownIdentities():
                thisId = JsonObject()
                thisId.put("displayName", knownId.get("displayName"))
                thisId.put("institution", knownId.get("institution"))
                knownIds.add(thisId)

            self.results.add(idEntry)

        return True
Esempio n. 16
0
                ts8sub.synchCommand(10,"monitor-update change taskPeriodMillis 10000");
                ts8sub.synchCommand(10,"monitor-publish change taskPeriodMillis 10000");
                raise e

            time.sleep(3.0)

            pwron = ""
# Turn on the REB PS power lines but keep off the RSA heaters

            try:
                print "%s: turning on %s power at %s" % (rebname,pwr,time.ctime().split()[3])
                pwrsub.synchCommand(10,"sequencePower %d" % (i));
                pwrsub.synchCommand(10,"setNamedPowerOn %d heater False" % (i));
            except Exception, e:
                print "%s: failed to turn on current %s!" % (rebname,pwr)
                raise Exception(e)

            time.sleep(2.0)


# Insure the that the RCE is talking to the REBs before starting the checks
            chkreb = True
            print "Rebooting the RCE after a 5s wait"
            time.sleep(5.0)
            sout = subprocess.check_output("$HOME/rebootrce.sh", shell=True)
            print sout
            time.sleep(3.0)
    
# perform checks
            try:
                if 'digital' in pwron :
Esempio n. 17
0
def prepareJavaStackTrace():
    dataObj = sys.exc_info()[1]
    if type(dataObj.__class__).__name__ == 'org.python.core.PyJavaClass':
        if JException.getClass().isAssignableFrom(dataObj.__class__):
            return dataObj
    return None
Esempio n. 18
0
def prepareJavaStackTrace():
    dataObj = sys.exc_info()[1]
    if type(dataObj.__class__).__name__ == 'org.python.core.PyJavaClass':
        if JException.getClass().isAssignableFrom(dataObj.__class__):
            return dataObj
    return None
Esempio n. 19
0
 def __init__(self, msg, exception=None):
     """Creates an exception. The message is required, but the exception
     is optional."""
     self._msg = msg
     self._exception = exception
     Exception.__init__(self, msg)
Esempio n. 20
0
 def __init__(self, msg, exception=None):
     self._msg = msg
     self._exception = exception
     Exception.__init__(self, msg)
Esempio n. 21
0
"""Different kinds of SAX Exceptions"""
Esempio n. 22
0
"""Different kinds of SAX Exceptions"""
Esempio n. 23
0
 def __init__(self, msg, exception=None):
     """Creates an exception. The message is required, but the exception
     is optional."""
     self._msg = msg
     self._exception = exception
     Exception.__init__(self, msg)
 def __init__(self, s):
     Exception.__init__(self, s)
Esempio n. 25
0
    # safety check that it really is done
    reply = rdyresult.get()

    result = tssub.synchCommand(120, "goTestStand")
    rply = result.getResult()

    fp = open("%s/status.out" % (cdir), "w")
    istate = 0
    result = tssub.synchCommandLine(10, "getstate")
    istate = result.getResult()
    fp.write( ` istate ` + "\n")
    fp.write("%s\n" % ts_version)
    fp.write("%s\n" % ts_revision)
    fp.write("%s\n" % archon_version)
    fp.write("%s\n" % archon_revision)
    fp.close()

except Exception, ex:

    raise Exception(
        "There was an exception in the acquisition producer script. The message is\n (%s)\nPlease retry the step or contact an expert,"
        % ex)

except ScriptingTimeoutException, ex:

    raise Exception(
        "There was an ScriptingTimeoutException in the acquisition producer script. The message is\n (%s)\nPlease retry the step or contact an expert,"
        % ex)

print "ts3_cool_down: COMPLETED"
Esempio n. 26
0
                    ts8sub.synchCommand(10, "setSeqInfo", seq)
                    eolib.EOTS8SetupCCDInfo(ts8sub, rebpssub, ccdnames,
                                            ccdmanunames)
                    rply = ts8sub.synchCommand(150, "exposeAcquireAndSave", 0,
                                               False, False).getResult()
                    print "completed bias exposure"
                    i += 1
                    num_tries = 0
                except Exception, ex:
                    num_tries += 1
                    if num_tries < max_tries:
                        print "RETRYING BIAS EXPOSURE - Error was: %s" % ex
                        time.sleep(10.0)
                    else:
                        raise Exception(
                            "EXCEEDED MAX RETRIES ON BIAS EXPOSURE: %s" %
                            str(ex))

                print "after click click at %f" % time.time()
                time.sleep(5.0)

########################## Start of flux calib section #############################
            if (('FLAT' in acqname or 'LAMBDA' in acqname) and wl != owl):

                if domono:
                    print "Setting monochromator lambda = %8.2f" % wl
                    for itry in range(3):
                        try:
                            rwl = monosub.synchCommand(60, "setWaveAndFilter",
                                                       wl).getResult()
                            print "Monochromator reports wl = ", rwl