Esempio n. 1
0
    def __prepare_locations(self):
        user_info = self.client.get_user_info()
        available_locations = {
            str(x['id']): x
            for x in user_info['locations']
            if not x['id'].startswith('harbor-')
        }
        for executor in self.executors:
            locations = self._get_locations(available_locations, executor)
            load = executor.get_load()

            for location in locations.keys():
                if location not in available_locations:
                    self.log.warning(
                        "List of supported locations for you is: %s",
                        sorted(available_locations.keys()))
                    raise ValueError("Invalid location requested: %s" %
                                     location)

            if executor.execution.get("locations-weighted", True):
                self.weight_locations(locations, load, available_locations)

            for location in locations.keys():
                self.log.info("Requesting %s machines for %s in %s",
                              locations[location],
                              humanize_time(load.duration), location)
Esempio n. 2
0
    def update(self):
        """
        Refresh widget values
        """
        if self.finished:
            return
        if self.executor.start_time:
            elapsed = time.time() - self.executor.start_time
            self.elapsed.set_text("Elapsed: %s" % humanize_time(elapsed))

            if self.duration:
                eta = self.duration - elapsed
                if eta >= 0:
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    self.eta.set_text("Overtime: %s" % humanize_time(-eta))

                self.progress.set_completion(elapsed)
            else:
                self.progress.set_text("Running...")

            if self.executor in self.executor.engine.provisioning.finished_modules:
                self.finished = True
                if self.duration:
                    self.progress.set_completion(self.duration)
                else:
                    self.progress.set_text("Finished")
                    self.eta.set_text("")
        elif isinstance(self.executor.delay, numeric_types):
            delayed = self.executor.delay - (
                time.time() - self.executor.engine.provisioning.start_time)
            if delayed >= 0:
                self.elapsed.set_text("Delay: %s" % humanize_time(delayed))
                if self.duration:
                    eta = self.duration + delayed
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    self.progress.set_text("Waiting...")

        self._invalidate()
Esempio n. 3
0
    def update(self):
        """
        Refresh widget values
        """
        if self.executor.start_time:
            elapsed = time.time() - self.executor.start_time
            self.elapsed.set_text("Elapsed: %s" % humanize_time(elapsed))

            if self.dur:
                eta = self.dur - elapsed
                if eta >= 0:
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    over = elapsed - self.dur
                    self.eta.set_text("Overtime: %s" % humanize_time(over))
            else:
                self.eta.set_text("")

            if isinstance(self.progress, urwid.ProgressBar):
                self.progress.set_completion(elapsed)

        self._invalidate()
Esempio n. 4
0
    def update(self):
        """
        Refresh widget values
        """
        if self.executor.start_time is not None:
            elapsed = time.time() - self.executor.start_time
            self.elapsed.set_text("Elapsed: %s" % humanize_time(elapsed))

            if self.duration:
                eta = self.duration - elapsed
                if eta >= 0:
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    over = elapsed - self.duration
                    self.eta.set_text("Overtime: %s" % humanize_time(over))
            else:
                self.eta.set_text("")

            if isinstance(self.progress, ProgressBar):
                # noinspection PyUnresolvedReferences
                self.progress.set_completion(elapsed)
        self._invalidate()
Esempio n. 5
0
    def update(self):
        """
        Refresh widget values
        """
        if self.executor.start_time is not None:
            elapsed = time.time() - self.executor.start_time
            self.elapsed.set_text("Elapsed: %s" % humanize_time(elapsed))

            if self.duration:
                eta = self.duration - elapsed
                if eta >= 0:
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    over = elapsed - self.duration
                    self.eta.set_text("Overtime: %s" % humanize_time(over))
            else:
                self.eta.set_text("")

            if isinstance(self.progress, ProgressBar):
                # noinspection PyUnresolvedReferences
                self.progress.set_completion(elapsed)
        self._invalidate()
Esempio n. 6
0
    def update(self):
        """
        Refresh widget values
        """
        if self.executor.start_time:
            elapsed = time.time() - self.executor.start_time
            self.elapsed.set_text("Elapsed: %s" % humanize_time(elapsed))

            if self.dur:
                eta = self.dur - elapsed
                if eta >= 0:
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    over = elapsed - self.dur
                    self.eta.set_text("Overtime: %s" % humanize_time(over))
            else:
                self.eta.set_text("")

            if isinstance(self.progress, urwid.ProgressBar):
                self.progress.set_completion(elapsed)

        self._invalidate()
Esempio n. 7
0
    def update(self):
        """
        Refresh widget values
        """
        if self.finished:
            return
        if self.executor.start_time:
            elapsed = time.time() - self.executor.start_time
            self.elapsed.set_text("Elapsed: %s" % humanize_time(elapsed))

            if self.duration:
                eta = self.duration - elapsed
                if eta >= 0:
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    self.eta.set_text("Overtime: %s" % humanize_time(-eta))

                self.progress.set_completion(elapsed)
            else:
                self.progress.set_text("Running...")

            if self.executor in self.executor.engine.provisioning.finished_modules:
                self.finished = True
                if self.duration:
                    self.progress.set_completion(self.duration)
                else:
                    self.progress.set_text("Finished")
                    self.eta.set_text("")
        elif isinstance(self.executor.delay, numeric_types):
            delayed = self.executor.delay - (time.time() - self.executor.engine.provisioning.start_time)
            if delayed >= 0:
                self.elapsed.set_text("Delay: %s" % humanize_time(delayed))
                if self.duration:
                    eta = self.duration + delayed
                    self.eta.set_text("ETA: %s" % humanize_time(eta))
                else:
                    self.progress.set_text("Waiting...")

        self._invalidate()
Esempio n. 8
0
    def add_data(self, data):
        """
        Append datapoint

        :type data: bzt.modules.aggregator.DataPoint
        """
        self.data = data
        self.percentiles.add_data(data)
        self.avg_times.add_data(data)
        self.rcodes.add_data(data)
        self.labels_pile.add_data(data)

        if not self._start_time:
            self._start_time = data.get('ts')
        duration = humanize_time(time.time() - self._start_time)

        self.title_widget.set_text(self.title + " %s " % duration)
Esempio n. 9
0
    def add_data(self, data):
        """
        Append datapoint

        :type data: bzt.modules.aggregator.DataPoint
        """
        self.data = data
        self.percentiles.add_data(data)
        self.avg_times.add_data(data)
        self.rcodes.add_data(data)
        self.labels_pile.add_data(data)

        if not self._start_time:
            self._start_time = data.get('ts')
        duration = humanize_time(time.time() - self._start_time)

        self.title_widget.set_text(" Cumulative Stats after %s " % duration)
Esempio n. 10
0
    def __prepare_locations(self):
        user_info = self.client.get_user_info()
        available_locations = {str(x['id']): x for x in user_info['locations'] if not x['id'].startswith('harbor-')}
        for executor in self.executors:
            locations = self._get_locations(available_locations, executor)
            load = executor.get_load()

            for location in locations.keys():
                if location not in available_locations:
                    self.log.warning("List of supported locations for you is: %s", sorted(available_locations.keys()))
                    raise ValueError("Invalid location requested: %s" % location)

            if executor.execution.get("locations-weighted", True):
                self.weight_locations(locations, load, available_locations)

            for location in locations.keys():
                self.log.info("Requesting %s machines for %s in %s",
                              locations[location], humanize_time(load.duration), location)