Skip to content

Add regex switch expression tool#7314

Merged
bernt-matthias merged 11 commits intogalaxyproject:mainfrom
npinter:add-regex-switch-expression-tool
Oct 9, 2025
Merged

Add regex switch expression tool#7314
bernt-matthias merged 11 commits intogalaxyproject:mainfrom
npinter:add-regex-switch-expression-tool

Conversation

@npinter
Copy link
Copy Markdown
Contributor

@npinter npinter commented Sep 29, 2025

As discussed here galaxyproject/galaxy#20966 I added the regex switch module as an expression tool.

Workflow example:
grafik

Workflow route 1:
grafik

Workflow route 2:
grafik

@mvdbeek mentioned there is a Galaxy bug regarding the workflow invocation. Tool works but "Attempting to schedule workflow invocation" takes 5 min to pipe the boolean to the target tools.

FOR CONTRIBUTOR:

  • I have read the CONTRIBUTING.md document and this tool is appropriate for the tools-iuc repo.
  • License permits unrestricted use (educational + commercial)
  • This PR adds a new tool or tool collection
  • This PR updates an existing tool or tool collection
  • This PR does something else (explain below)

@npinter
Copy link
Copy Markdown
Contributor Author

npinter commented Sep 29, 2025

Other regex tools and other expression tools are located in the category "Text Manipulation", so I changed "Expression tools" to that.

@npinter
Copy link
Copy Markdown
Contributor Author

npinter commented Sep 29, 2025

I don't see why it fails..

@npinter
Copy link
Copy Markdown
Contributor Author

npinter commented Sep 29, 2025

Is it because the tool doesn't generate a real output (only booleans?)? @mvdbeek

Comment thread tools/regex_switch/regex_switch.xml Outdated
<help><![CDATA[
**Regex switch**

Matches a regular expression against an element name. It emits two booleans:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Guess "element name" needs better explanation. I guess you assume that the tool is mapped over a collection.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's the name of the dict element (job["input"]["name"]) of cwl (?), which looks like that:

    "engineConfig": [],
    "job": {
        "input": {
            "file_ext": "tabular",
            "file_size": 14,
            "name": "table.tsv",
            "metadata": {
                "dbkey": "?",
                "data_lines": 2,
                "comment_lines": 0,
                "columns": 2,
                "column_types": [
                    "int",
                    "int"
                ],
                "column_names": [],
                "delimiter": "__tc__"
            },
            "src": {
                "src": "hda",
                "id": 4
            }
        },
        "pattern": "\.csv$"
    },
    "context": null,
    "outdir": null,
    "tmpdir": null,

Not sure if this name comes either of the element identifier or the element name (I guessed the latter).

@npinter
Copy link
Copy Markdown
Contributor Author

npinter commented Oct 6, 2025

@bernt-matthias any idea why the testing fails?

@npinter
Copy link
Copy Markdown
Contributor Author

npinter commented Oct 7, 2025

@bernt-matthias looks like tests are green now :)

Comment thread tools/regex_switch/.shed.yml Outdated
Comment thread tools/regex_switch/regex_switch.xml Outdated
var matched = false;

try {
if (pat !== "") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add a empty_field validator instead to the param?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Added!

Comment thread tools/regex_switch/regex_switch.xml
Comment thread tools/regex_switch/regex_switch.xml
Comment thread tools/regex_switch/regex_switch.xml Outdated
@npinter
Copy link
Copy Markdown
Contributor Author

npinter commented Oct 8, 2025

Testing fails again with the same cryptic error as before (..which turned green at some point :) )

@bernt-matthias
Copy link
Copy Markdown
Contributor

Let me use the opportunity to debug the failure. I guess the problem is due to #7293

Comment thread .github/workflows/pr.yaml Outdated
@bernt-matthias bernt-matthias mentioned this pull request Oct 8, 2025
5 tasks
@bernt-matthias bernt-matthias force-pushed the add-regex-switch-expression-tool branch from 4587f8e to e4dfb0c Compare October 8, 2025 11:37
@bernt-matthias
Copy link
Copy Markdown
Contributor

Fix is coming #7348 (I hope)

@npinter
Copy link
Copy Markdown
Contributor Author

npinter commented Oct 9, 2025

sorry for bump, but looks like it worked :) thank you @bernt-matthias

@bernt-matthias bernt-matthias merged commit 502f06f into galaxyproject:main Oct 9, 2025
11 checks passed
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Apr 9, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Apr 9, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
mvdbeek added a commit to mvdbeek/galaxy that referenced this pull request Apr 9, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
mvdbeek added a commit to galaxyproject/galaxy that referenced this pull request Apr 10, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
mvdbeek added a commit to galaxyproject/galaxy that referenced this pull request Apr 16, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
mvdbeek added a commit to galaxyproject/galaxy that referenced this pull request Apr 21, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
mvdbeek added a commit to galaxyproject/galaxy that referenced this pull request Apr 22, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
mvdbeek added a commit to galaxyproject/galaxy that referenced this pull request Apr 27, 2026
`get_last_workflow_invocation_step_update_time()` returns UTC time (it's
set by galaxy.model.orm.now.now()) while datetime.now() is your local
time.

If your system is not on UTC time this caused 5 minute scheduling delays
for steps depending on expression tools that only produce parameters.

Fixes the delay observed in galaxyproject/tools-iuc#7314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants