Beispiel #1
0
 def load_map(self, load_path):
     logging.info(f'Loading Entity Map: {load_path}')
     file_content: dict = self.load_dict_from_file(load_path)
     if file_content.get('entities'):
         return ArchiveEntityMap.map_from_report(file_content['entities'])
     logging.error(f"--load_path files does not have an entities object: {file_content}")
     exit(2)
Beispiel #2
0
 def complete_submission(self, dsp_submission_url):
     logging.info(f'##################### COMPLETING DSP SUBMISSION {dsp_submission_url}')
     archive_submission = ArchiveSubmission(dsp_api=self.archiver.dsp_api, dsp_submission_url=dsp_submission_url)
     ingest_archive_submission = self.ingest_api.get_archive_submission_by_dsp_uuid(archive_submission.dsp_uuid)
     ingest_entities = self.ingest_api.get_related_entity(ingest_archive_submission, 'entities', 'archiveEntities')
     entity_map = ArchiveEntityMap.map_from_ingest_entities(ingest_entities)
     archive_submission = self.archiver.complete_submission(dsp_submission_url, entity_map)
     report = archive_submission.generate_report()
     self.save_dict_to_file(f'COMPLETE_SUBMISSION_{archive_submission.dsp_uuid}', report)
Beispiel #3
0
def async_complete(dsp_api, dsp_submission_uuid, ingest_api):
    logger.info('Starting...')
    start = time.time()
    ingest_archive_submission = ingest_api.get_archive_submission_by_dsp_uuid(
        dsp_submission_uuid)
    ingest_entities = ingest_api.get_related_entity(ingest_archive_submission,
                                                    'entities',
                                                    'archiveEntities')
    entity_map = ArchiveEntityMap.map_from_ingest_entities(ingest_entities)
    dsp_submission_url = dsp_api.get_submission_url(dsp_submission_uuid)
    archiver = IngestArchiver(ingest_api=ingest_api, dsp_api=dsp_api)
    archive_submission = archiver.complete_submission(dsp_submission_url,
                                                      entity_map)
    end = time.time()
    logger.info(
        f'Completed DSP submission for {dsp_submission_uuid} in {end - start}s'
    )
    return archive_submission