Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(resume-xmlupload): make it impossible to resume after all resources have been created (DEV-3398) #865

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions src/dsp_tools/commands/xmlupload/xmlupload.py
Original file line number Diff line number Diff line change
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
Loading