def __init__(self, *args, **kwargs): Worker.__init__(self, *args, **kwargs) threading.Thread.__init__(self) self.tid = None self.killed = False # NOTE: Make it as a daemon thread because it is not possible to kill # a thread externally in Python. In this way, terminating the # root process automatically terminates child threads as well. self.daemon = True
def __init__(self, objcolor, objradius, scene, script, interval, title): self.title = title self.wltype = script if(script=="norm"): self.loadGen = WSWorkloadGenerator(scene, interval) else: self.loadGen = ScriptWorkloadGenerator(scene,script, interval) Worker.__init__(self, objcolor, objradius, scene, self.loadGen,title)
def __init__(self, objcolor, objradius, scene, script, interval, title): self.title = title self.wltype = script if (script == "norm"): self.loadGen = WSWorkloadGenerator(scene, interval) else: self.loadGen = ScriptWorkloadGenerator(scene, script, interval) Worker.__init__(self, objcolor, objradius, scene, self.loadGen, title)
def __init__(self): Widget.__init__(self) Worker.__init__(self) self._keyboard = Window.request_keyboard(self._keyboard_closed, self) self._keyboard.bind(on_key_down=self.__on_key_down) # OutputExecutor Clock.schedule_interval(self.__update_frame, 1.0/60.0) self._mission_out = []
def __init__(self, murmur, context_callback_type, cfg = Config(default = cfg_default)): Worker.__init__(self, "MumoManager") self.queues = {} # {queue:module} self.modules = {} # {name:module} self.imports = {} # {name:import} self.cfg = cfg self.murmur = murmur self.meta = None self.client_adapter = None self.metaCallbacks = {} # {sid:{queue:[handler]}} self.serverCallbacks = {} self.context_callback_type = context_callback_type
def __init__(self, config, no_cache=False): Worker.__init__(self) self._key = config.get('LastFM', 'key', None) self._lfm = Api(self._key, no_cache=no_cache) self._db = DB(config.get('LastFM', 'path', join(config.configdir(), 'echonest.db'))) self._db.execute( u"CREATE TABLE IF NOT EXISTS artist_lookup "\ "(artist text, timestamp integer, "\ "PRIMARY KEY(artist))") self._db.execute( u"CREATE TABLE IF NOT EXISTS track_lookup "\ "(artist text, title text, timestamp integer, "\ "PRIMARY KEY(artist, title))") self._db.commit()
def __init__(self, mat_path, tol, max_iteration): """ """ #print ("WorkerIterativeLinearSystemSolver works good") Worker.__init__(self) self._hist_list = [] if mat_path == "": """ Need to generatre matrix """ print("calling self._matrix_generation") #self._mat = self._matrix_generation() else: self._mat = io.mmread(mat_path) print("Done reading matrix {}, Row:{}, Col:{}".format( mat_path, self._mat.shape[0], self._mat.shape[1])) self._tol = tol self._max_iteration = max_iteration
def __init__(self, mat_path): """ """ #print ("WorkerIterativeLinearSystemSolver works good") Worker.__init__(self) self._hist_list = [] if mat_path == "NeedMatGeneration": """ Need to generatre matrix """ print("please call obj.matrix_generation(dim ,left_semi_bw, right_semi_bw, val_min, val_max)") else: self._mat_coo = io.mmread(mat_path) self._mat = self._mat_coo.tocsr() self._mat_info = io.mminfo(mat_path) print("Done reading matrix {}, Row:{}, Col:{}".format( mat_path, self._mat.shape[0], self._mat.shape[1])) print("mminfo:{}".format(self._mat_info)) if self._mat.getformat() == "csr": print("Yeah, it is CSR")
def __init__(self, name, manager, configuration = None): Worker.__init__(self, name, manager.getQueue()) self.__manager = manager if isinstance(configuration, basestring): # If we are passed a string expect a config file there if configuration: self.__cfg = Config(configuration, self.default_config) elif self.default_config: self.__cfg = Config(default = self.default_config) else: self.__cfg = None else: # If we aren't passed a string it will be a config object or None self.__cfg = configuration self.log().info("Initialized")
def __init__(self, name, manager, configuration=None): Worker.__init__(self, name, manager.getQueue()) self.__manager = manager if isinstance(configuration, basestring): # If we are passed a string expect a config file there if configuration: self.__cfg = Config(configuration, self.default_config) elif self.default_config: self.__cfg = Config(default=self.default_config) else: self.__cfg = None else: # If we aren't passed a string it will be a config object or None self.__cfg = configuration self.log().info("Initialized")
def __init__(self, mat_path): """ """ #print ("WorkerIterativeLinearSystemSolver works good") Worker.__init__(self) self._hist_list = [] if mat_path == "": """ Need to generatre matrix """ print("calling self._matrix_generation") #self._mat = self._matrix_generation() else: self._mat_coo = io.mmread(mat_path) self._mat = self._mat_coo.tocsr() self._mat_info = io.mminfo(mat_path) print("Done reading matrix {}, Row:{}, Col:{}".format( mat_path, self._mat.shape[0], self._mat.shape[1])) print("mminfo:{}".format(self._mat_info)) if self._mat.getformat() == "csr": print("Yeah, it is CSR")
def __init__(self): Worker.__init__(self) threading.Thread.__init__(self) self.__workers = [] self.__queue = Queue.Queue()
def __init__(self, name, message_queue): Worker.__init__(self, name, message_queue) self.event = Event() self.val = None self.started = False self.stopped = False
def __init__(self, server, coreset_size): Worker.__init__(self, server, coreset_size)
def __init__(self, exit_flag, job_queue, done_queue, api_keys): Worker.__init__(self, exit_flag, job_queue, done_queue, -1) self.api_key_manager = ApiKeyManager(api_keys)
def __init__(self, exit_flag, job_queue, done_queue, api_key_manager): Worker.__init__(self, exit_flag, job_queue, done_queue, -1) self.crud = MongoCRUD()
def __init__(self, *args, **kwargs): Worker.__init__(self, *args, **kwargs) multiprocessing.Process.__init__(self)
def __init__(self, config): Log.__init__(self, self._title) self._logger.info(u"init") Worker.__init__(self, lifo=False) self._config = config self._library_filename = self._config.get('Library', 'path', join(self._config.configdir(), 'library.pkl')) Factories.clear() Logger.set_logger(self._logger) if self._config.get('TrackRelation', 'use_db', True): TrackRelationFactory.use_db() TrackRelationFactory.set_path(self._config.get('TrackRelation', 'path', join(self._config.configdir(), ''))) else: TrackRelationFactory.use_fs() TrackRelationFactory.set_path(self._config.get('TrackRelation', 'path', join(self._config.configdir(), 'track'))) TrackRelationFactory.set_maxentries( self._config.get('TrackRelation', 'maxentries', 500)) if self._config.get('ArtistRelation', 'use_db', True): ArtistRelationFactory.use_db() ArtistRelationFactory.set_path(self._config.get('ArtistRelation', 'path', join(self._config.configdir(), ''))) else: ArtistRelationFactory.use_fs() ArtistRelationFactory.set_path(self._config.get('ArtistRelation', 'path', join(self._config.configdir(), 'artist'))) ArtistRelationFactory.set_maxentries( self._config.get('ArtistRelation', 'maxentries', 500)) if self._config.get('Lookup', 'QueueResults', 'False') == 'True': self._queue_lookup_results = True else: self._queue_lookup_results = False # FIXME: log if one of those libs is not present if self._config.get('Lookup', 'UseLastFM', 'True') == 'True': self._lastfm = LastFM(config) self._lastfm.start() self._thres_lastfm_lookup = self._config.getint('Lookup', 'ThresholdLastFM', self._thres_lastfm_lookup) if self._config.get('Lookup', 'UseEchoNest', 'True') == 'True': self._echonest = EchoNest(config) self._echonest.start() self._thres_echonest_lookup = self._config.getint('Lookup', 'ThresholdEchoNest', self._thres_echonest_lookup) # read, normalize and update ranking factors factor = 0.0 for k in self._factor_ranking.keys(): self._factor_ranking[k] = self._config.getfloat('Ranking', "factor%s" % k, self._factor_ranking[k]) factor += self._factor_ranking[k] for k in self._factor_ranking.keys(): self._factor_ranking[k] /= factor self._config.set('Ranking', "factor%s" % k, self._factor_ranking[k]) self._relation_decay = self._config.getfloat('Ranking', 'RelationDecay', self._relation_decay) self._queue_update_factor = self._config.getfloat('Rating', 'QueueUpdateFactor', self._queue_update_factor) self._unplayed_rating = self._config.getfloat('Ranking', 'UnplayedRating', self._unplayed_rating) self._thres_track_lastplayed = self._config.getint('Ranking', 'ThresholdTrackLastPlayed', self._thres_track_lastplayed) self._thres_track_laststarted= self._config.getint('Ranking', 'ThresholdTrackLastStarted', self._thres_track_laststarted) self._thres_track_lastqueued= self._config.getint('Ranking', 'ThresholdTrackLastQueued', self._thres_track_lastqueued) self._thres_artist_lastplayed = self._config.getint('Ranking', 'ThresholdArtistLastPlayed', self._thres_artist_lastplayed) self._thres_artist_laststarted= self._config.getint('Ranking', 'ThresholdArtistLastStarted', self._thres_artist_laststarted) self._thres_artist_lastqueued= self._config.getint('Ranking', 'ThresholdArtistLastQueued', self._thres_artist_lastqueued)
def __init__(self, table, logger): Worker.__init__(self, 'Root', 'Root', table, logger, None) # always running self.change_state('RUNNING')