Skip to content

Commit 389391f

Browse files
committed
feat: added includeInSandbox flag to Job().setExecutable(). Default: True
1 parent 9485bc7 commit 389391f

File tree

1 file changed

+12
-2
lines changed
  • src/DIRAC/Interfaces/API

1 file changed

+12
-2
lines changed

src/DIRAC/Interfaces/API/Job.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ def __init__(self, script=None, stdout="std.out", stderr="std.err"):
9393

9494
#############################################################################
9595

96-
def setExecutable(self, executable, arguments="", logFile="", modulesList=None, parameters=None, paramValues=None):
96+
def setExecutable(
97+
self,
98+
executable,
99+
arguments="",
100+
logFile="",
101+
modulesList=None,
102+
parameters=None,
103+
paramValues=None,
104+
includeInSandbox=True,
105+
):
97106
"""Helper function.
98107
99108
Specify executable script to run with optional arguments and log file
@@ -118,12 +127,13 @@ def setExecutable(self, executable, arguments="", logFile="", modulesList=None,
118127
:type parameters: python:list of tuples
119128
:param paramValues: Optional list of parameters values (to be used mostly when extending this method)
120129
:type parameters: python:list of tuples
130+
:param bool includeInSandbox: flag to include the executable in the input sandbox (default: False)
121131
"""
122132
kwargs = {"executable": executable, "arguments": arguments, "logFile": logFile}
123133
if not isinstance(executable, str) or not isinstance(arguments, str) or not isinstance(logFile, str):
124134
return self._reportError("Expected strings for executable and arguments", **kwargs)
125135

126-
if os.path.exists(executable):
136+
if includeInSandbox and os.path.exists(executable):
127137
self.log.verbose(f"Found script executable file {executable}")
128138
self.addToInputSandbox.append(executable)
129139
logName = f"{os.path.basename(executable)}.log"

0 commit comments

Comments
 (0)