def __init__(self, test_list, contest_id=None, workers=1): self.start_time = datetime.datetime.now() # Map from task name to (task id, task_module). self.task_id_map = {} # Random bit to append to object's names to avoid collisions. self.rand = random.randint(0, 999999999) self.num_users = 0 # Load config from cms.conf. TestRunner.load_cms_conf() if CONFIG["TEST_DIR"] is not None: # Set up our expected environment. os.chdir("%(TEST_DIR)s" % CONFIG) os.environ["PYTHONPATH"] = "%(TEST_DIR)s" % CONFIG TestRunner.start_generic_services(workers) initialize_aws(self.rand) if contest_id is None: self.contest_id = self.create_contest() else: self.contest_id = int(contest_id) self.user_id = self.create_or_get_user() self.failures = [] self.test_list = test_list self.n_tests = len(test_list) self.n_submissions = sum(len(test.languages) for test in test_list) logging.info("Have %s submissions in %s tests...", self.n_submissions, self.n_tests)
def __init__(self, test_list, contest_id=None, workers=1): self.start_time = datetime.datetime.now() # Map from task name to (task id, task_module). self.task_id_map = {} # Random bit to append to object's names to avoid collisions. self.rand = random.randint(0, 999999999) self.num_users = 0 # Load config from cms.conf. TestRunner.load_cms_conf() if CONFIG["TEST_DIR"] is not None: # Set up our expected environment. os.chdir("%(TEST_DIR)s" % CONFIG) os.environ["PYTHONPATH"] = "%(TEST_DIR)s" % CONFIG TestRunner.start_generic_services(workers) initialize_aws(self.rand) if contest_id is None: self.contest_id = self.create_contest() else: self.contest_id = int(contest_id) self.user_id = self.create_or_get_user() self.failures = [] self.test_list = test_list self.n_tests = len(test_list) self.n_submissions = sum(len(test.languages) for test in test_list) logging.info("Have %s submissions in %s tests...", self.n_submissions, self.n_tests)