Beispiel #1
0
def update_clusters_progress():
    """Calculate the installing progress of the given cluster."""
    logging.info('update_clusters_progress')
    try:
        update_progress.update_progress()
    except Exception as error:
        logging.exception(error)
Beispiel #2
0
def update_clusters_progress(cluster_hosts):
    """Calculate the installing progress of the given cluster.

    :param cluster_hosts: the cluster and hosts of each cluster to update.
    :type cluster_hosts: dict of int to list of int
    """
    update_progress.update_progress(cluster_hosts)
Beispiel #3
0
def update_clusters_progress():
    """Calculate the installing progress of the given cluster."""
    logging.info('update_clusters_progress')
    try:
        update_progress.update_progress()
    except Exception as error:
        logging.exception(error)
Beispiel #4
0
def update_clusters_progress(cluster_hosts):
    """Calculate the installing progress of the given cluster.

    :param cluster_hosts: the cluster and hosts of each cluster to update.
    :type cluster_hosts: dict of int to list of int
    """
    try:
        update_progress.update_progress(cluster_hosts)
    except Exception as error:
        logging.exception(error)
Beispiel #5
0
def update_clusters_progress(cluster_hosts):
    """Calculate the installing progress of the given cluster.

    :param cluster_hosts: the cluster and hosts of each cluster to update.
    :type cluster_hosts: dict of int to list of int
    """
    try:
        update_progress.update_progress(cluster_hosts)
    except Exception as error:
        logging.exception(error)
def progress_update():
    """entry function."""
    if flags.OPTIONS.async:
        celery.send_task('compass.tasks.update_progress', ())
    else:
        try:
            update_progress.update_progress()
        except Exception as error:
            logging.error('failed to update progress')
            logging.exception(error)
Beispiel #7
0
def progress_update():
    """entry function."""
    if flags.OPTIONS. async:
        celery.send_task('compass.tasks.update_progress', ())
    else:
        try:
            update_progress.update_progress()
        except Exception as error:
            logging.error('failed to update progress')
            logging.exception(error)
def progress_update(cluster_hosts):
    """entry function."""
    if flags.OPTIONS.async:
        celery.send_task('compass.tasks.update_progress', (cluster_hosts,))
    else:
        try:
            update_progress.update_progress(cluster_hosts)
        except Exception as error:
            logging.error('failed to update progress for cluster_hosts: %s',
                          cluster_hosts)
            logging.exception(error)
def progress_update(cluster_hosts):
    """entry function."""
    if flags.OPTIONS. async:
        celery.send_task('compass.tasks.update_progress', (cluster_hosts, ))
    else:
        try:
            update_progress.update_progress(cluster_hosts)
        except Exception as error:
            logging.error('failed to update progress for cluster_hosts: %s',
                          cluster_hosts)
            logging.exception(error)
 def test_update_progress_checkpoint5(self):
     self._prepare_database()
     self._file_generator('check_point_5')
     update_progress.update_progress()
     clusterhost_state = cluster.get_clusterhost_state(
         self.clusterhost_id,
         user=self.user_object,
     )
     self.assertEqual(
         clusterhost_state['percentage'],
         self.check_points['check_point_5']['percentage']
     )
Beispiel #11
0
    def _test(self, config_file):
        full_path = '%s/data/%s' % (
            os.path.dirname(os.path.abspath(__file__)),
            config_file)
        config_file_path = '%s/%s' % (
            full_path, config_file)

        class _TmpLogMocker:
            """Mocks logs from a check point."""

            def __init__(in_self, source_path, check_point, tmp_logdir):
                in_self.source_path = source_path
                in_self.check_point = check_point
                in_self.__logdir__ = tmp_logdir

            def _merge_logs(in_self):
                dest = in_self.__logdir__
                source = os.path.join(
                    in_self.source_path, in_self.check_point)
                shutil.copytree(source, dest)
                for root, sub_dir, files in os.walk(dest):
                    for file in files:
                        new_name = file.replace(".template", "")
                        os.rename(
                            os.path.join(root, file),
                            os.path.join(root, new_name))

        config_globals = {}
        config_locals = {}
        execfile(config_file_path, config_globals, config_locals)
        self._prepare_database(config_locals)
        cluster_hosts = {}
        with database.session() as session:
            clusters = session.query(Cluster).all()
            for cluster in clusters:
                cluster_hosts[cluster.id] = [
                    host.id for host in cluster.hosts]

        mock_log_path = os.path.join(full_path, "anamon")
        check_points = os.listdir(mock_log_path)
        check_points = sortCheckPoints(check_points)
        for check_point in check_points:
            tmp_logdir = os.path.join('/tmp/mocklogs', str(uuid.uuid4()))
            log_mocker = _TmpLogMocker(mock_log_path, check_point, tmp_logdir)
            setting.INSTALLATION_LOGDIR = log_mocker.__logdir__
            logging.info('temp logging dir set to: %s',
                         setting.INSTALLATION_LOGDIR)
            log_mocker._merge_logs()
            reload(file_matcher)
            update_progress.update_progress(cluster_hosts)
            self._check_progress(config_locals, config_file, check_point)