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] Fix tool form building if select filters from unavailable dataset metadata #17930

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Apr 8, 2024

Fixes:

Message
Uncaught exception in exposed API method:
Stack Trace(most recent call first)

TypeError: 'NoneType' object is not iterable
  File "galaxy/web/framework/decorators.py", line 346, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/api/tools.py", line 247, in build
    return tool.to_json(trans, kwd.get("inputs", kwd), history=history)
  File "galaxy/tools/__init__.py", line 2509, in to_json
    populate_state(request_context, self.inputs, params.__dict__, state_inputs, state_errors)
  File "galaxy/tools/parameters/__init__.py", line 412, in populate_state
    _populate_state_legacy(
  File "galaxy/tools/parameters/__init__.py", line 525, in _populate_state_legacy
    state[input.name] = input.get_initial_value(request_context, context)
  File "galaxy/tools/parameters/basic.py", line 1107, in get_initial_value
    options = list(self.get_options(trans, other_values))
  File "galaxy/tools/parameters/basic.py", line 960, in get_options
    return self.options.get_options(trans, other_values)
  File "galaxy/tools/parameters/dynamic_options.py", line 893, in get_options
    rval = filter.filter_options(rval, trans, other_values)
  File "galaxy/tools/parameters/dynamic_options.py", line 227, in filter_options
    for r in ref:

from

https://sentry.galaxyproject.org/share/issue/ac3a350198604034aca07eaca3cc9cb8/

This happens if you have the following input section:

        <param name="otu" type="data" format="mothur.list,mothur.shared" label="list or shared - OTU List of Shared"/>
        <param name="repfasta" type="data" format="fasta" optional="true" label="repfasta - rep.fasta" help="rep.fasta file generated by get.oturep"/>
        <param name="label" type="select" label="label - OTU Labels" optional="true" help="Select exactly one label. If none selected, first label in your list or shared file will be used">
            <options>
                <filter type="data_meta" ref="otu" key="labels"/>
            </options>
        </param>

but there's no mothur.list or mothur.shared dataset in your history.

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 Apr 8, 2024
@mvdbeek mvdbeek force-pushed the tool_form_build_fix branch 2 times, most recently from 311f735 to ea8d6df Compare April 8, 2024 11:42
metadata

Fixes:

```
Message
Uncaught exception in exposed API method:
Stack Trace(most recent call first)

TypeError: 'NoneType' object is not iterable
  File "galaxy/web/framework/decorators.py", line 346, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/api/tools.py", line 247, in build
    return tool.to_json(trans, kwd.get("inputs", kwd), history=history)
  File "galaxy/tools/__init__.py", line 2509, in to_json
    populate_state(request_context, self.inputs, params.__dict__, state_inputs, state_errors)
  File "galaxy/tools/parameters/__init__.py", line 412, in populate_state
    _populate_state_legacy(
  File "galaxy/tools/parameters/__init__.py", line 525, in _populate_state_legacy
    state[input.name] = input.get_initial_value(request_context, context)
  File "galaxy/tools/parameters/basic.py", line 1107, in get_initial_value
    options = list(self.get_options(trans, other_values))
  File "galaxy/tools/parameters/basic.py", line 960, in get_options
    return self.options.get_options(trans, other_values)
  File "galaxy/tools/parameters/dynamic_options.py", line 893, in get_options
    rval = filter.filter_options(rval, trans, other_values)
  File "galaxy/tools/parameters/dynamic_options.py", line 227, in filter_options
    for r in ref:
```
from

https://sentry.galaxyproject.org/share/issue/ac3a350198604034aca07eaca3cc9cb8/

This happens if you have the following input section:
```
        <param name="otu" type="data" format="mothur.list,mothur.shared" label="list or shared - OTU List of Shared"/>
        <param name="repfasta" type="data" format="fasta" optional="true" label="repfasta - rep.fasta" help="rep.fasta file generated by get.oturep"/>
        <param name="label" type="select" label="label - OTU Labels" optional="true" help="Select exactly one label. If none selected, first label in your list or shared file will be used">
            <options>
                <filter type="data_meta" ref="otu" key="labels"/>
            </options>
        </param>
```
but the first input collection to mothur.list or mothur.shared dataset
has no elements.
@mvdbeek mvdbeek force-pushed the tool_form_build_fix branch from ea8d6df to 8616cbc Compare April 8, 2024 11:43
@mvdbeek mvdbeek merged commit 7278fa5 into galaxyproject:release_24.0 Apr 8, 2024
48 of 49 checks passed
@nsoranzo nsoranzo deleted the tool_form_build_fix branch April 8, 2024 14:04
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.

2 participants