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
optional data column is empty instead of none, when starting workflow in simplified workflow runform #12081
Comments
this happened with Galaxy 21.01 on EU Server |
@foellmelanie did you connect an optional data input in the workflow editor ? If not we shouldn't actually show the simplified workflow form. |
No I didn't connect an optional data input. |
It seems that @kxk302 actually discovered the same? or a very similar bug. You can see this in this history: https://usegalaxy.eu/u/bgruening/h/imported-cnnnewhistory The workflow run failed, this time even with expanded-workflow-run form according to @kxk302 ... but a simple rerun of the failed tool returns green. You can see that the The parameter in question is defined as optional as well (that references an optional input). |
@foellmelanie which tool were you using and could you provide a minimal example ? |
And which one is correct here ? The empty value, right ? |
|
I think this is fixed in 21.05 / dev. https://gist.github.com/mvdbeek/a9bddc301f2cf507d5f48002754fa31b fails on usegalaxy.eu with |
We are not sure if we upgrade before GCC. Any clue what fixed that? |
You should really really update before GCC, please! This was a mess with last GCC having different version of Galaxy running. The release is stable now, no breaking bugs that we're aware of. It should go out early next week. |
I don't know for sure, but I'd assume it's this one: #11265. Please take it as a sign that you should update ASAP, I'm sure there are more things like that. I will confirm and backport. |
I will talk to Gianmauro and see what he thinks. |
Alright, so I think this is kind of difficult to fix and happens because we cast the select in https://github.com/bgruening/galaxytools/blob/e2a5eade6d0e5ddf3a47630381a0ad90d80e8a04/tools/sklearn/main_macros.xml#L1451 to a text field in the workflow editor, since the editor can't access datasets. All values of a text field are cast to strings, so our null value becomes So we could take the shortcut and change Ideally we'd have a text field that can discriminate between |
Any chance this can be fixed in the workflow editor instead? |
Yeah, that's my suggestion. You can add a Boolean |
@mvdbeek I am still seeing the issue Bjorn reported. The first time I run this workflow, it fails. If I re-run it from the failed step onwards, it passes. Here is the history: https://usegalaxy.eu/u/kaivan/h/gcc2021cnn I get this message: Tool Error An error occurred with this dataset: parameter 'sp_name': requires a value, but no legal values defined I reported the issue. Will paste the stack trace when I receive the email. Can we meet briefly on Monday to discuss this? Thx. |
Here is the stack trace:
|
And this was now with 21.05. |
It's what I've explained in #12081 (comment). You can download the workflow and set the On the tool side I'd recommend not using optional parameters like that, maybe replace them with a conditional if they are truly optional. |
FYI, I re-ran the training job and it succeeds. So, the problem now is in the workflow created prior to the fix. I searched the workflow file for 'sp_name' and here is what I found: "sp_name": null, "sp_value": "" So, sp_name is already null. I could re-create the workflow and see if the saved file has anything different. |
So, I re-created the workflow and the job completed successfully, and re-ran it in a new history and got the same error. Marius, I'll ping you on Monday if you have a few mins to discuss. |
That's a second bug we've been chasing for a while, good to know how to reproduce it. |
So, I made the following change to the workflow file: Before: After: And workflow now run to completion successfully (Before this change, tried setting the sp_value to null, but it still failed). |
If the `Set value for this optional select field ? `switch is set to no we serialize the value as `null` instead of `""`, which is especially important in optional select fields, where `""` may correspond to an option that is distinct from not setting a value. I have only enabled this for select parameters that are cast to text parameters, but I think this discrimination between set and unset would also be great for optional text parameters. There might be a better way to do it in the UI (maybe some icon that indicates that the value is set, that can be toggled with an backspace when the field is empty?), but I think this will do for the relatively rare case of optional select parameters that are cast to text fields. Fixes galaxyproject#12081
That's #9886 |
If the `tool_inputs` column of the `workflow_step` is loaded as MutableJSONType any "accidental" change of values in the dict marks the object as "dirty" in the sqlalchemy session it is attached to and will be persisted when the session is being flushed. Making the column type `JSONType` instead of `MutableJSONType` means that the object is not marked as dirty and will not be persisted in that case. The correct method to use to actually persist step inputs is WorkflowModule.save_to_step or setting step.tool_inputs directly. This fixes galaxyproject#9886 and galaxyproject#12081 (comment) The issue in galaxyproject#9886 is that when you submit a workflow the step state is converted to a tool state in https://github.com/mvdbeek/galaxy/blob/90dff9af5bec8bed1258620e5351d0350e284206/lib/galaxy/workflow/modules.py#L661: ``` def step_state_to_tool_state(self, state): state = safe_loads(state) if "format" in state: formats = state["format"] if formats: formats = ",".join(listify(formats)) state["format"] = formats state = json.dumps(state) return state ``` and safe_loads just returns the same object if the object that is passed in is not actually a JSON string. So `state["format"] = formats` manipulates the step state in place and that gets committed when flushing the new invocation.
If the `tool_inputs` column of the `workflow_step` is loaded as MutableJSONType any "accidental" change of values in the dict marks the object as "dirty" in the sqlalchemy session it is attached to and will be persisted when the session is being flushed. Making the column type `JSONType` instead of `MutableJSONType` means that the object is not marked as dirty and will not be persisted in that case. The correct method to use to actually persist step inputs is WorkflowModule.save_to_step or setting step.tool_inputs directly. This fixes galaxyproject#9886 and galaxyproject#12081 (comment) The issue in galaxyproject#9886 is that when you submit a workflow the step state is converted to a tool state in https://github.com/mvdbeek/galaxy/blob/90dff9af5bec8bed1258620e5351d0350e284206/lib/galaxy/workflow/modules.py#L661: ``` def step_state_to_tool_state(self, state): state = safe_loads(state) if "format" in state: formats = state["format"] if formats: formats = ",".join(listify(formats)) state["format"] = formats state = json.dumps(state) return state ``` and safe_loads just returns the same object if the object that is passed in is not actually a JSON string. So `state["format"] = formats` manipulates the step state in place and that gets committed when flushing the new invocation.
If the `tool_inputs` column of the `workflow_step` is loaded as MutableJSONType any "accidental" change of values in the dict marks the object as "dirty" in the sqlalchemy session it is attached to and will be persisted when the session is being flushed. Making the column type `JSONType` instead of `MutableJSONType` means that the object is not marked as dirty and will not be persisted in that case. The correct method to use to actually persist step inputs is WorkflowModule.save_to_step or setting step.tool_inputs directly. This fixes galaxyproject#9886 and galaxyproject#12081 (comment) The issue in galaxyproject#9886 is that when you submit a workflow the step state is converted to a tool state in https://github.com/mvdbeek/galaxy/blob/90dff9af5bec8bed1258620e5351d0350e284206/lib/galaxy/workflow/modules.py#L661: ``` def step_state_to_tool_state(self, state): state = safe_loads(state) if "format" in state: formats = state["format"] if formats: formats = ",".join(listify(formats)) state["format"] = formats state = json.dumps(state) return state ``` and safe_loads just returns the same object if the object that is passed in is not actually a JSON string. So `state["format"] = formats` manipulates the step state in place and that gets committed when flushing the new invocation.
Hi,
I have a tool with an optional=TRUE data column in a workflow. When I use the full workflow form this optional parameter is set to 'None' and the tool works However, when I start the workflow in the simplified workflow runform the parameter is empty and the tool crashes because it is expecting 'None' in case the parameter is not used.
Cheers,
Melanie
The text was updated successfully, but these errors were encountered: