def testTopicUnspecifiedError(): pytest.raises(pub.TopicDefnError, pub.setTopicUnspecifiedFatal) pub.setTopicUnspecifiedFatal(checkExisting=False) def fn(): pass LSI = pub.TopicDefnError pytest.raises(LSI, pub.sendMessage, 'testTopicUnspecifiedError') pytest.raises(LSI, pub.subscribe, fn, 'testTopicUnspecifiedError') pub.setTopicUnspecifiedFatal(False) pub.sendMessage('testTopicUnspecifiedError') pub.subscribe(fn, 'testTopicUnspecifiedError')
def __init__(self): ''' Constructor ''' super(PubSubAid, self).__init__() try: self.logger.debug("PubSubAid starting") pub.subscribe(self.step, Constants.TopicNames.Step) pub.subscribe(self.outputs, Constants.TopicNames.Outputs) pub.subscribe(self.all_topics, Constants.TopicNames.ALL_TOPICS) # printTreeDocs( extra='LaDA' ) # print() pub.setTopicUnspecifiedFatal(True) self.logger.debug("PubSubAid ending") except Exception as ex: self.logger.exception('exception in PubSupAid {}'.format(ex))
def __init__( self ): ''' Constructor ''' super( PubSubAid, self ).__init__() try: self.logger.debug( "PubSubAid starting" ) pub.subscribe( self.step, Constants.TopicNames.Step ) pub.subscribe( self.outputs, Constants.TopicNames.Outputs ) pub.subscribe( self.all_topics, Constants.TopicNames.ALL_TOPICS ) # printTreeDocs( extra='LaDA' ) # print() pub.setTopicUnspecifiedFatal( True ) self.logger.debug( "PubSubAid ending" ) except Exception as ex: self.logger.exception( 'exception in PubSupAid {}'.format( ex ) )
from pubsub import pub import notifhandle import exchandle import arg1_topics #***** actual application ********** print 'Using "arg1" messaging protocol of pubsub v3' try: print '------- init ----------' pub.importTopicTree( arg1_topics ) pub.setTopicUnspecifiedFatal() import arg1_listeners import arg1_senders as senders senders.init() print '-----------------------' senders.doSomething1() senders.doSomething2() print '------- done ----------' print 'Exporting topic tree to', arg1_topics.__name__ pub.exportTopicTree('arg1_topics_out') except Exception, exc:
from pubsub import pub import notifhandle import exchandle import arg1_topics #***** actual application ********** print 'Using "arg1" messaging protocol of pubsub v3' try: print '------- init ----------' pub.importTopicTree(arg1_topics) pub.setTopicUnspecifiedFatal() import arg1_listeners import arg1_senders as senders senders.init() print '-----------------------' senders.doSomething1() senders.doSomething2() print '------- done ----------' print 'Exporting topic tree to', arg1_topics.__name__ pub.exportTopicTree('arg1_topics_out') except Exception, exc:
""" Reading oet.ini file value and initializing constant of feature toggle with enabling event based polling/pubsub """ import os.path from pkg_resources import resource_filename from pubsub import pub from ska_ser_logging import configure_logging from tblib import pickling_support import oet.event.topics from .features import Features # Set pypubsub to throw an error if topic in sendMessage does not correspond # to a topic in the topic tree defined in oet.event.topics pub.setTopicUnspecifiedFatal(True) # Load the topic tree definition pub.addTopicDefnProvider(oet.event.topics, pub.TOPIC_TREE_FROM_CLASS) configure_logging() pickling_support.install() FEATURES = Features.create_from_config_files( os.path.expanduser("~/oet.ini"), resource_filename(__name__, "oet.ini") )
def tearDown( self ): pub.setTopicUnspecifiedFatal( False )
from PySide2.QtGui import QIcon from PySide2.QtWidgets import QApplication from PySide2.QtWinExtras import QtWin from pubsub.pub import addTopicDefnProvider, TOPIC_TREE_FROM_CLASS, setTopicUnspecifiedFatal from Engine import Topic_Def from Engine.Engine import HeaterControlEngine from QtInterface.ElchMainWindow import ElchMainWindow addTopicDefnProvider(Topic_Def, TOPIC_TREE_FROM_CLASS) setTopicUnspecifiedFatal(True) def main(): QtWin.setCurrentProcessExplicitAppUserModelID('elchworks.elchitools.2.2') app = QApplication() app.setWindowIcon(QIcon('Icons/Logo.ico')) engine = HeaterControlEngine() gui = ElchMainWindow() app.exec_() if __name__ == '__main__': main()