LocalThreadServer.run_script (function)
def run_script(self, script, files=[], conda_env=None, trial_run=False)
Run a script in the server directory in the conda_env
, and wait for it to complete.
The files are copied and executed in LocalThreadServer.directory directly (whereas LocalThreadJob scripts are executed in subdirectories).
This is useful for short installation/setup scripts that do not belong in the scheduled job.
The resulting script
and files
are copied to LocalThreadServer.directory
and then script
is executed.
script
(string or list): shell script to run in the server directory, including any necessary installation steps. Note that the script can call any other scripts infiles
. If a string, must be the path of a valid file which will be copied to the server. If a list, must be a list of commands (i.e. a newline will be placed between each item in the list and sent as a single script to the server).files
(list, optional, default=[]): list of paths to additional files to copy to the server directory required in order to successfully executescript
.conda_env
(string or None, optional, default=None): name of the conda environment to run the script or False to not use a conda environment. If not passed or None, will default to 'default' if conda is installed on the server or to False otherwise.trial_run
(bool, optional, default=False): if True, the commands that would be sent to the server are returned but not executed.
- None
- TypeError: if
script
orfiles
are not valid types. - ValueError: if the files referened by
script
orfiles
are not valid.