schrodinger.application.desmond.starter.ui.cmdline module¶
Common command line arguments Lightweight framework for defining new command line arguments.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.desmond.starter.ui.cmdline.
Option
(name, default, help, dest)¶ Bases:
tuple
-
name
¶ Alias for field number 0
-
default
¶ Alias for field number 1
-
help
¶ Alias for field number 2
-
dest
¶ Alias for field number 3
-
__contains__
¶ Return key in self.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__len__
¶ Return len(self).
-
count
(value) → integer -- return number of occurrences of value¶
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
-
schrodinger.application.desmond.starter.ui.cmdline.
define_options
(parser: argparse.ArgumentParser, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option])¶ Define the options on a specified parser.
Parameters: - parser – Add options to this parser.
- options – List of options in the format (name, default, help, dest).
-
schrodinger.application.desmond.starter.ui.cmdline.
auto_int
(string)¶
-
schrodinger.application.desmond.starter.ui.cmdline.
get_common_options
() → List[schrodinger.application.desmond.starter.ui.cmdline.Option]¶ Return list of options common to all fep scripts.
-
schrodinger.application.desmond.starter.ui.cmdline.
suppress_options
(options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], excluded: Set[str])¶ Modify the options as specified by
excluded
by replacing the help text withargparse.SUPPRESS
, which will effectively hide the specified options in the command line. No effects if eitheroptions
orexcluded
is an empty container.
-
schrodinger.application.desmond.starter.ui.cmdline.
get_parser
(usage: str, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], add_help: bool = True, add_subhost: bool = True) → argparse.ArgumentParser¶ Return a command-line parser with the given options.
Parameters: - usage – Usage to display if no arguments given.
- options – List of options
- add_help – Whether to add help flag to the parser
Returns: Configured command-line parser
-
schrodinger.application.desmond.starter.ui.cmdline.
parse_known_options
(usage: str, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], argv: List[str], add_subhost: bool = True) → Tuple[argparse.Namespace, Optional[str]]¶ Parse and return the parsed options.
Parameters: - usage – Usage to display if no arguments given.
- options – List of options in the format (name, default, help, destination).
- argv – List of input arguments.
Returns: (Known parsed options, unknown options)
Raises: SystemExit – If no arguments given, show the usage and exit.
-
schrodinger.application.desmond.starter.ui.cmdline.
parse_options
(usage: str, options: List[schrodinger.application.desmond.starter.ui.cmdline.Option], argv: List[str], add_subhost: bool = True) → Tuple[argparse.Namespace, Optional[str]]¶ Parse and return the parsed options.
Parameters: - usage – Usage to display if no arguments given.
- options – List of options in the format (name, default, help, dest).
- argv – List of input arguments
- add_subhost – Add the -SUBHOST option?
Returns: Parsed options
Raises: SystemExit – If no arguments given or if there is unknown arguments, show the usage and exit.
-
class
schrodinger.application.desmond.starter.ui.cmdline.
BaseArgs
(opt: argparse.Namespace)¶ Bases:
object
Base class for arguments. A subclass of this class contains all the command-line arguments. The jobcontrol-related arguments, which are consumed by the toplevel script, are recovered.
-
__init__
(opt: argparse.Namespace)¶ Parameters: opt – Command line options with corresponding values.
-
validate
()¶ Validate the parameters.
Raises: SystemExit – For invalid parameters.
-
copy_parser_attributes
(opt: argparse.ArgumentParser)¶ Copy parser options (e.g: time, buffer, …) from
opt
toself
. Subclass needs to call this method in __init__
-
check_ppj
()¶ Raise a warning if restarting and trying to set ppj.
Raises: UserWarning – If ppj set for a restarted job.
-
set_restart
()¶ Set the RESTART flag if only the checkpoint is given.
-
generate_jobname
()¶ If the JOBNAME was not set and not RESTART’ing, automatically generate a job name.
-
set_mps_factor
(val)¶ Set the mps oversubcription factor. If val is
auto
, the mps factor will be determined automatically. Otherwise it is set directly, and should have anint
value.0
is treated equivalently to the value1
.
-