From 4258fd6ca83c2f566ca06f3fd64558a885159948 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 12 Sep 2024 16:36:18 +0200 Subject: [PATCH 1/2] Open tool file contents in rb Fixes https://sentry.galaxyproject.org/share/issue/7e108c13d6634c20bc885e3ec4a93ce8/: ``` UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8a in position 10: invalid start byte File "pulsar/managers/stateful.py", line 132, in _handling_of_preprocessing_state self._proxied_manager.launch( File "pulsar/managers/queued_drmaa.py", line 15, in launch self._check_execution_with_tool_file(job_id, command_line) File "pulsar/managers/base/directory.py", line 133, in _check_execution_with_tool_file self._check_execution(job_id, tool_id, command_line) File "pulsar/managers/base/__init__.py", line 189, in _check_execution contents = open(join(tool_files_dir, file)).read() File "", line 322, in decode ``` which is attempting to read PEHistogram.jar --- pulsar/managers/base/__init__.py | 2 +- pulsar/tools/authorization.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pulsar/managers/base/__init__.py b/pulsar/managers/base/__init__.py index 5c89eb66..6ca07e91 100644 --- a/pulsar/managers/base/__init__.py +++ b/pulsar/managers/base/__init__.py @@ -186,7 +186,7 @@ def _check_execution(self, job_id, tool_id, command_line): for file in self._list_dir(tool_files_dir): if os.path.isdir(join(tool_files_dir, file)): continue - contents = open(join(tool_files_dir, file)).read() + contents = open(join(tool_files_dir, file), "rb").read() log.debug("job_id: {} - checking tool file {}".format(job_id, file)) authorization.authorize_tool_file(basename(file), contents) config_files_dir = job_directory.configs_directory() diff --git a/pulsar/tools/authorization.py b/pulsar/tools/authorization.py index 32412c31..3783f59e 100644 --- a/pulsar/tools/authorization.py +++ b/pulsar/tools/authorization.py @@ -43,7 +43,7 @@ def authorize_tool_file(self, name, contents): tool = self.tool tool_dir = tool.get_tool_dir() tool_dir_file = join(tool_dir, name) - allowed_contents = open(tool_dir_file).read() + allowed_contents = open(tool_dir_file, "rb").read() if contents != allowed_contents: self.__unauthorized("Attempt to write tool file with contents differing from Pulsar copy of tool file.") From 98b03034fbf234d728cfd2dfb1529f2f0b1ae78b Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 12 Sep 2024 16:39:18 +0200 Subject: [PATCH 2/2] Update upload artefact version --- .github/workflows/galaxy_framework.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/galaxy_framework.yaml b/.github/workflows/galaxy_framework.yaml index 52f08d32..6ccaea96 100644 --- a/.github/workflows/galaxy_framework.yaml +++ b/.github/workflows/galaxy_framework.yaml @@ -52,7 +52,7 @@ jobs: GALAXY_TEST_JOB_CONFIG_FILE: ../pulsar/test_data/test_job_conf.yaml GALAXY_CONFIG_OVERRIDE_METADATA_STRATEGY: ${{ matrix.metadata-strategy }} continue-on-error: ${{ matrix.galaxy-branch == 'master' }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: Framework test results (${{ matrix.python-version }}) path: 'galaxy/run_framework_tests.html'