Skip to content

Commit

Permalink
fix(resume-xmlupload): make it impossible to resume after all resourc…
Browse files Browse the repository at this point in the history
…es have been created (DEV-3398) (#865)
  • Loading branch information
jnussbaum committed Mar 8, 2024
1 parent 2b5295d commit 8aa5d30
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/dsp_tools/commands/xmlupload/xmlupload.py
Expand Up @@ -144,23 +144,25 @@ def cleanup_upload(
Returns:
success status (deduced from failed_uploads)
"""
logfiles = ", ".join([handler.baseFilename for handler in logger.handlers if isinstance(handler, FileHandler)])
write_id2iri_mapping(iri_resolver.lookup, config.diagnostics)
if not failed_uploads and not nonapplied_stash:
success = True
print(f"{datetime.now()}: All resources have successfully been uploaded.")
logger.info("All resources have successfully been uploaded.")
return True
if failed_uploads:
print(f"\n{datetime.now()}: WARNING: Could not upload the following resources: {failed_uploads}\n")
print(f"For more information, see the log file: {logfiles}\n")
logger.warning(f"Could not upload the following resources: {failed_uploads}")
if nonapplied_stash:
print(f"\n{datetime.now()}: WARNING: Could not reapply the following stash items: {nonapplied_stash}\n")
print(f"For more information, see the log file: {logfiles}\n")
logger.warning(f"Could not reapply the following stash items: {nonapplied_stash}")
else:
success = False
logfiles = ", ".join([handler.baseFilename for handler in logger.handlers if isinstance(handler, FileHandler)])
if failed_uploads:
print(f"\n{datetime.now()}: WARNING: Could not upload the following resources: {failed_uploads}\n")
print(f"For more information, see the log file: {logfiles}\n")
logger.warning(f"Could not upload the following resources: {failed_uploads}")
if nonapplied_stash:
print(f"\n{datetime.now()}: WARNING: Could not reapply the following stash items: {nonapplied_stash}\n")
print(f"For more information, see the log file: {logfiles}\n")
logger.warning(f"Could not reapply the following stash items: {nonapplied_stash}")

config.diagnostics.save_location.unlink(missing_ok=True)
return False
return success


def _prepare_upload(
Expand Down

0 comments on commit 8aa5d30

Please sign in to comment.