Package schrodinger :: Package job :: Module launcher
[hide private]
[frames] | no frames]

Module launcher

A class for launching individual executables under job control.

Launcher is a Python wrapper for using the external 'jlaunch' script. It simplifies the creation of the "startup script" for a script running under job control.

NOTE: Launcher is designed for use within startup scripts only. If there is a script/executable that needs to be submitted under job control by another script, please file a case to have a startup script written for it; then use jobcontrol.launch_job() to launch it. You can also use the launch_local_job() function from this module instead of having a startup script for running jobs on localhost.

Copyright Schrodinger, LLC. All rights reserved.

Classes [hide private]
  Launcher
Run a program (typically a Python or shell script) under job control.
Functions [hide private]
 
launch(script, args=None, input_files=None, force_input_files=None, output_files=None, req_output_files=None, structure_output_file=None, structure_monitor_file=None, log_files=None, envs=None, licenses=None, print_jobid=True, appendlogs=False, nolaunch=None, **kwargs)
Launch a job directly, without creating an explicit Launcher instance.
 
launch_local_job(cmd, jobname, print_jobid=True)
Submit the specified command to run under job control with -LOCAL, and return the Job object.
Variables [hide private]
  __doc__ = ...
  _version = '$Revision: 1.78 $'
  _logger = logging.getLogger("schrodinger.job.launcher")
  jobid_re = re.compile(r'(?im)^JobId:\s+(\S+)')
  LOCAL_RUN = '/scr/buildbot/savedbuilds/NB/2016-4/build-126/run'
  __package__ = 'schrodinger.job'
Function Details [hide private]

launch(script, args=None, input_files=None, force_input_files=None, output_files=None, req_output_files=None, structure_output_file=None, structure_monitor_file=None, log_files=None, envs=None, licenses=None, print_jobid=True, appendlogs=False, nolaunch=None, **kwargs)

 

Launch a job directly, without creating an explicit Launcher instance. This function supports same arguments as the Launcher class constructor, as well as those listed below. These additional arguments are all optional.

NOTE: Launcher is designed for use within startup scripts only.

Parameters:
  • args - A list of string arguments to pass to the backend program. (default: None)
  • input_files - A list of input files that are required for the job to run. These will be copied to the job directory unless they're already accessible with the given pathnames. (default: None)
  • force_input_files - A list of input files that should be transfered to the job directory, regardless of whether they're already accessible or not. (default: None)
  • output_files - A list of output files to register with job control. These files will be copied back to the launch directory after the backend completes. Missing files are silently ignored. (default: None)
  • req_output_files - A list of output files to register with job control. These files will be copied back to the launch directory after the backend completes. Missing files mark the job as "died". (default: None)
  • structure_output_file - The name of the structure output file. If this job's results are supposed to be incorporated into a Maestro project, then this is the file that will be incorporated. (default: None)
  • structure_monitor_file - The name of the structure monitor file. If this job is monitored from Maestro, then this file will be used to get the structure to display. (default: None)
  • log_files - A list of log files to register with job control. These files will be copied back to the launch directory continually while the job is running. (default: None)
  • envs - A list of environment variable settings to be made on the compute node. Each setting should be a string, in the form "MYENV=value". (default: None)
  • licenses - A list of required licenses. Each requirement is specified as a string in the form 'TOKEN' or 'TOKEN:n', where TOKEN is the name of the license and n is the number of tokens checked out. (default: None)
  • print_jobid - Whether to print the JobId of the newly launched job to the terminal. (default: True)
  • appendlogs - If true, appends to log files rather than creating blank ones. (default: False)
Returns:
The job object, if launched successfully under job control, otherwise None.
Raises:
  • IOError - if any of the input files are missing.

launch_local_job(cmd, jobname, print_jobid=True)

 

Submit the specified command to run under job control with -LOCAL, and
return the Job object. The job will be run localhost without any job file
copying. When launching Python scripts, include launcher.LOCAL_RUN as the
first item in the cmd list.

Use this function to submit simple scripts and executables under job
control from GUIs or other scripts.

<jobname> - Job name to use for this job. Job's standard and error
            output will be saved to <jobname>.log

<print_jobid> - Whether to print the job ID of the job when it is launched
                (defualt is True)

Will raise an exception if a job fails to run.

NOTE: The job is submitted with the equivalent of Launcher's runtoplevel
option set to True, which means it can be used from GUIs.


Variables Details [hide private]

__doc__

Value:
"""
A class for launching individual executables under job control.

Launcher is a Python wrapper for using the external 'jlaunch' script.
It simplifies the creation of the "startup script" for a script runnin\
g
under job control.

...