diff --git a/src/DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py b/src/DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py index b8dc79c9ea6..69a48cbf9a5 100755 --- a/src/DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py +++ b/src/DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py @@ -307,7 +307,7 @@ def __prepareCommand(self): executable = shutil.which(executable) or executable # Make the full path since . is not always in the PATH - executable = os.path.abspath(executable) + executable = os.path.abspath(os.path.join(self.jobIDPath, executable)) if not os.path.exists(executable): self.__report(status=JobStatus.FAILED, minorStatus=JobMinorStatus.APP_NOT_FOUND, sendFlag=True) return S_ERROR(f"Path to executable {executable} not found") diff --git a/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py b/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py index d9679d40627..82316bbd286 100644 --- a/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py +++ b/src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_JobWrapper.py @@ -134,10 +134,17 @@ def test_preProcess_nonexistent_executable(setup_job_wrapper): """Test the pre process method of the JobWrapper class: nonexistent executable.""" jw = setup_job_wrapper({"Executable": "pippo"}) + # Without a jobID result = jw.preProcess() assert not result["OK"] assert result["Message"] == f"Path to executable {os.getcwd()}/pippo not found" + # With a jobID + jw.jobIDPath = jw.jobIDPath / "123" + result = jw.preProcess() + assert not result["OK"] + assert result["Message"] == f"Path to executable {os.getcwd()}/123/pippo not found" + def test_preProcess_dirac_jobexec(setup_job_wrapper): """Test the pre process method of the JobWrapper class: dirac-jobexec."""