Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/DIRAC/Interfaces/API/Job.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,16 @@ def __init__(self, script=None, stdout="std.out", stderr="std.err"):

#############################################################################

def setExecutable(self, executable, arguments="", logFile="", modulesList=None, parameters=None, paramValues=None):
def setExecutable(
self,
executable,
arguments="",
logFile="",
modulesList=None,
parameters=None,
paramValues=None,
includeInSandbox=True,
):
"""Helper function.

Specify executable script to run with optional arguments and log file
Expand All @@ -118,17 +127,18 @@ def setExecutable(self, executable, arguments="", logFile="", modulesList=None,
:type parameters: python:list of tuples
:param paramValues: Optional list of parameters values (to be used mostly when extending this method)
:type parameters: python:list of tuples
:param bool includeInSandbox: flag to include the executable in the input sandbox (default: True)
"""
kwargs = {"executable": executable, "arguments": arguments, "logFile": logFile}
if not isinstance(executable, str) or not isinstance(arguments, str) or not isinstance(logFile, str):
return self._reportError("Expected strings for executable and arguments", **kwargs)

if os.path.exists(executable):
if includeInSandbox and os.path.exists(executable):
self.log.verbose(f"Found script executable file {executable}")
self.addToInputSandbox.append(executable)
logName = f"{os.path.basename(executable)}.log"
else:
self.log.warn("The executable code could not be found locally")
self.log.verbose("The executable code is not local")
logName = "CodeOutput.log"

self.stepCount += 1
Expand Down
Loading