Beispiel #1
0
def setup(pipe_config, supplied_mon_coords=None):
    """
    Initialises the pipeline run.
    """
    if not supplied_mon_coords:
        supplied_mon_coords = []

    # Setup logfile before we do anything else
    log_dir = pipe_config.logging.log_dir
    setup_logging(log_dir, debug=pipe_config.logging.debug,
                  use_colorlog=pipe_config.logging.colorlog)

    job_dir = pipe_config.DEFAULT.job_directory
    if not os.access(job_dir, os.X_OK):
        msg = "can't access job folder %s" % job_dir
        logger.error(msg)
        raise IOError(msg)
    logger.info("Job dir: %s", job_dir)

    db_config = get_database_config(pipe_config.database, apply=True)
    dump_database_backup(db_config, job_dir)

    job_config = load_job_config(pipe_config)
    dump_configs_to_logdir(log_dir, job_config, pipe_config)

    sync_rejectreasons(tkp.db.Database().Session())

    job_config, dataset_id = initialise_dataset(job_config, supplied_mon_coords)

    return job_dir, job_config, dataset_id
Beispiel #2
0
def setup(pipe_config, supplied_mon_coords=None):
    """
    Initialises the pipeline run.
    """
    if not supplied_mon_coords:
        supplied_mon_coords = []

    # Setup logfile before we do anything else
    log_dir = pipe_config.logging.log_dir
    setup_logging(log_dir,
                  debug=pipe_config.logging.debug,
                  use_colorlog=pipe_config.logging.colorlog)

    job_dir = pipe_config.DEFAULT.job_directory
    if not os.access(job_dir, os.X_OK):
        msg = "can't access job folder %s" % job_dir
        logger.error(msg)
        raise IOError(msg)
    logger.info("Job dir: %s", job_dir)

    db_config = get_database_config(pipe_config.database, apply=True)
    dump_database_backup(db_config, job_dir)

    job_config = load_job_config(pipe_config)
    dump_configs_to_logdir(log_dir, job_config, pipe_config)

    sync_rejectreasons(tkp.db.Database().Session())

    job_config, dataset_id = initialise_dataset(job_config,
                                                supplied_mon_coords)

    return job_dir, job_config, dataset_id
Beispiel #3
0
    def test_rejectreasons_sync(self):
        """
        Delete a rejectreason, then re-sync and double check the counts match.
        """
        reason = self.session.query(Rejectreason).all()[-1]
        print "Deleting reason id", reason.id
        self.session.delete(reason)
        self.assertNotEqual(
            self.session.query(Rejectreason).count(),
            len(dbqual.reject_reasons))

        dbqual.sync_rejectreasons(self.session)
        self.session.flush()
        self.assertEqual(
            self.session.query(Rejectreason).count(),
            len(dbqual.reject_reasons))
Beispiel #4
0
    def test_rejectreasons_sync(self):
        """
        Delete a rejectreason, then re-sync and double check the counts match.
        """
        reason = self.session.query(Rejectreason).all()[-1]
        print "Deleting reason id", reason.id
        self.session.delete(reason)
        self.assertNotEqual(
            self.session.query(Rejectreason).count(),
            len(dbqual.reject_reasons))

        dbqual.sync_rejectreasons(self.session)
        self.session.flush()
        self.assertEqual(
            self.session.query(Rejectreason).count(),
            len(dbqual.reject_reasons))