當前位置: 首頁>>代碼示例>>Python>>正文


Python ExceptionalThread.__init__方法代碼示例

本文整理匯總了Python中twitter.common.exceptions.ExceptionalThread.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python ExceptionalThread.__init__方法的具體用法?Python ExceptionalThread.__init__怎麽用?Python ExceptionalThread.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在twitter.common.exceptions.ExceptionalThread的用法示例。


在下文中一共展示了ExceptionalThread.__init__方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
  def __init__(
      self,
      task_id,
      task_monitor,
      disk_collector_provider=DiskCollectorProvider(),
      process_collection_interval=PROCESS_COLLECTION_INTERVAL,
      disk_collection_interval=DiskCollectorSettings.DISK_COLLECTION_INTERVAL,
      history_time=HISTORY_TIME,
      history_provider=HistoryProvider()):

    """
      task_monitor: TaskMonitor object specifying the task whose resources should be monitored
      sandbox: Directory for which to monitor disk utilisation
    """
    self._task_monitor = task_monitor  # exposes PIDs, sandbox
    self._task_id = task_id
    log.debug('Initialising resource collection for task %s', self._task_id)
    self._process_collectors = dict()  # ProcessStatus => ProcessTreeCollector

    self._disk_collector_provider = disk_collector_provider
    self._disk_collector = None
    self._process_collection_interval = process_collection_interval.as_(Time.SECONDS)
    self._disk_collection_interval = disk_collection_interval.as_(Time.SECONDS)
    min_collection_interval = min(self._process_collection_interval, self._disk_collection_interval)
    self._history = history_provider.provides(history_time, min_collection_interval)
    self._kill_signal = threading.Event()
    ExceptionalThread.__init__(self, name='%s[%s]' % (self.__class__.__name__, task_id))
    self.daemon = True
開發者ID:apache,項目名稱:aurora,代碼行數:30,代碼來源:resource.py

示例2: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self,
              checkpoint_root,
              verbose=True,
              task_killer=TaskKiller,
              executor_detector=ExecutorDetector,
              task_garbage_collector=TaskGarbageCollector,
              clock=time):
   ExecutorBase.__init__(self)
   ExceptionalThread.__init__(self)
   self.daemon = True
   self._stop_event = threading.Event()
   # mapping of task_id => (TaskInfo, AdjustRetainedTasks), in the order in
   # which they were received via a launchTask.
   self._gc_task_queue = OrderedDict()
   # cache the ExecutorDriver provided by the slave, so we can use it out
   # of band from slave-initiated callbacks.  This should be supplied by
   # ExecutorBase.registered() when the executor first registers with the
   # slave.
   self._driver = None
   self._slave_id = None  # cache the slave ID provided by the slave
   self._task_id = None  # the task_id currently being executed by the ThermosGCExecutor, if any
   self._start_time = None  # the start time of a task currently being executed, if any
   self._detector = executor_detector()
   self._collector = task_garbage_collector(root=checkpoint_root)
   self._clock = clock
   self._task_killer = task_killer
   self._checkpoint_root = checkpoint_root
   self._dropped_tasks = AtomicGauge('dropped_tasks')
   self.metrics.register(self._dropped_tasks)
開發者ID:josephglanville,項目名稱:incubator-aurora,代碼行數:31,代碼來源:gc_executor.py

示例3: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self,
              task_id,
              task_monitor,
              process_collector=ProcessTreeCollector,
              disk_collector=DiskCollector,
              process_collection_interval=Amount(20, Time.SECONDS),
              disk_collection_interval=Amount(1, Time.MINUTES),
              history_time=Amount(1, Time.HOURS)):
   """
     task_monitor: TaskMonitor object specifying the task whose resources should be monitored
     sandbox: Directory for which to monitor disk utilisation
   """
   self._task_monitor = task_monitor  # exposes PIDs, sandbox
   self._task_id = task_id
   log.debug('Initialising resource collection for task %s' % self._task_id)
   self._process_collectors = dict()  # ProcessStatus => ProcessTreeCollector
   self._process_collector_factory = process_collector
   self._disk_collector_class = disk_collector
   self._disk_collector = None
   self._process_collection_interval = process_collection_interval.as_(Time.SECONDS)
   self._disk_collection_interval = disk_collection_interval.as_(Time.SECONDS)
   min_collection_interval = min(self._process_collection_interval, self._disk_collection_interval)
   history_length = int(history_time.as_(Time.SECONDS) / min_collection_interval)
   if history_length > self.MAX_HISTORY:
     raise ValueError("Requested history length too large")
   log.debug("Initialising ResourceHistory of length %s" % history_length)
   self._history = ResourceHistory(history_length)
   self._kill_signal = threading.Event()
   ExceptionalThread.__init__(self, name='%s[%s]' % (self.__class__.__name__, task_id))
   self.daemon = True
開發者ID:AltanAlpay,項目名稱:aurora,代碼行數:32,代碼來源:resource.py

示例4: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self, clock=time):
   self._clock = clock
   self._self = psutil.Process(os.getpid())
   self._orphan = False
   self.metrics.register(LambdaGauge('orphan', lambda: int(self._orphan)))
   self._metrics = dict((metric, MutatorGauge(metric, 0)) for metric in self.MUTATOR_METRICS)
   for metric in self._metrics.values():
     self.metrics.register(metric)
   ExceptionalThread.__init__(self)
   self.daemon = True
