Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

clarify error for duplicate file names in a task #549

Merged
merged 1 commit into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
# built documents.
#
# The short X.Y version.
version = u'shortlist'
version = u'0.0.0.dev0'
# The full version, including alpha/beta/rc tags.
release = u'shortlist'
release = u'0.0.0.dev0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
3 changes: 3 additions & 0 deletions utils/loomengine_utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class ResourceCountError(LoomengineUtilsError):
class ExportManagerError(LoomengineUtilsError):
pass

class FileAlreadyExistsError(ExportManagerError):
pass

class FileUtilsError(LoomengineUtilsError):
pass

Expand Down
5 changes: 3 additions & 2 deletions utils/loomengine_utils/export_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import os
import yaml

from .exceptions import LoomengineUtilsError, ExportManagerError
from .exceptions import LoomengineUtilsError, ExportManagerError, \
FileAlreadyExistsError
from .file_utils import File

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -68,7 +69,7 @@ def export_file(self, data_object, destination_directory=None,
destination = File(
destination_file_url, self.storage_settings, retry=retry)
if destination.exists():
raise ExportManagerError(
raise FileAlreadyExistsError(
'File already exists at %s' % destination_file_url)
logger.info('...copying file to %s' % (
destination.get_url()))
Expand Down
9 changes: 8 additions & 1 deletion worker/loomengine_worker/task_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import uuid

from loomengine_utils import execute_with_retries
from loomengine_utils.connection import Connection
from loomengine_utils.exceptions import FileAlreadyExistsError
from loomengine_utils.export_manager import ExportManager
from loomengine_utils.import_manager import ImportManager
from loomengine_utils.connection import Connection
from loomengine_worker.outputs import TaskAttemptOutput
from loomengine_worker.inputs import TaskAttemptInput

Expand Down Expand Up @@ -160,6 +161,12 @@ def _copy_inputs(self):
try:
for input in self.task_attempt['inputs']:
TaskAttemptInput(input, self).copy()
except FileAlreadyExistsError as e:
error = self._get_error_text(e)
self._report_system_error(
detail='Copying inputs failed because file already exists. '\
'Are there multiple inputs with the same name? %s' % error)
raise
except Exception as e:
error = self._get_error_text(e)
self._report_system_error(detail='Copying inputs failed. %s' % error)
Expand Down