def setUp(self): django.setup() self.ingest = ingest_test_utils.create_ingest(file_name='my_file.txt') self.mount = 'host:/path' self.mount_on = os.path.join('my', 'test') self.workspace = storage_test_utils.create_workspace() self.config = StrikeConfiguration({ 'version': '1.0', 'mount': self.mount, 'transfer_suffix': '_tmp', 'files_to_ingest': [{ 'filename_regex': '.*txt', 'workspace_path': 'foo', 'workspace_name': self.workspace.name, }], }) self.job_exe = job_test_utils.create_job_exe() self.strike_proc = StrikeProcessor(1, self.job_exe.id, self.config) self.strike_dir = SCALE_INGEST_MOUNT_PATH
def _init_processor(self, strike_id): '''Creates and initializes a Strike processor for the given Strike ID :param strike_id: The ID of the Strike process :type strike_id: int :returns: The Strike processor :rtype: :class:`ingest.strike.strike_processor.StrikeProcessor` ''' logger.info('Initializing processor') strike = Strike.objects.select_related('job').get(pk=strike_id) self.job_exe_id = JobExecution.objects.get_latest([strike.job ])[strike.job.id].id strike_proc = StrikeProcessor(strike_id, self.job_exe_id, strike.get_strike_configuration()) self.num_exes = strike.job.num_exes return strike_proc