開發者ID:apache,項目名稱:aurora,代碼行數:12,代碼來源:executor_vars.py

示例5: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self, root, resource_monitor_class=TaskResourceMonitor):
   self._pathspec = TaskPath(root=root)
   self._detector = TaskDetector(root)
   if not issubclass(resource_monitor_class, ResourceMonitorBase):
     raise ValueError("resource monitor class must implement ResourceMonitorBase!")
   self._resource_monitor = resource_monitor_class
   self._active_tasks = {}    # task_id => ActiveObservedTask
   self._finished_tasks = {}  # task_id => FinishedObservedTask
   self._stop_event = threading.Event()
   ExceptionalThread.__init__(self)
   Lockable.__init__(self)
   self.daemon = True
開發者ID:betepahos,項目名稱:incubator-aurora,代碼行數:14,代碼來源:task_observer.py

示例6: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self, clock=time):
     self._clock = clock
     self._self = psutil.Process(os.getpid())
     if hasattr(self._self, "getcwd"):
         self._version = self.get_release_from_binary(os.path.join(self._self.getcwd(), self._self.cmdline[1]))
     else:
         self._version = "UNKNOWN"
     self.metrics.register(NamedGauge("version", self._version))
     self._orphan = False
     self.metrics.register(LambdaGauge("orphan", lambda: int(self._orphan)))
     self._metrics = dict((metric, MutatorGauge(metric, 0)) for metric in self.MUTATOR_METRICS)
     for metric in self._metrics.values():
         self.metrics.register(metric)
     ExceptionalThread.__init__(self)
     self.daemon = True
開發者ID:sumanau7,項目名稱:incubator-aurora,代碼行數:17,代碼來源:executor_vars.py

示例7: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self, clock=time):
   self._clock = clock
   self._self = psutil.Process(os.getpid())
   try:
     self._version = self.get_release_from_binary(
       os.path.join(self._self.cwd(), self._self.cmdline()[1]))
   except (IndexError, psutil.Error):
     self._version = 'UNKNOWN'
   self.metrics.register(NamedGauge('version', self._version))
   self._orphan = False
   self.metrics.register(LambdaGauge('orphan', lambda: int(self._orphan)))
   self._metrics = dict((metric, MutatorGauge(metric, 0)) for metric in self.MUTATOR_METRICS)
   for metric in self._metrics.values():
     self.metrics.register(metric)
   ExceptionalThread.__init__(self)
   self.daemon = True
開發者ID:frew,項目名稱:incubator-aurora,代碼行數:18,代碼來源:executor_vars.py

示例8: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self,
              path_detector,
              resource_monitor_class=TaskResourceMonitor,
              interval=POLLING_INTERVAL):
   self._detector = ObserverTaskDetector(
       path_detector,
       self.__on_active,
       self.__on_finished,
       self.__on_removed)
   if not issubclass(resource_monitor_class, ResourceMonitorBase):
     raise ValueError("resource monitor class must implement ResourceMonitorBase!")
   self._resource_monitor_class = resource_monitor_class
   self._interval = interval
   self._active_tasks = {}    # task_id => ActiveObservedTask
   self._finished_tasks = {}  # task_id => FinishedObservedTask
   self._stop_event = threading.Event()
   ExceptionalThread.__init__(self)
   Lockable.__init__(self)
   self.daemon = True
開發者ID:AltanAlpay,項目名稱:aurora,代碼行數:21,代碼來源:task_observer.py

示例9: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self,
              path_detector,
              interval=POLLING_INTERVAL,
              task_process_collection_interval=TaskResourceMonitor.PROCESS_COLLECTION_INTERVAL,
              task_disk_collection_interval=TaskResourceMonitor.DISK_COLLECTION_INTERVAL):
   self._detector = ObserverTaskDetector(
       path_detector,
       self.__on_active,
       self.__on_finished,
       self.__on_removed)
   self._interval = interval
   self._task_process_collection_interval = task_process_collection_interval
   self._task_disk_collection_interval = task_disk_collection_interval
   self._active_tasks = {}    # task_id => ActiveObservedTask
   self._finished_tasks = {}  # task_id => FinishedObservedTask
   self._stop_event = threading.Event()
   ExceptionalThread.__init__(self)
   Lockable.__init__(self)
   self.daemon = True
開發者ID:ssalevan,項目名稱:aurora,代碼行數:21,代碼來源:task_observer.py

示例10: __init__

# 需要導入模塊: from twitter.common.exceptions import ExceptionalThread [as 別名]
# 或者: from twitter.common.exceptions.ExceptionalThread import __init__ [as 別名]
 def __init__(self, period, clock):
   self._stop = threading.Event()
   self._period = period
   self._clock = clock
   ExceptionalThread.__init__(self)
   self.daemon = True
開發者ID:BabyDuncan,項目名稱:commons,代碼行數:8,代碼來源:sampler.py


注:本文中的twitter.common.exceptions.ExceptionalThread.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。