Skip to content

Commit

Permalink
Merge pull request #1305 from lldelisle/fix_autoupdate_error
Browse files Browse the repository at this point in the history
Don't fail planemo autoupdate if tool version not found in tool shed
  • Loading branch information
mvdbeek committed Oct 31, 2022
2 parents 4a45596 + 99525c5 commit 96de718
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
3 changes: 3 additions & 0 deletions planemo/autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ def check_tool_step(step, ts): # return a dict with current and newest tool ver
except Exception:
ctx.log(f"The ToolShed returned an error when searching for the most recent version of {step['tool_id']}")
return {}
if len(repos) == 0:
ctx.log(f"The tool {step['tool_id']} is not in the toolshed (may have been tagged as invalid).")
return {}
base_id = "/".join(step["tool_id"].split("/")[:-1])
tool_ids_found = {
tool["guid"] for repo in repos.values() if type(repo) == dict for tool in repo.get("tools", [])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"a_galaxy_workflow": "true",
"annotation": "",
"format-version": "0.1",
"name": "Workflow with unexisting version of tool",
"steps": {
"0": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 0,
"input_connections": {},
"inputs": [
{
"description": "",
"name": "input"
}
],
"label": "input",
"name": "Input dataset",
"outputs": [],
"position": {
"left": 0,
"top": 0
},
"tool_id": null,
"tool_state": "{\"optional\": false, \"tag\": \"\"}",
"tool_version": null,
"type": "data_input",
"uuid": "62da4422-2462-40d8-a4f6-35b0fd1156f4",
"workflow_outputs": [
{
"label": null,
"output_name": "output",
"uuid": "070bf2da-a153-4b1e-a38c-55fc164ca4f9"
}
]
},
"1": {
"annotation": "",
"content_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_head_tool/0.1.0",
"errors": null,
"id": 1,
"input_connections": {
"infile": {
"id": 0,
"output_name": "output"
}
},
"inputs": [
{
"description": "runtime parameter for tool Select first",
"name": "infile"
}
],
"label": "fake tool",
"name": "Select first",
"outputs": [
{
"name": "outfile",
"type": "input"
}
],
"position": {
"left": 281,
"top": 47
},
"post_job_actions": {},
"tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_head_tool/0.1.0",
"tool_shed_repository": {
"changeset_revision": "adf54b12c295",
"name": "text_processing",
"owner": "bgruening",
"tool_shed": "toolshed.g2.bx.psu.edu"
},
"tool_state": "{\"complement\": \"\", \"count\": \"10\", \"infile\": {\"__class__\": \"RuntimeValue\"}, \"__page__\": null, \"__rerun_remap_job_id__\": null}",
"tool_version": "0.1.0",
"type": "tool",
"uuid": "c15c0342-6bde-4c83-9399-3b8597de6a83",
"workflow_outputs": [
{
"label": null,
"output_name": "outfile",
"uuid": "61762374-8db1-46bc-8446-0eaca9ab8e92"
}
]
}
},
"tags": [],
"uuid": "e75d0ddc-b376-456f-b5e3-a8afbb7b85ed",
"version": 1
}
10 changes: 10 additions & 0 deletions tests/test_cmd_autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,13 @@ def test_autoupdate_workflow(self):
assert wf["steps"][0]["tool_id"] == "toolshed.g2.bx.psu.edu/repos/bgruening/diff/diff/3.7+galaxy0"
assert wf["steps"][1]["run"]["steps"][0]["tool_version"] == "3.7+galaxy0"
assert wf["release"] == "0.1.1"

def test_autoupdate_workflow_unexisting_version(self):
"""Test autoupdate command for a workflow where the version of the tool is not in the toolshed."""
with self._isolate_with_test_data("wf_repos/autoupdate_tests") as f:
wf_file = os.path.join(f, "workflow_with_unexisting_version_of_tool.ga")
autoupdate_command = ["autoupdate", wf_file]
self._runner.invoke(self._cli.planemo, autoupdate_command)
# We just want to be sure planemo autoupdate do not raise an error
# Currently it would write to the output that no update are available
# In future versions it could be great that it gives the last valid version.

0 comments on commit 96de718

Please sign in to comment.