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 workflow run form failing on certain histories #17869

Merged

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Mar 29, 2024

If we don't replace connected values with concrete value in the run form we won't run into errors when trying to use datasets in the history as potential inputs to input parameters that are already connected. This doesn't seem necessary, and makes the run form behave more like workflow scheduling. Should fix various 500 errors that are possible if there are failed or otherwise unexpected datasets in a history.

Fixes https://sentry.galaxyproject.org/share/issue/b162b010af894eecafdaea3ae1fd8e19/:

FileNotFoundError: [Errno 2] No such file or directory: ''
  File "galaxy/web/framework/decorators.py", line 346, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "galaxy/webapps/galaxy/api/workflows.py", line 357, in workflow_dict
    ret_dict = self.workflow_contents_manager.workflow_to_dict(
  File "galaxy/managers/workflows.py", line 905, in workflow_to_dict
    wf_dict = self._workflow_to_dict_run(trans, stored, workflow=workflow, history=history or trans.history)
  File "galaxy/managers/workflows.py", line 1007, in _workflow_to_dict_run
    step_model = tool.to_json(
  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 409, in populate_state
    _populate_state_legacy(
  File "galaxy/tools/parameters/__init__.py", line 520, in _populate_state_legacy
    state[input.name] = input.get_initial_value(request_context, context)
  File "galaxy/tools/parameters/grouping.py", line 796, in get_initial_value
    rval[child_input.name] = child_input.get_initial_value(trans, child_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 874, in get_options
    options = self.get_fields(trans, other_values)
  File "galaxy/tools/parameters/dynamic_options.py", line 741, in get_fields
    if os.path.getsize(path) < 1048576:
  File "<frozen genericpath>", line 50, in getsize

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.

mvdbeek added 8 commits April 2, 2024 19:10
Include this in a workflow, and notice that the run form breaks
if the history contains a dataset that trips up the dynamic parameter.
It's not guaranteed this will always work, and it's unnecessary if
we have e.g. `ConnectedValue` in a workflow context.
Just move on, so we can build the tool form even if you have e.g.
misassigned datatypes in your history.
Moving this to tools.parameters.workflow_utils avoids a circular
dependency when importing is_runtime_value in
tools.parameters.dynamic_options.
@mvdbeek mvdbeek force-pushed the drop_dummy_replacement branch from 7df65fc to 3d1ef1e Compare April 2, 2024 17:18
@mvdbeek mvdbeek marked this pull request as ready for review April 3, 2024 11:19
@github-actions github-actions bot added this to the 24.1 milestone Apr 3, 2024
@mvdbeek
Copy link
Member Author

mvdbeek commented Apr 3, 2024

I think this is ready and should make the run form more robust in many situations ... I think workflows with defined inputs should now not be failing to render the run form even if there's "weird" datasets in the history.

@mvdbeek mvdbeek requested a review from jmchilton April 3, 2024 17:42
@martenson martenson changed the title [24.] Fix workflow run form failing on certain histories [24.0] Fix workflow run form failing on certain histories Apr 4, 2024
@jmchilton jmchilton merged commit 661d93a into galaxyproject:release_24.0 Apr 4, 2024
49 of 52 checks passed
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