def __init__(self, publisher): Subscriber.__init__(self) self.setThreading(False) self.publisher = publisher self.requestLock = True self.incomingSubscriptions = {}
def __init__(self, stageaddress, midiportindex): Subscriber.__init__(self) self.setThreading(True) self.publisher = LivePublisher() self.midiRouter = Showtime_Live.MidiRouter.MidiRouter(midiportindex) if not self.midiRouter.midiActive(): print("--- No midi loopback port available, incoming messages to Ableton will be considerably slower") print("--- Is loopMidi running?\n") if not stageaddress: print("Creating internal stage at tcp://127.0.0.1:6000") self.stageNode = ZstNode("ShowtimeStage") port = 6000 address = "tcp://*:" + str(port) self.stageNode.reply.socket.bind(address) self.stageNode.start() stageaddress = "127.0.0.1:" + str(port) # Create showtime node self.node = ZstNode("LiveNode", stageaddress) self.node.start() self.node.request_register_node() self.register_methods() self.subscribeMatch('[^' + PyroPrefixes.DELIMITER + ']*') self.registrar = RegistrationThread(self.node) self.registrar.daemon = True self.registrar.start()
def __init__(self): Pyro.config.PYRO_NS_HOSTNAME='134.126.132.72' #djs #Pyro.config.PYRO_NS_HOSTNAME='hatfull12.bio.pitt.edu' Subscriber.__init__(self) self.subscribe("clustalw") self._logger = logger.logger(sys.argv[2]) #Pyro.config.PYRO_NS_HOSTNAME='djs-bio.bio.pitt.edu' self.serverSelector = Pyro.core.getProxyForURI("PYRONAME://serverSelector") print 'selector:', self.serverSelector self._logger.log('got serverSelector') self.client = socket.gethostname() if self.client in ('phage', 'gene', 'pham'): self.client = self.client + '_hostname' self._logger.log('platform: ' + sys.platform) self._logger.log('hostname: ' + self.client) self.server = self.serverSelector.get_server(sys.platform, self.client) self._logger.log('using server ' + self.server) self.phamServer = Pyro.core.getProxyForURI("PYRONAME://"+self.server) if sys.platform == 'win32': # this will just use the current working directory self.rootdir = '' else: self.rootdir = '/tmp' if len(sys.argv) < 2: self._logger.log('Number of sequences to align not specified. Using default (1000)') self.numSeqs = 1000 elif int(sys.argv[1]) < 0 or int(sys.argv[1]) > 10000: self._logger.log('requested number of sequences (%s) is outside allowable range (1-10000). Using default (1000)' % sys.argv[1]) self.numSeqs = 1000 else: self.numSeqs = int(sys.argv[1]) self.align()
def __init__(self, stageaddress, midiPort): Subscriber.__init__(self) self.setThreading(True) # Methods for Pyro to subscribe to subscribed = [ PyroTrack.FIRED_SLOT_INDEX, PyroTrack.PLAYING_SLOT_INDEX, PyroDevice.PARAMETERS_UPDATED, PyroDeviceParameter.VALUE_UPDATED, PyroSong.GET_SONG_LAYOUT] subscribed = [OUTGOING_PREFIX + method for method in subscribed] self.subscribe(subscribed) # uri = "PYRONAME://" + Pyro.constants.EVENTSERVER_NAME # self.publisher = Pyro.core.getProxyForURI(uri) self.publisher = LivePublisher() self.midi = midiPort # Create showtime node self.node = ZstNode("LiveNode", stageaddress) self.node.start() self.node.request_register_node() self.register_methods()
def __init__(self, username, password): self.username = username self.password = password #Pyro.config.PYRO_NS_HOSTNAME='136.142.141.113' #djs if opts['nsname']: Pyro.config.PYRO_NS_HOSTNAME=opts['nsname'] else: Pyro.config.PYRO_NS_HOSTNAME='localhost' Subscriber.__init__(self) self.subscribe("clustalw") self._logger = logger.logger(sys.argv[2]) #Pyro.config.PYRO_NS_HOSTNAME='djs-bio.bio.pitt.edu' self.serverSelector = Pyro.core.getProxyForURI("PYRONAME://serverSelector") print 'selector:', self.serverSelector self._logger.log('got serverSelector') self.client = socket.gethostname() self._logger.log('platform: ' + sys.platform) self._logger.log('hostname: ' + self.client) self.server = self.serverSelector.get_server(sys.platform, self.client) self._logger.log('using server ' + self.server) self.phamServer = Pyro.core.getProxyForURI("PYRONAME://"+self.server) if sys.platform == 'win32': # this will just use the current working directory self.rootdir = '' else: self.rootdir = '/tmp' self.align()
def __init__(self): Subscriber.__init__(self) self.subscribe("ContractPrice") self.subscribe("ContractSize") self.subscribe("OrderStatus") self.subscribe("News") self.subscribe("ContractDetails")
def __init__(self, username, password): self.username = username self.password = password #Pyro.config.PYRO_NS_HOSTNAME='136.142.141.113' #djs if opts['nsname']: Pyro.config.PYRO_NS_HOSTNAME = opts['nsname'] else: Pyro.config.PYRO_NS_HOSTNAME = 'localhost' Subscriber.__init__(self) self.subscribe("clustalw") self._logger = logger.logger(sys.argv[2]) #Pyro.config.PYRO_NS_HOSTNAME='djs-bio.bio.pitt.edu' self.serverSelector = Pyro.core.getProxyForURI( "PYRONAME://serverSelector") print 'selector:', self.serverSelector self._logger.log('got serverSelector') self.client = socket.gethostname() self._logger.log('platform: ' + sys.platform) self._logger.log('hostname: ' + self.client) self.server = self.serverSelector.get_server(sys.platform, self.client) self._logger.log('using server ' + self.server) self.phamServer = Pyro.core.getProxyForURI("PYRONAME://" + self.server) if sys.platform == 'win32': # this will just use the current working directory self.rootdir = '' else: self.rootdir = '/tmp' self.align()
def __init__(self, queue): Subscriber.__init__(self) self.subscribe('hdfDone') self.subscribe('iterationStatus') self.subscribe('Status') self._queue = queue print('analyzer: listening for events')
def __init__(self): self.subjPrefix="CARS.HEADING." Subscriber.__init__(self) self.patterns=['north','south','east','west'] self.currentPattern=None self.counter=0 self.subscribeNextPattern()
def __init__(self, glock): gtk.Frame.__init__(self) Subscriber.__init__(self) self.glock = glock self.subscribe("UpdateAccountValue") #self.subscribe("UpdatePortfolio") #self.subscribe("UpdateAccountTime") self.setThreading(0) self.set_label("Account") self.table = gtk.Table(100, 100, True) self.table.show() self.add(self.table) self.sw = gtk.ScrolledWindow() self.sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.liststore = gtk.ListStore(str, str, str, str) self.treeview = gtk.TreeView(self.liststore) self.keycolumn = gtk.TreeViewColumn('Key') self.valuecolumn = gtk.TreeViewColumn('Value') self.currencycolumn = gtk.TreeViewColumn('Currency') self.accountcolumn = gtk.TreeViewColumn('Account') self.treeview.append_column(self.keycolumn) self.treeview.append_column(self.valuecolumn) self.treeview.append_column(self.currencycolumn) self.treeview.append_column(self.accountcolumn) self.keycell = gtk.CellRendererText() self.keycolumn.pack_start(self.keycell, True) self.keycolumn.add_attribute(self.keycell, 'text', 0) self.valuecell = gtk.CellRendererText() self.valuecolumn.pack_start(self.valuecell, True) self.valuecolumn.add_attribute(self.valuecell, 'text', 1) self.currencycell = gtk.CellRendererText() self.currencycolumn.pack_start(self.currencycell, True) self.currencycolumn.add_attribute(self.currencycell, 'text', 2) self.accountcell = gtk.CellRendererText() self.accountcolumn.pack_start(self.accountcell, True) self.accountcolumn.add_attribute(self.accountcell, 'text', 3) self.treeview.show() self.sw.add(self.treeview) self.sw.show() self.table.attach(self.sw, 0, 100, 0, 100) self.name2iter = dict()
def __init__(self, logging, c, server, database, opts): Thread.__init__(self) phamServlet.__init__(self,logging, c) Subscriber.__init__(self) #self.setDaemon(1) self.server, self.database = server, database self.c = db_conf.db_conf(username=opts['user'], password=opts['password'], server=opts['server'], db=opts['database']).get_cursor() self.subscribe("clustalw") self._logger = logger.logger(logging) self.publisher = phamPublisher()
def __init__(self, id): self.subjPrefix = "STRESSTEST.CARS.HEADING." Subscriber.__init__(self) Thread.__init__(self) self.patterns = ['north', 'east', 'south', 'west'] self.currentPattern = None self.counter = 0 self.id = id self.lock = Pyro.util.getLockObject() self.subscribeNextPattern()
def __init__(self): phamServlet.__init__(self) Subscriber.__init__(self) Thread.__init__(self) self.subscribe("fasta") self.current_db = BLASTdb() self.lastAccessed = time.time() self.waitTime = random.randint(5,15) self.busy = False self._logger = logger() self.c = db_conf.db_conf().get_cursor()
def __init__(self, ticker, exchg, cur): Thread.__init__(self) Subscriber.__init__(self) # initialize all the datastructure self.cslock = Lock() self.ticker = ticker self.tsers = {} self.tsers["LASTPRICE"] = TimeSeries([]) self.tsers["BIDPRICE"] = TimeSeries([]) self.tsers["ASKPRICE"] = TimeSeries([]) self.tsers["HIGHPRICE"] = TimeSeries([]) self.tsers["LOWPRICE"] = TimeSeries([]) self.tsers["CLOSEPRICE"] = TimeSeries([]) self.tsers["BIDSIZE"] = TimeSeries([]) self.tsers["ASKSIZE"] = TimeSeries([]) self.tsers["LASTSIZE"] = TimeSeries([]) self.tsers["VOLUMESIZE"] = TimeSeries([]) # first element: name # second element: init element # third computation of the current element self.indicators = [("SMA9", None, lambda x: self.tsers["LASTPRICE"].SMA(9, 0, lambda x: x[3]) ), ("SMA6", None, lambda x: self.tsers["LASTPRICE"].SMA(6, 0, lambda x: x[3]) ) ] for i in self.indicators: self.tsers[i[0]] = TimeSeries([]) self.newbar = {} self.newbar["lasttime"] = 0.0 self.newbar["timeout"] = 10.0 self.newbar["volumeout"] = 3000 # stock that we want o = Pyro.core.getProxyForURI("PYROLOC://localhost:8000/serverInterface") self.cid = o.addstock(ticker,exchg,cur) if (not (o.isActiveContract(self.cid) == 1)): o.activateContract(self.cid) self.ticker = ticker # suscribe self.subscribe("ContractPrice" + str(self.cid)) self.subscribe("ContractSize" + str(self.cid)) self.state = "CLOSED"
def __init__(self, logging, c, server, database, opts): Thread.__init__(self) phamServlet.__init__(self, logging, c) Subscriber.__init__(self) self.c = db_conf.db_conf(username=opts['user'], password=opts['password'], server=opts['server'], db=opts['database']).get_cursor() self.server, self.database = server, database self.subscribe("fasta") self.lastAccessed = time.time() self.waitTime = random.randint(5,15) self.busy = False self._logger = logger.logger(logging) self.status = 'avail'
def __init__(self, logging, c, server, database, opts): Thread.__init__(self) phamServlet.__init__(self, logging, c) Subscriber.__init__(self) #self.setDaemon(1) self.server, self.database = server, database self.c = db_conf.db_conf(username=opts['user'], password=opts['password'], server=opts['server'], db=opts['database']).get_cursor() self.subscribe("clustalw") self._logger = logger.logger(logging) self.publisher = phamPublisher()
def __init__(self, glock): gtk.Frame.__init__(self) Subscriber.__init__(self) self.glock = glock # self.subscribe("UpdateAccountValue") self.subscribe("UpdatePortfolio") # self.subscribe("UpdateAccountTime") self.setThreading(0) self.set_label("Portfolio") self.table = gtk.Table(100, 100, True) self.table.show() self.add(self.table) self.sw = gtk.ScrolledWindow() self.sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.liststore = gtk.ListStore(str, str, str, str, str, str, str, str) self.treeview = gtk.TreeView(self.liststore) self.fields = [ "contract", "position", "marketprice", "marketvalue", "averageCost", "unrealizedPnL", "realizedPnL", "accountName", ] self.columns = range(0, len(self.fields)) self.cells = range(0, len(self.fields)) for i in range(0, len(self.fields)): self.columns[i] = gtk.TreeViewColumn(self.fields[i]) self.treeview.append_column(self.columns[i]) self.cells[i] = gtk.CellRendererText() self.columns[i].pack_start(self.cells[i], True) self.columns[i].add_attribute(self.cells[i], "text", i) self.treeview.show() self.sw.add(self.treeview) self.sw.show() self.table.attach(self.sw, 0, 100, 0, 100) self.name2iter = dict()
def __init__(self, ticker, exchg, cur): Thread.__init__(self) Subscriber.__init__(self) self.cslock = Lock() self.mts = TimeSeries([]) self.lastbar = 0.0 self.position = "CLOSED" self.opentimeout = 10 self.closetimeout = 10 self.triggertimeout = 60 self.oid = -1 self.oidc = -1 self.ticker = ticker self.size = 100 self.open = [] self.close = [] o = Pyro.core.getProxyForURI("PYROLOC://localhost:8000/serverInterface") # stock that we want self.cid = o.addstock(ticker,exchg,cur) print "cid := " + str(self.cid) if (o.isActiveContract(self.cid) == 1): print "is already activated" else: print "activate := " + str(o.activateContract(self.cid)) # test values self.size = 100 self.barperiod = 10 self.N = 9 self.K = 1.8 self.K2 = 1.8 self.graphperiod = 6 self.opentimeout = 5 self.closetimeout = 1 self.stoplossN = 0.005 self.stopgainN = 0.01 self.mingainN = 20.0/self.size self.maxlossN = 20.0/self.size self.part = 0.9995 self.lastgraph = 0.0 self.subscribe("ContractPrice" + str(self.cid))
def __init__(self, logging, c, server, database, opts): Thread.__init__(self) phamServlet.__init__(self, logging, c) Subscriber.__init__(self) self.c = db_conf.db_conf(username=opts['user'], password=opts['password'], server=opts['server'], db=opts['database']).get_cursor() self.server, self.database = server, database self.subscribe("fasta") self.lastAccessed = time.time() self.waitTime = random.randint(5, 15) self.busy = False self._logger = logger.logger(logging) self.status = 'avail'
def __init__(self, publisher, logger): Subscriber.__init__(self) self.log_message = logger self.setThreading(False) self.publisher = publisher self.valueChangedMessages = None self.requestLock = True self.parameters = None self.song = None subscribed = [ PyroTrack.FIRE_CLIP, PyroDeviceParameter.SET_VALUE, PyroSong.GET_SONG_LAYOUT, PyroTrack.STOP_TRACK ] subscribed = [INCOMING_PREFIX + method for method in subscribed] self.log_message(subscribed) self.subscribe(subscribed)
def __init__(self, publisher, logger): Subscriber.__init__(self) self.log_message = logger self.setThreading(False) self.publisher = publisher self.valueChangedMessages = None self.requestLock = True self.parameters = None self.song = None subscribed = [ PyroTrack.FIRE_CLIP, PyroDeviceParameter.SET_VALUE, PyroSong.GET_SONG_LAYOUT, PyroTrack.STOP_TRACK] subscribed = [INCOMING_PREFIX + method for method in subscribed] self.log_message(subscribed) self.subscribe(subscribed)
def __init__(self, ticker, exchg, cur): Subscriber.__init__(self) self.cslock = Lock() # the timeseries self.bidprice = new TimeSeries([None, None, None, None]) self.bidsize = new TimeSeries([None, None, None, None]) self.askprice = new TimeSeries([None, None, None, None]) self.asksize = new TimeSeries([None, None, None, None]) self.lastprice = new TimeSeries([None, None, None, None]) self.lastsize = new TimeSeries([None, None, None, None]) self.highprice = new TimeSeries([None, None, None, None]) self.lowprice = new TimeSeries([None, None, None, None]) self.volumesize = new TimeSeries([None]) self.closeprice = new TimeSeries([None, None, None, None]) # stock that we want o = Pyro.core.getProxyForURI("PYROLOC://localhost:8000/serverInterface") self.cid = o.addstock(ticker, exchg, cur) print "cid := " + str(self.cid) if (o.isActiveContract(self.cid) == 1): print "is already activated" else: print "activate := " + str(o.activateContract(self.cid)) self.subscribe("ContractPrice" + str(self.cid)) self.subscribe("ContractSize" + str(self.cid))
def __init__(self): Subscriber.__init__(self)
def __init__(self): Subscriber.__init__(self) self.subscribe("NewBulletins")
def __init__(self, symbols, es_URI): Subscriber.__init__(self, esURI=es_URI) symbols=map(lambda s: 'STOCKQUOTE.'+s, symbols) self.subscribe(symbols)
def __init__(self): Subscriber.__init__(self) self.subscribe("UpdateAccountValue") self.subscribe("UpdatePortfolio") self.subscribe("UpdateAccountTime")
def __init__(self, pattern): Subscriber.__init__(self) self.subscribeMatch(pattern)
def __init__(self): Subscriber.__init__(self) self.subscribeMatch(r'^Distributed\.cell\..*$') self.tasks = {} self.counter = 0
def __init__(self, function): Subscriber.__init__(self) self.subscribe('hdfDone') #self.subscribe('Status') self._function = function print('listening for events')
def __init__(self): Subscriber.__init__(self) self.subscribeMatch(r'^Distributed\.cell\..*$') self.tasks={} self.counter=0
def __init__(self): Publisher.__init__(self) Subscriber.__init__(self) self.chatbox = Pyro.core.getProxyForURI('PYRONAME://'+CHAT_SERVER_NAME)
def __init__(self, symbols): Subscriber.__init__(self) symbols = map(lambda s: 'STOCKQUOTE.' + s, symbols) self.subscribe(symbols)
def __init__(self): Publisher.__init__(self) Subscriber.__init__(self) self.chatbox = Pyro.core.getProxyForURI('PYRONAME://' + CHAT_SERVER_NAME)