def __init__(self, harness, params): MooseObject.__init__(self, harness, params) ## The test harness to run callbacks on self.harness = harness # Retrieve and store the TestHarness options for use in this object self.options = harness.getOptions() # The Scheduler class can be initialized with no "max_processes" argument and it'll default # to a soft limit. If however a max_processes is passed we'll treat it as a hard limit. # The difference is whether or not we allow single jobs to exceed the number of slots. if params['max_processes'] == None: self.available_slots = 1 self.soft_limit = True else: self.available_slots = params['max_processes'] # hard limit self.soft_limit = False # Requested average load level to stay below self.average_load = params['average_load'] # The time the status queue reported no activity to the TestHarness self.last_reported = clock() # A set containing jobs that have been reported self.jobs_reported = set([]) # Initialize run_pool based on available slots self.run_pool = ThreadPool(processes=self.available_slots) # Initialize status_pool to only use 1 process (to prevent status messages from getting clobbered) self.status_pool = ThreadPool(processes=1) # Slot Lock when processing resource allocations self.slot_lock = threading.Lock() # DAG Lock when processing the DAG self.dag_lock = threading.Lock() # Queue Lock when processing thread pool states self.queue_lock = threading.Lock() # Job Count Lock when processing job_queue_count self.job_queue_lock = threading.Lock() # Workers in use (single job might request multiple slots) self.slots_in_use = 0 # Jobs waiting to finish (includes actively running jobs) self.job_queue_count = 0 # Set containing our Job containers. We use this in the event of a KeyboardInterrupt to # iterate over and kill any subprocesses self.tester_datas = set([]) # Allow threads to set an exception state self.error_state = False
def __init__(self, name, params): MooseObject.__init__(self, name, params) self.specs = params self.outfile = None self.errfile = None self.joined_out = '' self.exit_code = 0 self.process = None self.tags = params['tags'] self.__caveats = set([]) # Bool if test can run self._runnable = None # Initialize the status bucket class self.status = util.TestStatus() # Enumerate the buckets here so ther are easier to work with in the tester class self.bucket_initialized = self.status.bucket_initialized self.bucket_success = self.status.bucket_success self.bucket_fail = self.status.bucket_fail self.bucket_diff = self.status.bucket_diff self.bucket_pending = self.status.bucket_pending self.bucket_finished = self.status.bucket_finished self.bucket_deleted = self.status.bucket_deleted self.bucket_skip = self.status.bucket_skip self.bucket_silent = self.status.bucket_silent self.bucket_queued = self.status.bucket_queued self.bucket_waiting_processing = self.status.bucket_waiting_processing # Set the status message if self.specs['check_input']: self.success_message = 'SYNTAX PASS' else: self.success_message = self.specs['success_message'] # Set up common paramaters self.should_execute = self.specs['should_execute'] self.check_input = self.specs['check_input'] if self.specs["allow_test_objects"]: self.specs["cli_args"].append("--allow-test-objects")
def __init__(self, name, params): MooseObject.__init__(self, name, params) self.specs = params self.outfile = None self.errfile = None self.joined_out = '' self.exit_code = 0 self.process = None self.tags = params['tags'] self.__caveats = set([]) # Bool if test can run self._runnable = None # Set up common paramaters self.should_execute = self.specs['should_execute'] self.check_input = self.specs['check_input'] if self.specs["allow_test_objects"]: self.specs["cli_args"].append("--allow-test-objects")
def __init__(self, name, params): MooseObject.__init__(self, name, params) self.specs = params self.outfile = None self.errfile = None self.joined_out = '' self.exit_code = 0 self.process = None self.tags = params['tags'] self.__caveats = set([]) # Alternate text we want to print as part of our status instead of the # pre-formatted status text (SYNTAX PASS instead of OK for example) self.__tester_message = '' # Bool if test can run self._runnable = None # Set up common paramaters self.should_execute = self.specs['should_execute'] self.check_input = self.specs['check_input'] if self.specs["allow_test_objects"]: self.specs["cli_args"].append("--allow-test-objects") ### Enumerate the tester statuses we want to use self.test_status = StatusSystem() self.no_status = self.test_status.no_status self.queued = self.test_status.queued self.skip = self.test_status.skip self.silent = self.test_status.silent self.success = self.test_status.success self.fail = self.test_status.fail self.diff = self.test_status.diff self.deleted = self.test_status.deleted self.__failed_statuses = [self.fail, self.diff, self.deleted] self.__skipped_statuses = [self.skip, self.silent]
def __init__(self, harness, params): MooseObject.__init__(self, harness, params) ## The test harness to run callbacks on self.harness = harness # Retrieve and store the TestHarness options for use in this object self.options = harness.getOptions() # The Scheduler class can be initialized with no "max_processes" argument and it'll default # to a soft limit. If however a max_processes is passed we'll treat it as a hard limit. # The difference is whether or not we allow single jobs to exceed the number of slots. if params['max_processes'] == None: self.available_slots = 1 self.soft_limit = True else: self.available_slots = params['max_processes'] # hard limit self.soft_limit = False self.average_load = params['average_load'] self.min_report_time = params['min_reported_time'] # Initialize run_pool based on available slots self.run_pool = ThreadPool(processes=self.available_slots) # Initialize status_pool to only use 1 process (to prevent status messages from getting clobbered) self.status_pool = ThreadPool(processes=1) # Slot lock when processing resource allocations and modifying slots_in_use self.slot_lock = threading.Lock() # Job lock when modifying a jobs status self.activity_lock = threading.Lock() # Job count lock when modifying incoming/outgoing jobs self.job_count_lock = threading.Lock() # A combination of processors + threads (-j/-n) currently in use, that a job requires self.slots_in_use = 0 # Count of jobs which need to complete self.job_count = 0 # Set containing all submitted jobs self.__job_bank = set([]) # Total running Job and Test failures encountered self.__failures = 0 # Allow threads to set a global exception self.__error_state = False # Private set of jobs currently running self.__active_jobs = set([]) # Jobs that are taking longer to finish than the alloted time are reported back early to inform # the user 'stuff' is still running. Jobs entering this set will not be reported again. self.jobs_reported = set([]) # The last time the scheduler reported something self.last_reported_time = clock() # Sets of threading objects created by jobs entering and exiting the queues. When scheduler.waitFinish() # is called, and both thread pools are empty, the pools shut down, and the call to waitFinish() returns. self.__status_pool_lock = threading.Lock() self.__runner_pool_lock = threading.Lock() self.__status_pool_jobs = set([]) self.__runner_pool_jobs = set([]) # True when scheduler.waitFinish() is called. This alerts the scheduler, no more jobs are # to be scheduled. KeyboardInterrupts are then handled by the thread pools. self.__waiting = False
def __init__(self, harness, params): MooseObject.__init__(self, harness, params) ## The test harness to run callbacks on self.harness = harness # Retrieve and store the TestHarness options for use in this object self.options = harness.getOptions() # The Scheduler class can be initialized with no "max_processes" argument and it'll default # to a soft limit. If however a max_processes is passed we'll treat it as a hard limit. # The difference is whether or not we allow single jobs to exceed the number of slots. if params['max_processes'] == None: self.available_slots = 1 self.soft_limit = True else: self.available_slots = params['max_processes'] # hard limit self.soft_limit = False self.average_load = params['average_load'] self.min_report_time = params['min_reported_time'] # Initialize run_pool based on available slots self.run_pool = ThreadPool(processes=self.available_slots) # Initialize status_pool to only use 1 process (to prevent status messages from getting clobbered) self.status_pool = ThreadPool(processes=1) # Slot lock when processing resource allocations and modifying slots_in_use self.slot_lock = threading.Lock() # Job lock when modifying a jobs status self.activity_lock = threading.Lock() # A combination of processors + threads (-j/-n) currently in use, that a job requires self.slots_in_use = 0 # Set containing all scheduled jobs self.__scheduled_jobs = set([]) # Set containing jobs entering the run_pool self.__job_bank = set([]) # Total running Job and Test failures encountered self.__failures = 0 # Allow threads to set a global exception self.__error_state = False # Private set of jobs currently running self.__active_jobs = set([]) # Jobs that are taking longer to finish than the alloted time are reported back early to inform # the user 'stuff' is still running. Jobs entering this set will not be reported again. self.jobs_reported = set([]) # The last time the scheduler reported something self.last_reported_time = clock() # Sets of threading objects created by jobs entering and exiting the queues. When scheduler.waitFinish() # is called, and both thread pools are empty, the pools shut down, and the call to waitFinish() returns. self.__status_pool_lock = threading.Lock() self.__runner_pool_lock = threading.Lock() self.__status_pool_jobs = set([]) self.__runner_pool_jobs = set([]) # True when scheduler.waitFinish() is called. This alerts the scheduler, no more jobs are # to be scheduled. KeyboardInterrupts are then handled by the thread pools. self.__waiting = False