schrodinger.application.livedesign.job_utils module

LiveDesign protocol job launching utils

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.livedesign.job_utils.get_procs(backend)[source]

Determine the HOST and number of CPUs to be used

Parameters

backend ('schrodinger.job.jobcontrol._Backend', None) – Job backend object

Returns

String of the hostname:processors

Return type

str

schrodinger.application.livedesign.job_utils.use_smart_dist()[source]

Enable/disable Smart Distribution when running on a queuing system

Default behavior (True) is to use Smart Distribution when the env var is not set

Returns

True/False based on the env var setting

Return type

bool

class schrodinger.application.livedesign.job_utils.LigPrepJob(infile, outfile, host_str, ligprep_inp=None, ligprep_args='')[source]

Bases: schrodinger.job.queue.JobControlJob

LigPrep Job object

base_command = ['ligprep']
__init__(infile, outfile, host_str, ligprep_inp=None, ligprep_args='')[source]

Create a LigPrep job object using in the input, output and job settings

Parameters
  • infile (str) – Input SD file

  • outfile (str) – Output Maestro file

  • host_str (str) – Str containing hostname:cpus

  • ligprep_inp (str, None) – File containing LigPrep keyword/value arguments

  • ligprep_args (str, None) – LigPrep options

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

Add a function to be invoked when the job completes successfully.

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

Make all jobs connected to job prerequisites of all jobs connected to this Job.

addPrereq(job: schrodinger.job.queue.BaseJob)

Add a job that is an immediate prerequisite for this one.

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted() bool

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

doCommand(host: str, local: bool = False)

Launch job on specified host using jobcontrol.launch_job().

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs that are prerequisites on this one.

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

Return the launch/command directory name. If None is returned, the job will be launched in the current directory.

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

getJob() Optional[schrodinger.job.jobcontrol.Job]

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

Return the JobDJ instance that this job has been added to.

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, host).

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg: str)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries: int = 0) bool

This method will be called when the job has failed, and JobDJ needs to know whether the job should be retried or not.

JobDJ’s value for the max_retries parameter is passed in, to be used when the job doesn’t have its own max_retries value.

Return True if this job should be retried, otherwise False.

run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.

  2. Call the doCommand to do the actual work of computation or job launching.

  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.

runsLocally() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setup()

A method to do initial setup; executed after preCommand, just before doCommand.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Raises

RuntimeError – if an unknown Job Status or ExitStatus is encountered.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.