parameters: (self, upload_session_id: int)
docstring: Task invoked by 'upload_workflow.chord' in order to remove and cleanup all the 'INVALID' stale Upload tasks.
docstring_summary: Task invoked by 'upload_workflow.chord' in order to remove and cleanup all the 'INVALID' stale Upload tasks.
docstring_tokens: Task invoked by upload_workflow . chord in order to remove and cleanup all the INVALID stale Upload tasks .
function: def _upload_session_cleanup(self, upload_session_id: int):
      """Task invoked by 'upload_workflow.chord' in order to remove and cleanup all the 'INVALID' stale Upload tasks."""
      try:
          _upload = Upload.objects.get(id=upload_session_id)
          if _upload.resource:
              resource_manager.delete(_upload.resource.uuid)
          _upload.delete()
          logger.debug(f"Upload {upload_session_id} deleted with state {_upload.state}.")
      except Exception as e:
          logger.error(f"Upload {upload_session_id} errored with exception {e}.")
function_tokens: def _upload_session_cleanup ( self , upload_session_id : int ) : try : _upload = Upload . objects . get ( id = upload_session_id ) if _upload . resource : resource_manager . delete ( _upload . resource . uuid ) _upload . delete ( ) logger . debug ( f"Upload {upload_session_id} deleted with state {_upload.state}." ) except Exception as e : logger . error ( f"Upload {upload_session_id} errored with exception {e}." )