From 6803572931303dd9f6ba5741600f174e86ccc49b Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 28 Jun 2022 12:04:38 +0200 Subject: [PATCH 1/3] JobWrapper: use correct fail method if the JobWrapper.fail method is called directly exit code (etc) are lost. fixes https://github.com/galaxyproject/galaxy/issues/14206 not sure why this error popped up now, probably a change in tool verification ..? --- lib/galaxy/jobs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index 2c08c2fb8f15..f566031f02e9 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -1793,7 +1793,7 @@ def fail(message=job.info, exception=None): else: # Prior to fail we need to set job.state job.set_state(final_job_state) - return self.fail(f"Job {job.id}'s output dataset(s) could not be read") + return fail(f"Job {job.id}'s output dataset(s) could not be read") job_context = ExpressionContext(dict(stdout=job.stdout, stderr=job.stderr)) if extended_metadata: From b55b6306b8da0cc9fb885c147bc505a2d8f35cf4 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 28 Jun 2022 14:19:28 +0200 Subject: [PATCH 2/3] add a test should be covered by a small change to strict_shell_profile.xml (added analogous changes to strict_shell_*.xml) --- test/functional/tools/strict_shell.xml | 4 +++- test/functional/tools/strict_shell_default_off.xml | 8 +++++--- test/functional/tools/strict_shell_profile.xml | 8 +++++--- test/integration/test_job_outputs_to_working_directory.py | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/test/functional/tools/strict_shell.xml b/test/functional/tools/strict_shell.xml index 0a6adab9ae29..2b4a95f83ce5 100644 --- a/test/functional/tools/strict_shell.xml +++ b/test/functional/tools/strict_shell.xml @@ -1,6 +1,8 @@ '$out_file1'; +#if $exit_code == "0" + echo "Hello" > '$out_file1'; +#end if sh -c 'exit $exit_code'; sh -c 'exit 0' ]]> diff --git a/test/functional/tools/strict_shell_default_off.xml b/test/functional/tools/strict_shell_default_off.xml index aca66494dc7c..4ad21bd0d268 100644 --- a/test/functional/tools/strict_shell_default_off.xml +++ b/test/functional/tools/strict_shell_default_off.xml @@ -1,8 +1,10 @@ '$out_file1' -; sh -c 'exit $exit_code' -; sh -c 'exit 0' +#if $exit_code == "0" + echo 'Hello' > '$out_file1'; +#end if +sh -c 'exit $exit_code'; +sh -c 'exit 0' ]]> diff --git a/test/functional/tools/strict_shell_profile.xml b/test/functional/tools/strict_shell_profile.xml index 726e9d5a9fe0..57da2286578e 100644 --- a/test/functional/tools/strict_shell_profile.xml +++ b/test/functional/tools/strict_shell_profile.xml @@ -1,8 +1,10 @@ '$out_file1' -; sh -c 'exit $exit_code' -; sh -c 'exit 0' +#if $exit_code == 0 + echo 'Hello' > '$out_file1'; +#end if +sh -c 'exit $exit_code'; +sh -c 'exit 0' ]]> diff --git a/test/integration/test_job_outputs_to_working_directory.py b/test/integration/test_job_outputs_to_working_directory.py index 9ced6c5e35cd..97ea525a8e15 100644 --- a/test/integration/test_job_outputs_to_working_directory.py +++ b/test/integration/test_job_outputs_to_working_directory.py @@ -17,5 +17,5 @@ def handle_galaxy_config_kwds(cls, config): instance = integration_util.integration_module_instance(JobOutputsToWorkingDirectoryIntegrationInstance) test_tools = integration_util.integration_tool_runner( - ["output_format", "output_empty_work_dir", "collection_creates_pair_from_work_dir"] + ["output_format", "output_empty_work_dir", "collection_creates_pair_from_work_dir", "strict_shell_profile"] ) From 66274f08f82b11e1e4571fc63d75e7b2bcc42f0f Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 28 Jun 2022 15:37:11 +0200 Subject: [PATCH 3/3] Revert "JobWrapper: use correct fail method" This reverts commit 6803572931303dd9f6ba5741600f174e86ccc49b. --- lib/galaxy/jobs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index f566031f02e9..2c08c2fb8f15 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -1793,7 +1793,7 @@ def fail(message=job.info, exception=None): else: # Prior to fail we need to set job.state job.set_state(final_job_state) - return fail(f"Job {job.id}'s output dataset(s) could not be read") + return self.fail(f"Job {job.id}'s output dataset(s) could not be read") job_context = ExpressionContext(dict(stdout=job.stdout, stderr=job.stderr)) if extended_metadata: