Exemple #1
0
    def _get_or_start_metric_monitor(self, gc_window_s):
        """Get the metric monitor belonging to this serve cluster.

        If the metric monitor does not already exist, it will be started.
        """
        try:
            self.metric_monitor = ray.util.get_actor(SERVE_METRIC_MONITOR_NAME)
        except ValueError:
            logger.info("Starting metric monitor with name '{}'".format(
                SERVE_METRIC_MONITOR_NAME))
            self.metric_monitor = MetricMonitor.options(
                detached=True,
                name=SERVE_METRIC_MONITOR_NAME).remote(gc_window_s)
            # TODO(edoakes): move these into the constructor.
            start_metric_monitor_loop.remote(self.metric_monitor)
            self.metric_monitor.add_target.remote(self.router)
Exemple #2
0
    def init_or_get_metric_monitor(self, gc_window_seconds=3600):
        if "metric_monitor" not in self.actor_handle_cache:
            [handle] = ray.get(
                self.actor_nursery_handle.start_actor.remote(
                    MetricMonitor,
                    init_args=(gc_window_seconds, ),
                    tag="metric_monitor"))

            start_metric_monitor_loop.remote(handle)

            if "queue_actor" in self.actor_handle_cache:
                handle.add_target.remote(
                    self.actor_handle_cache["queue_actor"])

            self.refresh_actor_handle_cache()

        return self.actor_handle_cache["metric_monitor"]
Exemple #3
0
 def start_metric_monitor(self, gc_window_seconds):
     assert self.metric_monitor is None, "Metric monitor already started."
     self.metric_monitor = MetricMonitor.remote(gc_window_seconds)
     # TODO(edoakes): this should be an actor method, not a separate task.
     start_metric_monitor_loop.remote(self.metric_monitor)
     self.metric_monitor.add_target.remote(self.router)