def test_successful(self, mock_SourceFile, mock_move_ingest_file, mock_delete_ingest_file, mock_exists, mock_makedirs, mock_nfs_mount, mock_cleanup): '''Tests processing a new ingest successfully.''' # Set up mocks def new_exists(file_path): return True mock_exists.side_effect = new_exists mock_SourceFile.objects.store_file.return_value = self.source_file ingest_job.perform_ingest(self.ingest.id, 'host:/mount') ingest = Ingest.objects.get(pk=self.ingest.id) self.assertEqual(ingest.status, 'INGESTED') self.assertEqual(ingest.source_file_id, self.source_file.id) mock_cleanup.assert_called_with(self.job_exe_id)
def test_successful(self, mock_nfs_mount, mock_nfs_umount, mock_SourceFile, mock_move_ingest_file, mock_delete_ingest_file, mock_exists, mock_makedirs, mock_cleanup): """Tests processing a new ingest successfully.""" # Set up mocks def new_exists(file_path): return True mock_exists.side_effect = new_exists mock_SourceFile.objects.store_file.return_value = self.source_file ingest_job.perform_ingest(self.ingest.id, 'host:/mount') ingest = Ingest.objects.get(pk=self.ingest.id) self.assertEqual(ingest.status, 'INGESTED') self.assertEqual(ingest.source_file_id, self.source_file.id) mock_cleanup.assert_called_with(self.job_exe_id)
def handle(self, **options): """See :meth:`django.core.management.base.BaseCommand.handle`. This method starts the ingest process. """ # Register a listener to handle clean shutdowns signal.signal(signal.SIGTERM, self._onsigterm) ingest_id = options.get('ingest_id') logger.info('Command starting: scale_ingest') logger.info('Ingest ID: %i', ingest_id) try: ingest_job.perform_ingest(ingest_id) except: logger.exception('Ingest caught unexpected error, exit code 1 returning') sys.exit(1) logger.info('Command completed: scale_ingest')
def handle(self, **options): """See :meth:`django.core.management.base.BaseCommand.handle`. This method starts the ingest process. """ # Register a listener to handle clean shutdowns signal.signal(signal.SIGTERM, self._onsigterm) ingest_id = options.get("ingest_id") logger.info("Command starting: scale_ingest") logger.info("Ingest ID: %i", ingest_id) try: ingest_job.perform_ingest(ingest_id) except: logger.exception("Ingest caught unexpected error, exit code 1 returning") sys.exit(1) logger.info("Command completed: scale_ingest")
def handle(self, **options): '''See :meth:`django.core.management.base.BaseCommand.handle`. This method starts the ingest process. ''' # Register a listener to handle clean shutdowns signal.signal(signal.SIGTERM, self._onsigterm) ingest_id = options.get('ingest_id') mount = options.get('mount') logger.info('Command starting: scale_ingest') logger.info(' - Ingest ID: %i', ingest_id) logger.info(' - Mount: %s', mount) try: ingest_job.perform_ingest(ingest_id, mount) except: logger.exception('Ingest caught unexpected error, exit code 1 returning') sys.exit(1) logger.info('Command completed: scale_ingest')