galaxy icon indicating copy to clipboard operation
galaxy copied to clipboard

Workflow builder shows unaccessible variable names in "rename dataset" section

Open Lain-inrae opened this issue 1 year ago • 0 comments

Describe the bug

In the workflow editor, when we set a parameter as a "module connexion" and connect a "simple inputs used for workflow logics" to this parameter, the "configure output"/"Rename dataset" section show variables names for these parameters:

2024-10-15_16-07 2024-10-15_16-07_1 2024-10-15_16-09

But, those variables' placeholders are not translated to their value. Some placeholders are deleted, and others remains as they were when multiple placeholders are used.

2024-10-15_16-11 2024-10-15_16-13

I made a very bad patch that needs some rework in "lib/galaxy/job_execution/actions/post.py" to have access to those variables and other, missing variables too. But this needs a lot more work I'm not allowed to do in my current work (I think) ...

in the classmethod execute, just before if new_name := cls._gen_new_name ...

        ## Ditto for simple input parameters in workflow invocations...
        for parameter in job.parameters:
            log.debug(parameter.name)
            log.debug(repr(parameter.__dict__))
            if (
                ## dirty whitelist >,<
                parameter.name not in {
                    "__workflow_invocation_uuid__",
                    "chromInfo",
                    "dbkey",
                    "__input_ext",
                }
                and hasattr(parameter, "value")
            ):
                ## so dirty tooo... ówò  but easier to share patch soooo... uwu
                params = __import__("json").loads(parameter.value)
                if isinstance(params, dict):
                    params.update(params.pop("advanced", {}))
                    for key, value in params.items():
                        ## and another onnne! (whitelist)
                        if key != "__current_case__":
                            input_names[f"data_source|{key}"] = str(value)
                    ## The pipe is necessary because the _gen_new_name method
                    ## replaces points by pipes in the placeholder's names
                    ## wtf
                else:
                    input_names[parameter.name] = str(parameter.value)

Galaxy Version and/or server at which you observed the bug Galaxy Version: 24.02 - dev0 Commit: 4ce5bca5e6d4895fbab10a5b897354da59c7a9c9

Browser and Operating System Operating System: Linux Browser: Firefox

To Reproduce Steps to reproduce the behavior: Use any simple tool to create the base of your workflow. Click the "add connexion to module" button of any of the tool's parameter Select a "simple inputs used for workflow logic" Connect it to the main tool's input. In the section "configure output"/"Rename dataset", the parameter's name will be shown as a "valid input name" Use it in the rename dataset text field and run the workflow:

For example: Create a new workflow Use the builtin converter SMILES TO SMILES tool Select it and click the double arrow next to "Do not include isotopic or chiral markings (-xi) " to add a connexion to the module (in teh parameters) In the "Input" tool section, select a "Input dataset" and a "Simple input ..." Connect them to the SMILES TO SMILES inputs. Select the SMILES TO SMILES, and got to the "Configure Output: 'output'" section Set the name to Boolean: #{iso_chi} Save and run the workflow. The file name should be either Boolean: True or Boolean: False depending on the boolean's value. But there's just a blank after the Boolean: text.

Maybe I'll work on this, later. But it's a very big "maybe"...

Lain-inrae avatar Oct 15 '24 15:10 Lain-inrae