示例#1
0
    def test_can_store_and_read_jobs_from_kvs(self):
        self.job_ctxt._log_level = 'debug'
        self.job_ctxt.params['debug'] = self.job_ctxt.log_level
        try:
            self.job_ctxt.to_kvs()

            job_from_kvs = JobContext.from_kvs(self.job_ctxt.job_id)
            self.assertEqual(self.job_ctxt.params, job_from_kvs.params)
        finally:
            helpers.cleanup_loggers()
示例#2
0
    def test_can_store_and_read_jobs_from_kvs(self):
        self.job_ctxt._log_level = 'debug'
        self.job_ctxt.params['debug'] = self.job_ctxt.log_level
        try:
            self.job_ctxt.to_kvs()

            job_from_kvs = JobContext.from_kvs(self.job_ctxt.job_id)
            self.assertEqual(self.job_ctxt.params, job_from_kvs.params)
        finally:
            helpers.cleanup_loggers()
示例#3
0
    def setUp(self):
        # we init the logs before each test because nosetest redefines
        # sys.stdout and removes all the handlers from the rootLogger

        # reset logging config (otherwise will ignore logfile flag)
        cleanup_loggers()

        flags.FLAGS.debug = 'warn'
        flags.FLAGS.logfile = LOG_FILE_PATH
        logs.init_logs(log_type='console', level='warn')
        java.init_logs(log_type='console', level='warn')
示例#4
0
    def tearDown(self):
        # reset Log4j config
        jvm = java.jvm()
        jvm.JClass("org.apache.log4j.BasicConfigurator").resetConfiguration()
        jvm.JClass("org.apache.log4j.BasicConfigurator").configure()

        # reset logging config
        cleanup_loggers()

        # restore process name
        multiprocessing.current_process().name = self.process_name
示例#5
0
 def test_can_store_and_read_jobs_from_kvs(self):
     flags_debug_default = flags.FLAGS.debug
     flags.FLAGS.debug = "debug"
     try:
         self.job = helpers.job_from_file(os.path.join(helpers.DATA_DIR, CONFIG_FILE))
         job_from_kvs = CalculationProxy.from_kvs(self.job.job_id)
         self.assertEqual(flags.FLAGS.debug, job_from_kvs.params.pop("debug"))
         self.assertEqual(self.job, job_from_kvs)
     finally:
         helpers.cleanup_loggers()
         # Restore the default global FLAGS.debug level
         # so we don't break stuff.
         flags.FLAGS.debug = flags_debug_default
示例#6
0
    def setUp(self):
        # save and override process name
        self.process_name = multiprocessing.current_process().name
        multiprocessing.current_process().name = '->UnitTestProcess<-'

        # reset Log4j config
        jvm = java.jvm()
        jvm.JClass("org.apache.log4j.BasicConfigurator").resetConfiguration()

        # reset logging config
        cleanup_loggers()

        # setup AMQP logging
        logs.init_logs(log_type='amqp', level='debug')
        java.init_logs(log_type='amqp', level='debug')
        job.setup_job_logging('123')
示例#7
0
 def tearDown(self):
     # Stop all the started patches
     for patcher in self.patchers:
         patcher.stop()
     cleanup_loggers()
示例#8
0
 def tearDown(self):
     cleanup_loggers()
示例#9
0
 def setUp(self):
     cleanup_loggers()
 def tearDown(self):
     cleanup_loggers()
 def setUp(self):
     cleanup_loggers()
示例#12
0
 def tearDown(self):
     # Stop all the started patches
     for patcher in self.patchers:
         patcher.stop()
     cleanup_loggers()
示例#13
0
 def tearDown(self):
     # reset logging config
     cleanup_loggers()
示例#14
0
 def test_can_store_and_read_jobs_from_kvs(self):
     self.job = helpers.job_from_file(
         os.path.join(helpers.DATA_DIR, CONFIG_FILE))
     self.generated_files.append(self.job.super_config_path)
     self.assertEqual(self.job, Job.from_kvs(self.job.job_id))
     helpers.cleanup_loggers()