def run(dry_run, thread_pool_size=10, io_dir='throughput/'): saas_file_owners_diffs = read_saas_file_owners_diffs(io_dir) if len(saas_file_owners_diffs) == 0: return available_thread_pool_size = \ threaded.estimate_available_thread_pool_size( thread_pool_size, len(saas_file_owners_diffs)) exit_codes = threaded.run( osd_run_wrapper, saas_file_owners_diffs, thread_pool_size, dry_run=dry_run, available_thread_pool_size=available_thread_pool_size) if [ec for ec in exit_codes if ec]: sys.exit(1)
def __init__(self, saas_files, thread_pool_size, gitlab, integration, integration_version, settings, jenkins_map=None, accounts=None, validate=False): self.saas_files = saas_files if validate: self._validate_saas_files() if not self.valid: return self.thread_pool_size = thread_pool_size self.gitlab = gitlab self.integration = integration self.integration_version = integration_version self.settings = settings self.secret_reader = SecretReader(settings=settings) self.namespaces = self._collect_namespaces() self.jenkins_map = jenkins_map # each namespace is in fact a target, # so we can use it to calculate. divisor = len(self.namespaces) or 1 self.available_thread_pool_size = \ threaded.estimate_available_thread_pool_size( self.thread_pool_size, divisor) # if called by a single saas file,it may # specify that it manages resources exclusively. self.take_over = self._get_saas_file_attribute('takeover') self.compare = self._get_saas_file_attribute('compare') self.publish_job_logs = self._get_saas_file_attribute('publishJobLogs') if accounts: self._initiate_state(accounts)