Skip to content

Commit

Permalink
fix(WMS): JobWrapper checks existence of executable in jobIDPath
Browse files Browse the repository at this point in the history
  • Loading branch information
aldbr committed Oct 11, 2024
1 parent c293d32 commit 1cfe509
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = str(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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 1cfe509

Please sign in to comment.