commit/galaxy-central: jmchilton: Bug fix related to return code handling in TaskWrapper.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/329ea7a83af4/ Changeset: 329ea7a83af4 User: jmchilton Date: 2013-10-17 12:30:13 Summary: Bug fix related to return code handling in TaskWrapper. Thanks to Peter Cock for finding this. Affected #: 2 files diff -r 8e001dc9675c105d83d83f6d5a756c11759e8bb2 -r 329ea7a83af4f389a7c95ee4559d88c6fec0211b lib/galaxy/jobs/command_factory.py --- a/lib/galaxy/jobs/command_factory.py +++ b/lib/galaxy/jobs/command_factory.py @@ -55,18 +55,20 @@ # Append metadata setting commands, we don't want to overwrite metadata # that was copied over in init_meta(), as per established behavior if include_metadata and job_wrapper.requires_setting_metadata: - if not captured_return_code: - commands += capture_return_code_command - captured_return_code = True - commands += "; cd %s; " % abspath( getcwd() ) - commands += job_wrapper.setup_external_metadata( + metadata_command = job_wrapper.setup_external_metadata( exec_dir=abspath( getcwd() ), tmp_dir=job_wrapper.working_directory, dataset_files_path=job.app.model.Dataset.file_path, output_fnames=job_wrapper.get_output_fnames(), set_extension=False, kwds={ 'overwrite' : False } - ) + ) or '' + metadata_command = metadata_command.strip() + if metadata_command: + if not captured_return_code: + commands += capture_return_code_command + captured_return_code = True + commands += "; cd %s; %s" % (abspath( getcwd() ), metadata_command) if captured_return_code: commands += '; sh -c "exit $return_code"' diff -r 8e001dc9675c105d83d83f6d5a756c11759e8bb2 -r 329ea7a83af4f389a7c95ee4559d88c6fec0211b test/unit/test_command_factory.py --- a/test/unit/test_command_factory.py +++ b/test/unit/test_command_factory.py @@ -45,6 +45,18 @@ expected_command = '%s; return_code=$?; cd %s; %s; sh -c "exit $return_code"' % (MOCK_COMMAND_LINE, getcwd(), metadata_line) self.__assert_command_is( expected_command ) + def test_empty_metadata(self): + """ + As produced by TaskWrapper. + """ + self.include_metadata = True + self.include_work_dir_outputs = False + self.job_wrapper.metadata_line = ' ' + # Empty metadata command do not touch command line. + expected_command = '%s' % (MOCK_COMMAND_LINE) + self.__assert_command_is( expected_command ) + + def __assert_command_is(self, expected_command): command = self.__command() self.assertEqual(command, expected_command) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org