schrodinger.application.phase.packages.phase_database_job_utils module

Performs job-related functionality for phase_database_driver.py.

Copyright Schrodinger LLC, All Rights Reserved.

schrodinger.application.phase.packages.phase_database_job_utils.add_any_arg(args, command, flag, dest=None, subset=False)

Helper function that adds a [-flag, value] pair or [-flag] to the provided command if the value is set in args.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

  • flag – The single-dash flag that externally identifies the argument, such as ‘-new’, ‘-i’ or ‘-source’

  • dest – The destination attribute, such as ‘newdb’ or ‘infile’. May be omitted if dest is derived from flag, e.g, ‘-source’.

  • subset – If True, the argument is an input or output subset specification, in which case get_subset_name will be used to standardize the value before adding to command

Returns

True if argument was added, False if not

Return type

bool

schrodinger.application.phase.packages.phase_database_job_utils.add_convert_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the convert task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_delete_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the delete task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_export_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the export task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_extract_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the extract task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_import_only_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the import task but not the splice task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_import_or_splice_args(args, command)

Helper function for make_backend_command which adds arguments that are used in both the import and splice tasks.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_index_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the index task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_prefer_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the prefer task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_query_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the query task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_revise_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the revise task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.add_subset_args(args, command)

Helper function for make_backend_command which adds arguments that are used in the subset task.

Parameters
  • args (argparse.Namespace) – argparse.Namespace with command line arguments

  • command (list[str]) – Command line list to which arguments are to be added

schrodinger.application.phase.packages.phase_database_job_utils.create_okay_file(prefix)

Creates the file <prefix>.okay with the time/date.

Parameters

prefix (str) – File prefix

schrodinger.application.phase.packages.phase_database_job_utils.get_jobname(args)

Determines the job name from args in the following order of precedence:

  1. args.subjob

  2. args.jobname

  3. args.db_path and args.task

Parameters

args (argparse.Namespace) – argparse.Namespace with command line arguments

Returns

Job name

Return type

str

schrodinger.application.phase.packages.phase_database_job_utils.get_pending_splice_data(db_path, jobname)

For each pending splice subjob, this function returns a tuple of subjob name, subjob database, subjob starting ID, and subjob structure file.

Parameters
  • db_path (str) – Database path/name

  • jobname (str) – Job name of parent splice job

Returns

List of tuples containing subjob information described above

Return type

list[tuple(str, str, int, str)]

Raises

RuntimeError if the starting_blocks file isn’t found

schrodinger.application.phase.packages.phase_database_job_utils.get_pending_subjobs(db_path)

Returns the names of pending subjobs for revise, index and convert jobs.

Parameters

db_path (str) – Database path/name

Returns

Pending subjob names

Return type

list[str]

Raises

RuntimeError if the subjob_names file isn’t found

schrodinger.application.phase.packages.phase_database_job_utils.get_query_subjobs(jobname)

Returns query subjob names read from the file <jobname>_subjob_names.

Parameters

jobname (str) – Parent job name

Returns

Subjob names

Return type

list[str]

Raises

RuntimeError if the <jobname>_subjob_names isn’t found

schrodinger.application.phase.packages.phase_database_job_utils.get_restartable_subjob_args(args)

Returns an argparse.Namespace with arguments that are common to all subjobs of a revise, index or convert job. The arguments needed to launch these subjobs are very basic because once a subjob is running, it reads all of the original arguments from the options file in the restart directory.

Parameters

args (argparse.Namespace) – argparse.Namespace with command line arguments

Returns

Arguments that do not vary from one subjob to the next

Return type

argparse.Namespace

schrodinger.application.phase.packages.phase_database_job_utils.get_testable_value(arg)

Returns a value derived from arg, the logical truth of which may be used by add_any_arg as a condition for adding arg to the command.

Parameters

arg (Any type) – The argument to be tested

Returns

arg or str(arg), the latter if arg is a numeric 0

Return type

type(arg) or str

schrodinger.application.phase.packages.phase_database_job_utils.make_backend_command(args, binary_task=False)

Assembles a phase_database/phase_multi_database backend command from the provided argparse.Namespace. Depending on the supplied arguments, the returned command may do any of the following:

  1. Invoke the top-level phase_database wrapper to launch a subjob.

  2. Invoke the phase_database/phase_multi_database binary to do the setup or cleanup for a job.

  3. Invoke the phase_database binary to perform the actual work of a job or subjob.

Parameters
  • args (argparse.Namespace) – argparse.Namespace from which to construct the command

  • binary_task – If True, the phase_database binary is to be invoked to perform the actual work of a job or subjob. This use case can be tedious or impossible to deduce from args alone, so binary_task is provided to make it unambiguous.

Returns

The command, with the backend as the first argument

Return type

list[str]

schrodinger.application.phase.packages.phase_database_job_utils.restart_supported(task)

Returns True if the supplied task may be restarted.

Parameters

task (str) – The phase_database task

Returns

Whether the task can be restarted

Return type

bool

schrodinger.application.phase.packages.phase_database_job_utils.set_input_and_output_files(args, jsb)

Registers input and output files for the current job through the provided JobSpecification builder. Raises a phase_utils.MissingInputFileError if a required input file is missing.

Parameters
Raises

phase_utils.MissingInputFileError if a required input file is missing