当前位置: 首页>>代码示例>>Python>>正文


Python Worker.__init__方法代码示例

本文整理汇总了Python中worker.Worker.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Worker.__init__方法的具体用法?Python Worker.__init__怎么用?Python Worker.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在worker.Worker的用法示例。


在下文中一共展示了Worker.__init__方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
    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
开发者ID:gullpong,项目名称:collabo,代码行数:12,代码来源:thread_worker.py

示例2: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
 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 = []
开发者ID:fatcloud,项目名称:fatcloud-util,代码行数:13,代码来源:kivy_worker.py

示例3: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
	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)
开发者ID:cbenning,项目名称:workviz,代码行数:13,代码来源:webserver.py

示例4: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
 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()
开发者ID:pscn,项目名称:ads,代码行数:17,代码来源:lookup_lastfm.py

示例5: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
    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
开发者ID:mumble-voip,项目名称:mumo,代码行数:17,代码来源:mumo_manager.py

示例6: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
    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
开发者ID:sclc,项目名称:NAEF,代码行数:18,代码来源:worker_exp_160503.py

示例7: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
    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")
开发者ID:sclc,项目名称:NAEF,代码行数:19,代码来源:worker_exp_160714.py

示例8: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
 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")
开发者ID:Stunner1984,项目名称:mumo,代码行数:19,代码来源:mumo_module.py

示例9: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
    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")
开发者ID:sclc,项目名称:NAEF,代码行数:20,代码来源:worker_exp_160605_isc16.py

示例10: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
 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)
开发者ID:vickyi,项目名称:koala,代码行数:5,代码来源:crawler.py

示例11: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
 def __init__(self, name, message_queue):
     Worker.__init__(self, name, message_queue)
     self.event = Event()
     self.val = None
     self.started = False
     self.stopped = False
开发者ID:Stunner1984,项目名称:mumo,代码行数:8,代码来源:worker_test.py

示例12: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
    def __init__(self, table, logger):
        Worker.__init__(self, 'Root', 'Root', table, logger, None)

        # always running
        self.change_state('RUNNING')
开发者ID:gullpong,项目名称:collabo,代码行数:7,代码来源:root_worker.py

示例13: __init__

# 需要导入模块: from worker import Worker [as 别名]
# 或者: from worker.Worker import __init__ [as 别名]
  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)
开发者ID:pscn,项目名称:ads,代码行数:83,代码来源:library.py


注:本文中的worker.Worker.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。