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

[24.0] Improve error message for Extract dataset tool #18078

Merged

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented May 1, 2024

Provides a reasonable error message to users, instead of the internal error https://sentry.galaxyproject.org/share/issue/a197159192b64b9db065a762ee5dbbfc/:

KeyError: 'Dataset collection has no element_identifier with key 2.'
  File "galaxy/tools/__init__.py", line 1972, in handle_single_execution
    rval = self.execute(
  File "galaxy/tools/__init__.py", line 2069, in execute
    return self.tool_action.execute(
  File "galaxy/tools/actions/model_operations.py", line 88, in execute
    self._produce_outputs(
  File "galaxy/tools/actions/model_operations.py", line 119, in _produce_outputs
    tool.produce_outputs(
  File "galaxy/tools/__init__.py", line 3351, in produce_outputs
    extracted_element = collection[incoming["which"]["identifier"]]
  File "galaxy/model/__init__.py", line 6434, in __getitem__
    raise KeyError(error_message)

Also makes the identifier parameter explicitly required (it is now inferred to be optional because text parameters are by default optional if no validator raises an exception upon validating an empty string).

That prevents

KeyError: 'Dataset collection has no element_identifier with key None.'
  File "galaxy/tools/__init__.py", line 1972, in handle_single_execution
    rval = self.execute(
  File "galaxy/tools/__init__.py", line 2069, in execute
    return self.tool_action.execute(
  File "galaxy/tools/actions/model_operations.py", line 88, in execute
    self._produce_outputs(
  File "galaxy/tools/actions/model_operations.py", line 119, in _produce_outputs
    tool.produce_outputs(
  File "galaxy/tools/__init__.py", line 3351, in produce_outputs
    extracted_element = collection[incoming["which"]["identifier"]]
  File "galaxy/model/__init__.py", line 6434, in __getitem__
    raise KeyError(error_message)

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@github-actions github-actions bot added this to the 24.1 milestone May 1, 2024
Provides a reasonable error message to users, instead of the internal
error https://sentry.galaxyproject.org/share/issue/a197159192b64b9db065a762ee5dbbfc/:
```
KeyError: 'Dataset collection has no element_identifier with key 2.'
  File "galaxy/tools/__init__.py", line 1972, in handle_single_execution
    rval = self.execute(
  File "galaxy/tools/__init__.py", line 2069, in execute
    return self.tool_action.execute(
  File "galaxy/tools/actions/model_operations.py", line 88, in execute
    self._produce_outputs(
  File "galaxy/tools/actions/model_operations.py", line 119, in _produce_outputs
    tool.produce_outputs(
  File "galaxy/tools/__init__.py", line 3351, in produce_outputs
    extracted_element = collection[incoming["which"]["identifier"]]
  File "galaxy/model/__init__.py", line 6434, in __getitem__
    raise KeyError(error_message)
```
Also makes the `identifier` parameter explicitly required (it is now
inferred to be optional because text parameters are by default optional
if no validator raises an exception upon validating an empty string).

That prevents
```
KeyError: 'Dataset collection has no element_identifier with key None.'
  File "galaxy/tools/__init__.py", line 1972, in handle_single_execution
    rval = self.execute(
  File "galaxy/tools/__init__.py", line 2069, in execute
    return self.tool_action.execute(
  File "galaxy/tools/actions/model_operations.py", line 88, in execute
    self._produce_outputs(
  File "galaxy/tools/actions/model_operations.py", line 119, in _produce_outputs
    tool.produce_outputs(
  File "galaxy/tools/__init__.py", line 3351, in produce_outputs
    extracted_element = collection[incoming["which"]["identifier"]]
  File "galaxy/model/__init__.py", line 6434, in __getitem__
    raise KeyError(error_message)
```
@mvdbeek mvdbeek force-pushed the better_exception_extract_dataset branch from c522b4b to acec4f6 Compare May 2, 2024 10:41
Fixes the occasional timeout error in jobs that follow the
`test_abort_fetch_job` test.
@mvdbeek mvdbeek requested a review from a team May 3, 2024 07:22
Copy link
Contributor

@davelopez davelopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mvdbeek mvdbeek merged commit 2bb61ea into galaxyproject:release_24.0 May 3, 2024
50 checks passed
@martenson martenson deleted the better_exception_extract_dataset branch May 3, 2024 21:17
@jdavcs jdavcs removed this from the 24.1 milestone May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants