schrodinger.application.phase.packages.phase_database_arg_utils module

Does argument parsing and validation for phase_database_driver.py.

Copyright Schrodinger LLC, All Rights Reserved.

schrodinger.application.phase.packages.phase_database_arg_utils.TASK_TUPLE

alias of schrodinger.application.phase.packages.phase_database_arg_utils.DatabaseTask

schrodinger.application.phase.packages.phase_database_arg_utils.add_blimit_arg(parser, convert=False)

Adds -blimit argument to parser.

Parameters
  • parser (argparse.ArgumentParser) – Argument parser object

  • convert (bool) – Whether help message should be tailored for convert task

schrodinger.application.phase.packages.phase_database_arg_utils.add_convert_args(subparsers, restart_job=False)

Adds arguments for TASK.CONVERT.

Parameters
  • subparsers – Argument subparsers object.

  • restart_job (bool) – Whether parser will be applied to a command that contains -RESTART. If True, certain required arguments become optional.

schrodinger.application.phase.packages.phase_database_arg_utils.add_delete_args(subparsers)

Adds arguments for TASK.DELETE.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_export_args(subparsers)

Adds arguments for TASK.EXPORT.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_extract_args(subparsers)

Adds arguments for TASK.EXTRACT.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_hidden_args(parser)

Adds hidden arguments that are supported by certain tasks.

Parameters

parser (argparse.ArgumentParser) – Argument parser object

schrodinger.application.phase.packages.phase_database_arg_utils.add_import_args(subparsers, restart_job=False)

Adds arguments for TASK.IMPORT.

Parameters
  • subparsers – Argument subparsers object.

  • restart_job (bool) – Whether parser will be applied to a command that contains -RESTART. If True, certain required arguments become optional.

schrodinger.application.phase.packages.phase_database_arg_utils.add_index_args(subparsers)

Adds arguments for TASK.INDEX.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_jobcontrol_args(parser, task, host_metavar=None, host_help=None, restart=False)

Adds job control arguments.

Parameters
  • parser (argparse.ArgumentParser) – Argument parser object

  • task (str) – The task to be performed

  • host_metavar (str or NoneType) – Overrides -HOST metavar parameter

  • host_help (str or NoneType) – Overrides -HOST help message

  • restart (bool) – Whether to add -RESTART argument

schrodinger.application.phase.packages.phase_database_arg_utils.add_new_database_args(parser, alt_index=True)

Adds arguments for new database creation. The alternate index argument is added only if alt_index is True.

Parameters

parser (argparse.ArgumentParser) – Argument parser object

schrodinger.application.phase.packages.phase_database_arg_utils.add_new_flag(parser, convert=False)

Adds -new database creation flag to parser.

Parameters
  • parser (argparse.ArgumentParser) – Argument parser object

  • convert (bool) – Whether help message should be tailored for convert task

schrodinger.application.phase.packages.phase_database_arg_utils.add_prefer_args(subparsers)

Adds arguments for TASK.PREFER.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_query_args(subparsers)

Adds arguments for TASK.QUERY.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_revise_args(subparsers)

Adds arguments for TASK.REVISE.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_splice_args(subparsers, restart_job=False)

Adds arguments for TASK.SPLICE.

Parameters
  • subparsers – Argument subparsers object.

  • restart_job (bool) – Whether parser will be applied to a command that contains -RESTART. If True, certain required arguments become optional.

schrodinger.application.phase.packages.phase_database_arg_utils.add_subset_args(subparsers)

Adds arguments for TASK.SUBSET.

Parameters

subparsers – Argument subparsers object.

schrodinger.application.phase.packages.phase_database_arg_utils.add_task_help_flag(parser, task)

Adds -help_<task> flag to parser.

Parameters
  • parser (argparse.ArgumentParser) – Argument parser object

  • task (str) – The task to perform

schrodinger.application.phase.packages.phase_database_arg_utils.add_verbose_flag(parser)

Adds -verbose flag to parser.

Parameters

parser (argparse.ArgumentParser) – Argument parser object

schrodinger.application.phase.packages.phase_database_arg_utils.get_parser(restart_job=False)

Creates argparse.ArgumentParser with supported command line options.

Parameters

restart_job (bool) – Whether parser will be applied to a command that contains -RESTART. If True, certain required arguments become optional.

Returns

Argument parser object

Return type

argparse.ArgumentParser

schrodinger.application.phase.packages.phase_database_arg_utils.make_validate_command(argv)

Assembles a phase_database or phase_multi_database command for purposes of validating arguments supplied at startup time. Assumes that the first two elements of argv are the database name and task.

Parameters

argv (list[str]) – Command line arguments, excluding program name

Returns

A command that can be run as a subprocess for validation

Return type

list[str]

schrodinger.application.phase.packages.phase_database_arg_utils.standardize_args(argv)

Standardizes command line arguments, which may contain legacy syntax, to conform to the current advertised phase_database usage. This is done to ensure that argument parsing in this module works, but it is not necessarily appropriate for invoking the binaries compiled from C++ code. Assumes the first two elements of argv are database name and task, respectively, unless the first argument is -trust, in which case -trust is removed and the rest of the command is returned unmodified.

Parameters

argv (list[str]) – Command line arguments

Returns

Command line arguments that conform to the advertised usage

Return type

list[str]

schrodinger.application.phase.packages.phase_database_arg_utils.validate_args(argv)

Checks the validity of command line arguments supplied at startup time by passing them to the phase_database or phase_multi_database binary with the -check flag and capturing any error message. Assumes that the first two elements of argv are the database name and task.

Parameters

argv (list[str]) – Command line arguments, excluding program name

Returns

tuple of validity and non-empty error message if not valid

Return type

bool, str