schrodinger.tasks.stepper module¶
-
class
schrodinger.tasks.stepper.
StepperFolder
¶ Bases:
schrodinger.models.json.JsonableClassMixin
,str
See
BaseStep
for documentation.-
classmethod
fromJsonImplementation
(json_str)¶ Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.
Parameters: json_dict (dict) – A dictionary loaded from a JSON string or file. Returns: An instance of the derived class. :rtype : cls
-
toJsonImplementation
()¶ Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.
Returns: A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders
-
__contains__
¶ Return key in self.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__len__
¶ Return len(self).
-
capitalize
() → str¶ Return a capitalized version of S, i.e. make the first character have upper case and the rest lower case.
-
casefold
() → str¶ Return a version of S suitable for caseless comparisons.
-
center
(width[, fillchar]) → str¶ Return S centered in a string of length width. Padding is done using the specified fill character (default is a space)
-
count
(sub[, start[, end]]) → int¶ Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
-
encode
(encoding='utf-8', errors='strict') → bytes¶ Encode S using the codec registered for encoding. Default encoding is ‘utf-8’. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
-
endswith
(suffix[, start[, end]]) → bool¶ Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
-
expandtabs
(tabsize=8) → str¶ Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
-
find
(sub[, start[, end]]) → int¶ Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
-
format
(*args, **kwargs) → str¶ Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{‘ and ‘}’).
-
format_map
(mapping) → str¶ Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{‘ and ‘}’).
-
classmethod
fromJson
(json_obj)¶ A factory method which constructs a new object from a given dict loaded from a json string or file.
Parameters: json_obj (dict) – A json-loaded dictionary to create an object from. Returns: An instance of this class. :rtype : cls
-
get_version
()¶ Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.
-
index
(sub[, start[, end]]) → int¶ Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
-
isalnum
() → bool¶ Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
-
isalpha
() → bool¶ Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
-
isdecimal
() → bool¶ Return True if there are only decimal characters in S, False otherwise.
-
isdigit
() → bool¶ Return True if all characters in S are digits and there is at least one character in S, False otherwise.
-
isidentifier
() → bool¶ Return True if S is a valid identifier according to the language definition.
Use keyword.iskeyword() to test for reserved identifiers such as “def” and “class”.
-
islower
() → bool¶ Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
-
isnumeric
() → bool¶ Return True if there are only numeric characters in S, False otherwise.
-
isprintable
() → bool¶ Return True if all characters in S are considered printable in repr() or S is empty, False otherwise.
-
isspace
() → bool¶ Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
-
istitle
() → bool¶ Return True if S is a titlecased string and there is at least one character in S, i.e. upper- and titlecase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.
-
isupper
() → bool¶ Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
-
join
(iterable) → str¶ Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.
-
ljust
(width[, fillchar]) → str¶ Return S left-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).
-
lower
() → str¶ Return a copy of the string S converted to lowercase.
-
lstrip
([chars]) → str¶ Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead.
-
static
maketrans
()¶ Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
-
partition
(sep) -> (head, sep, tail)¶ Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.
-
replace
(old, new[, count]) → str¶ Return a copy of S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
-
rfind
(sub[, start[, end]]) → int¶ Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
-
rindex
(sub[, start[, end]]) → int¶ Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
-
rjust
(width[, fillchar]) → str¶ Return S right-justified in a string of length width. Padding is done using the specified fill character (default is a space).
-
rpartition
(sep) -> (head, sep, tail)¶ Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.
-
rsplit
(sep=None, maxsplit=-1) → list of strings¶ Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator.
-
rstrip
([chars]) → str¶ Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead.
-
split
(sep=None, maxsplit=-1) → list of strings¶ Return a list of the words in S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.
-
splitlines
([keepends]) → list of strings¶ Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
-
startswith
(prefix[, start[, end]]) → bool¶ Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
-
strip
([chars]) → str¶ Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead.
-
swapcase
() → str¶ Return a copy of S with uppercase characters converted to lowercase and vice versa.
-
title
() → str¶ Return a titlecased version of S, i.e. words start with title case characters, all remaining cased characters have lower case.
-
toJson
(_mark_version=True)¶ Create and returns a data structure made up of jsonable items.
Return type: An instance of one the classes from NATIVE_JSON_DATATYPES
-
translate
(table) → str¶ Return a copy of the string S in which each character has been mapped through the given translation table. The table must implement lookup/indexing via __getitem__, for instance a dictionary or list, mapping Unicode ordinals to Unicode ordinals, strings, or None. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
-
upper
() → str¶ Return a copy of S converted to uppercase.
-
zfill
(width) → str¶ Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.
-
classmethod
-
class
schrodinger.tasks.stepper.
StepperFile
¶ Bases:
schrodinger.models.json.JsonableClassMixin
,str
See
BaseStep
for documentation.-
classmethod
fromJsonImplementation
(json_str)¶ Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.
Parameters: json_dict (dict) – A dictionary loaded from a JSON string or file. Returns: An instance of the derived class. :rtype : cls
-
toJsonImplementation
()¶ Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.
Returns: A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders
-
__contains__
¶ Return key in self.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__len__
¶ Return len(self).
-
capitalize
() → str¶ Return a capitalized version of S, i.e. make the first character have upper case and the rest lower case.
-
casefold
() → str¶ Return a version of S suitable for caseless comparisons.
-
center
(width[, fillchar]) → str¶ Return S centered in a string of length width. Padding is done using the specified fill character (default is a space)
-
count
(sub[, start[, end]]) → int¶ Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
-
encode
(encoding='utf-8', errors='strict') → bytes¶ Encode S using the codec registered for encoding. Default encoding is ‘utf-8’. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
-
endswith
(suffix[, start[, end]]) → bool¶ Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
-
expandtabs
(tabsize=8) → str¶ Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
-
find
(sub[, start[, end]]) → int¶ Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
-
format
(*args, **kwargs) → str¶ Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{‘ and ‘}’).
-
format_map
(mapping) → str¶ Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{‘ and ‘}’).
-
classmethod
fromJson
(json_obj)¶ A factory method which constructs a new object from a given dict loaded from a json string or file.
Parameters: json_obj (dict) – A json-loaded dictionary to create an object from. Returns: An instance of this class. :rtype : cls
-
get_version
()¶ Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.
-
index
(sub[, start[, end]]) → int¶ Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
-
isalnum
() → bool¶ Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
-
isalpha
() → bool¶ Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
-
isdecimal
() → bool¶ Return True if there are only decimal characters in S, False otherwise.
-
isdigit
() → bool¶ Return True if all characters in S are digits and there is at least one character in S, False otherwise.
-
isidentifier
() → bool¶ Return True if S is a valid identifier according to the language definition.
Use keyword.iskeyword() to test for reserved identifiers such as “def” and “class”.
-
islower
() → bool¶ Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
-
isnumeric
() → bool¶ Return True if there are only numeric characters in S, False otherwise.
-
isprintable
() → bool¶ Return True if all characters in S are considered printable in repr() or S is empty, False otherwise.
-
isspace
() → bool¶ Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
-
istitle
() → bool¶ Return True if S is a titlecased string and there is at least one character in S, i.e. upper- and titlecase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.
-
isupper
() → bool¶ Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
-
join
(iterable) → str¶ Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.
-
ljust
(width[, fillchar]) → str¶ Return S left-justified in a Unicode string of length width. Padding is done using the specified fill character (default is a space).
-
lower
() → str¶ Return a copy of the string S converted to lowercase.
-
lstrip
([chars]) → str¶ Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead.
-
static
maketrans
()¶ Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
-
partition
(sep) -> (head, sep, tail)¶ Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.
-
replace
(old, new[, count]) → str¶ Return a copy of S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
-
rfind
(sub[, start[, end]]) → int¶ Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
-
rindex
(sub[, start[, end]]) → int¶ Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
-
rjust
(width[, fillchar]) → str¶ Return S right-justified in a string of length width. Padding is done using the specified fill character (default is a space).
-
rpartition
(sep) -> (head, sep, tail)¶ Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.
-
rsplit
(sep=None, maxsplit=-1) → list of strings¶ Return a list of the words in S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified, any whitespace string is a separator.
-
rstrip
([chars]) → str¶ Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead.
-
split
(sep=None, maxsplit=-1) → list of strings¶ Return a list of the words in S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.
-
splitlines
([keepends]) → list of strings¶ Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
-
startswith
(prefix[, start[, end]]) → bool¶ Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
-
strip
([chars]) → str¶ Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead.
-
swapcase
() → str¶ Return a copy of S with uppercase characters converted to lowercase and vice versa.
-
title
() → str¶ Return a titlecased version of S, i.e. words start with title case characters, all remaining cased characters have lower case.
-
toJson
(_mark_version=True)¶ Create and returns a data structure made up of jsonable items.
Return type: An instance of one the classes from NATIVE_JSON_DATATYPES
-
translate
(table) → str¶ Return a copy of the string S in which each character has been mapped through the given translation table. The table must implement lookup/indexing via __getitem__, for instance a dictionary or list, mapping Unicode ordinals to Unicode ordinals, strings, or None. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
-
upper
() → str¶ Return a copy of S converted to uppercase.
-
zfill
(width) → str¶ Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.
-
classmethod
-
class
schrodinger.tasks.stepper.
ValidationIssue
(source_step, err_msg)¶ Bases:
object
-
__init__
(source_step, err_msg)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.tasks.stepper.
SettingsError
(source_step, err_msg)¶ Bases:
schrodinger.tasks.stepper.ValidationIssue
Used in conjunction with
BaseStep.validateSettings
to report an error with settings. Constructed with the step with the invalid settings and an error message, e.g.SettingsError(bad_step, "Step does not have required settings."
)-
__init__
(source_step, err_msg)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.tasks.stepper.
SettingsWarning
(source_step, err_msg)¶ Bases:
schrodinger.tasks.stepper.ValidationIssue
Used in conjunction with
BaseStep.validateSettings
to report a warning with settings. Constructed with the step with the invalid settings and an error message, e.g.SettingsError(bad_step, "Step setting FOO should ideally by non-negative"
)-
__init__
(source_step, err_msg)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.tasks.stepper.
BaseStep
(settings=None, batch_size=None, batch_settings=None, config=None, step_id=None, **kwargs)¶ Bases:
object
FIXME: This docstring needs to be split across BaseStep and Step
A computational step that performs a function on input items from an input source to produce output items.
To construct a Step:
- Implement stepFunction
- Define Input (the type expected by the stepFunction)
- Define Output (the type of item produced by the stepFunction)
- Define Settings (data class for any settings needed by the stepFunction)
To use a step, instantiate it and request outputs. Accessing outputs causes the step to get input from the input source and run the step function. There is no concept of “running” or “starting” the step.
step = MyStep() for output in step.outputs():
print(output)# OR print(step.getOutputs())
The outputs are produced with a generator. Thus, calling
step.getOutputs()
twice will always result in an empty empty list for the second call.To specify a file, use the
StepperFile
class as the input type, output type, or as a subparam on theSettings
class. Files specified in these locations will automatically be copied to and from compute machines.You can similarly specify `StepperFolder`s to have folders copied over to compute machines. Currently, `StepperFolder`s can only be used with step settings, not as step inputs or outputs.
Strings specified in
config
forStepperFile
and `StepperFolder`s will be automatically cast.-
Input
= None¶
-
Output
= None¶
-
Settings
= None¶
-
__init__
(settings=None, batch_size=None, batch_settings=None, config=None, step_id=None, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
validateSettings
()¶ Check whether the step settings are valid and return a list of `SettingsError`s and `SettingsWarning`s to report any invalid settings. Default implementation checks that all stepper files are set to valid file paths.
Return type: list[TaskError or TaskWarning]
-
getStepId
()¶
-
setInputsFromFile
(fname)¶ Read in inputs from
fname
. By default, each line is simply fed intoself.Input
. Override this method if more complex behavior is needed to read in input from files.
-
writeOutputsToFile
(fname)¶ Write outputs to
fname
. By default, the output file will consist of one line for each output with whatever is produced when passing the out- put tostr
. Override this method if more complex behavior is needed.
-
setUp
()¶ Hook for adding any type of work that needs to happen before any outputs are created.
-
cleanUp
()¶ Hook for adding any type of work that needs to happen after all outputs are exhausted or if some outputs are created and the step is destroyed.
-
setSettings
(*args, **kwargs)¶
-
setBatchSettings
(*args, **kwargs)¶
-
setInputs
(*args, **kwargs)¶
-
closeGenerator
()¶ Closes the output generator for this step, if it exists. This allows the steps input and settings to be changed, and a new generator to be created.
-
inputs
()¶
-
outputs
(*args, **kwargs)¶
-
getOutputs
()¶ Gets all the outputs in a list by fully iterating the output generator.
-
stepFunction
(input)¶ The main computation for this step. This function should take in a single input item and return an iterable of outputs. This allows a single output to produce multiple ouputs (e.g. enumeration).
The output may be yielded as a generator, in order to reduce memory usage.
Parameters: input – this will be a single input item from the input source. Implementer is encouraged to use a more descriptive, context- specific variable name. Example:
- def stepFunction(self, starting_smiles):
- …
-
class
schrodinger.tasks.stepper.
Step
(settings=None, batch_size=None, batch_settings=None, config=None, step_id=None, **kwargs)¶ Bases:
schrodinger.tasks.stepper.BaseStep
-
stepFunction
(input)¶ The main computation for this step. This function should take in a single input item and return an iterable of outputs. This allows a single output to produce multiple ouputs (e.g. enumeration).
The output may be yielded as a generator, in order to reduce memory usage.
If only a single output is produced for each input, return it as a single-element list.
Parameters: input – this will be a single input item from the input source. Implementer is encouraged to use a more descriptive, context- specific variable name. Example:
- def stepFunction(self, starting_smiles):
- …
-
Input
= None¶
-
Output
= None¶
-
Settings
= None¶
-
__init__
(settings=None, batch_size=None, batch_settings=None, config=None, step_id=None, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
cleanUp
()¶ Hook for adding any type of work that needs to happen after all outputs are exhausted or if some outputs are created and the step is destroyed.
-
closeGenerator
()¶ Closes the output generator for this step, if it exists. This allows the steps input and settings to be changed, and a new generator to be created.
-
getOutputs
()¶ Gets all the outputs in a list by fully iterating the output generator.
-
getStepId
()¶
-
inputs
()¶
-
outputs
(*args, **kwargs)¶
-
setBatchSettings
(*args, **kwargs)¶
-
setInputs
(*args, **kwargs)¶
-
setInputsFromFile
(fname)¶ Read in inputs from
fname
. By default, each line is simply fed intoself.Input
. Override this method if more complex behavior is needed to read in input from files.
-
setSettings
(*args, **kwargs)¶
-
setUp
()¶ Hook for adding any type of work that needs to happen before any outputs are created.
-
validateSettings
()¶ Check whether the step settings are valid and return a list of `SettingsError`s and `SettingsWarning`s to report any invalid settings. Default implementation checks that all stepper files are set to valid file paths.
Return type: list[TaskError or TaskWarning]
-
writeOutputsToFile
(fname)¶ Write outputs to
fname
. By default, the output file will consist of one line for each output with whatever is produced when passing the out- put tostr
. Override this method if more complex behavior is needed.
-
-
class
schrodinger.tasks.stepper.
Chain
(*args, **kwargs)¶ Bases:
schrodinger.tasks.stepper.BaseStep
Run a series of steps. The steps must be created by overriding buildChain.
## Configuration A step can take a configuration dictionary that maps step selectors to default setting values. For example:
Chain(config={'A':{'max_rounds':10}})
This configuration will go through
Chain
and set all settings of A step’s to havemax_rounds
value of 10.there are three currently supported selectors:
- General selectors e.g. “A”:
- This will select all steps of type “A” (Note that this does not select subclasses of “A”)
- Child selectors e.g. “A>B”
- This will select all steps of type “B” that are components of “A” chains. The “>” operator can be chained together. For example, “A>B>C” will select all “C” steps that are components of “B” chains which are components of an “A” chain.
- ID selector e.g. “A.B_0”
- This will select the first “B” step in chain “A”. The top level chain never has an index. All steps inside of a chain are indexed by its index in the chain respective of steps of the same type. For example, if chain “A” is composed of steps BCBCC, then the ids would be “A.B_0”, “A.C_0”, “A.B_1”, “A.C_1”, “A.C_2”
-
validateSettings
()¶ Check whether the chain settings are valid and return a list of `SettingsError`s and `SettingsWarning`s to report any invalid settings. Default implementation simply returns problems from all child steps.
Return type: list[TaskError or TaskWarning]
-
Input
¶
-
Output
¶
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
__len__
()¶
-
addStep
(step)¶
-
report
(prefix='')¶ Report the workflow steps and their settings (recursively).
Parameters: prefix (str) – the text to start each line with
-
validateChain
()¶ Checks that the declaration of the chain is internally consistent - i.e. that each step is valid and each step’s Input class matches the preceding step’s Output class.
-
buildChain
()¶ This method must be implemented by subclasses to build the chain. The chain is built by modifying self.steps. The chain’s composiion may be dependent on self.settings.
-
Settings
= None¶
-
cleanUp
()¶ Hook for adding any type of work that needs to happen after all outputs are exhausted or if some outputs are created and the step is destroyed.
-
closeGenerator
()¶ Closes the output generator for this step, if it exists. This allows the steps input and settings to be changed, and a new generator to be created.
-
getOutputs
()¶ Gets all the outputs in a list by fully iterating the output generator.
-
getStepId
()¶
-
inputs
()¶
-
outputs
(*args, **kwargs)¶
-
setBatchSettings
(*args, **kwargs)¶
-
setInputs
(*args, **kwargs)¶
-
setInputsFromFile
(fname)¶ Read in inputs from
fname
. By default, each line is simply fed intoself.Input
. Override this method if more complex behavior is needed to read in input from files.
-
setSettings
(*args, **kwargs)¶
-
setUp
()¶ Hook for adding any type of work that needs to happen before any outputs are created.
-
stepFunction
(input)¶ The main computation for this step. This function should take in a single input item and return an iterable of outputs. This allows a single output to produce multiple ouputs (e.g. enumeration).
The output may be yielded as a generator, in order to reduce memory usage.
Parameters: input – this will be a single input item from the input source. Implementer is encouraged to use a more descriptive, context- specific variable name. Example:
- def stepFunction(self, starting_smiles):
- …
-
writeOutputsToFile
(fname)¶ Write outputs to
fname
. By default, the output file will consist of one line for each output with whatever is produced when passing the out- put tostr
. Override this method if more complex behavior is needed.
-
schrodinger.tasks.stepper.
grouper
(iterable, n, fillvalue=<object object>)¶ Utiltiy function adapted from the itertools recipes on python.org.
Returns a generator that will generate chunks of size n from the provided iterable.
Parameters: - iterable – the iterable to break into chunks
- n (int) – size of the chunk
- fillvalue (object) – if the last group is not size n, the fillvalue will be used to pad the group. Specifying DONTFILL results in a smaller-than-n final group.
-
class
schrodinger.tasks.stepper.
StepTaskMixin
(*args, step=None, **kwargs)¶ Bases:
object
This class must be mixed in with a subclass of AbstractComboTask. The resulting task class may be used to run any step as a task, provided the input, output, and settings classes are all JSONable.
-
DEFAULT_TASKDIR_SETTING
= <object object>¶
-
__init__
(*args, step=None, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
setStep
(step)¶
-
getStepClass
()¶
-
mainFunction
()¶
-
-
class
schrodinger.tasks.stepper.
StepTaskInput
(default_value=<object object>, _param_type=<object object>, **kwargs)¶ Bases:
schrodinger.models.parameters.CompoundParam
-
jsonified_inputs
¶ A Param to represent lists. Values of this param will have a
mutated
signal that will be emitted whenever any mutation method is called.The constructor optionally takes a
item_class
keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the list if specified.
-
dehydrated_step
¶ See
BaseStep._dehydrateStep
for documentation.
-
DataClass
¶ alias of
builtins.object
-
__init__
(default_value=<object object>, _param_type=<object object>, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
addSubParam
(name, param, update_owner=True)¶
-
blockSignals
(self, bool) → bool¶
-
block_signal_propagation
()¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → List[QObject]¶
-
classmethod
configureParam
()¶ Override this class method to set up the abstract param class (e.g. setParamReference on child params.)
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
classmethod
defaultValue
(*args, **kwargs)¶
-
dehydrated_stepChanged
¶
-
dehydrated_stepReplaced
¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, object: QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → List[QByteArray]¶
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
classmethod
fromJson
(json_obj)¶ A factory method which constructs a new object from a given dict loaded from a json string or file.
Parameters: json_obj (dict) – A json-loaded dictionary to create an object from. Returns: An instance of this class. :rtype : cls
-
classmethod
fromJsonImplementation
(json_dict)¶ Sets the value of this compound param value object from a JSON dict.
-
getAbstractParam
(*args, **kwargs)¶
-
classmethod
getJsonBlacklist
()¶ Override to customize what params are serialized.
Implementations should return a list of abstract params that should be omitted from serialization.
- ..NOTE
- Returned abstract params must be direct child params of
cls
, e.g.cls.name
, notcls.coord.x
.
-
classmethod
getParamSignal
(*args, **kwargs)¶
-
classmethod
getParamValue
(*args, **kwargs)¶
-
classmethod
getSubParam
(name)¶ Get the value of a subparam using the string name:
c = Coord() assert c.getSubParam('x') == 0
Note
Using the string name to accss params is generally discouraged, but can be useful for serializing/deserializing param data.
Parameters: name (str) – The name of the subparam to get the value for.
-
classmethod
getSubParams
()¶ Return a dictionary mapping subparam names to their values.
-
get_version
()¶ Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.
-
inherits
(self, str) → bool¶
-
initAbstract
()¶
-
initConcrete
()¶ Override to customize initialization of concrete params.
-
initializeValue
()¶ Override to dynamically set up the default value of the param. Useful for default values that are determined at runtime. This is called any time the param is reset.
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
jsonified_inputsChanged
¶
-
jsonified_inputsReplaced
¶
-
killTimer
(self, int)¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
classmethod
owner
()¶ Get the owner of the param:
# Can be called on an abstract param: assert Coord.x.owner() == Coord # ...or on an instance of a CompoundParam a = Atom() assert a.coord.owner() == a
-
classmethod
ownerChain
()¶ Returns a list of param owners starting from the toplevel param and ending with self. Examples:
foo.bar.atom.coord.ownerChain()
will return[foo, bar, atom, coord]
where every item is a concrete param.Foo.bar.atom.coord.x.ownerChain()
will return[Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x]
where every item is an abstract params.
-
classmethod
paramName
()¶ Get the name of the param:
# Can be called on an abstract param: print(Coord.x.paramName()) # 'x' # ...or on an instance of a CompoundParam a = Atom() a.coord.paramName() # 'coord'
-
parent
(self) → QObject¶
-
property
(self, str) → Any¶
-
pyqtConfigure
(...)¶ Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.
-
receivers
(self, PYQT_SIGNAL) → int¶
-
removeEventFilter
(self, QObject)¶
-
reset
(*args, **kwargs)¶
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setObjectName
(self, str)¶
-
classmethod
setParamValue
(*args, **kwargs)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
classmethod
setReference
(param1, param2)¶ Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of
param1
. Example:class Square(CompoundParam): width: float = 5 height: float = 10 @classmethod def configureParam(cls): super().configureParam() cls.setReference(cls.width, cls.height) square = Square() assert square.width == square.height == 5 # Default value of width # takes priority square.height = 7 assert square.width == square.height == 7 square.width = 6 assert square.width == square.height == 6
Parameters: - param1 – The first abstract param to keep synced
- param2 – The second abstract param. After instantiation, this param will take on the value of param1.
-
setValue
(*args, **kwargs)¶
-
signalsBlocked
(self) → bool¶
-
skip_eq_check
()¶
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
toDict
(*args, **kwargs)¶
-
toJson
(_mark_version=True)¶ Create and returns a data structure made up of jsonable items.
Return type: An instance of one the classes from NATIVE_JSON_DATATYPES
-
toJsonImplementation
(*args, **kwargs)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
valueChanged
¶
-
-
class
schrodinger.tasks.stepper.
StepTaskOutput
(default_value=<object object>, _param_type=<object object>, **kwargs)¶ Bases:
schrodinger.models.parameters.CompoundParam
-
jsonified_outputs
¶ A Param to represent lists. Values of this param will have a
mutated
signal that will be emitted whenever any mutation method is called.The constructor optionally takes a
item_class
keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the list if specified.
-
DataClass
¶ alias of
builtins.object
-
__init__
(default_value=<object object>, _param_type=<object object>, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
addSubParam
(name, param, update_owner=True)¶
-
blockSignals
(self, bool) → bool¶
-
block_signal_propagation
()¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → List[QObject]¶
-
classmethod
configureParam
()¶ Override this class method to set up the abstract param class (e.g. setParamReference on child params.)
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
classmethod
defaultValue
(*args, **kwargs)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, object: QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → List[QByteArray]¶
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
classmethod
fromJson
(json_obj)¶ A factory method which constructs a new object from a given dict loaded from a json string or file.
Parameters: json_obj (dict) – A json-loaded dictionary to create an object from. Returns: An instance of this class. :rtype : cls
-
classmethod
fromJsonImplementation
(json_dict)¶ Sets the value of this compound param value object from a JSON dict.
-
getAbstractParam
(*args, **kwargs)¶
-
classmethod
getJsonBlacklist
()¶ Override to customize what params are serialized.
Implementations should return a list of abstract params that should be omitted from serialization.
- ..NOTE
- Returned abstract params must be direct child params of
cls
, e.g.cls.name
, notcls.coord.x
.
-
classmethod
getParamSignal
(*args, **kwargs)¶
-
classmethod
getParamValue
(*args, **kwargs)¶
-
classmethod
getSubParam
(name)¶ Get the value of a subparam using the string name:
c = Coord() assert c.getSubParam('x') == 0
Note
Using the string name to accss params is generally discouraged, but can be useful for serializing/deserializing param data.
Parameters: name (str) – The name of the subparam to get the value for.
-
classmethod
getSubParams
()¶ Return a dictionary mapping subparam names to their values.
-
get_version
()¶ Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.
-
inherits
(self, str) → bool¶
-
initAbstract
()¶
-
initConcrete
()¶ Override to customize initialization of concrete params.
-
initializeValue
()¶ Override to dynamically set up the default value of the param. Useful for default values that are determined at runtime. This is called any time the param is reset.
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
jsonified_outputsChanged
¶
-
jsonified_outputsReplaced
¶
-
killTimer
(self, int)¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
classmethod
owner
()¶ Get the owner of the param:
# Can be called on an abstract param: assert Coord.x.owner() == Coord # ...or on an instance of a CompoundParam a = Atom() assert a.coord.owner() == a
-
classmethod
ownerChain
()¶ Returns a list of param owners starting from the toplevel param and ending with self. Examples:
foo.bar.atom.coord.ownerChain()
will return[foo, bar, atom, coord]
where every item is a concrete param.Foo.bar.atom.coord.x.ownerChain()
will return[Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x]
where every item is an abstract params.
-
classmethod
paramName
()¶ Get the name of the param:
# Can be called on an abstract param: print(Coord.x.paramName()) # 'x' # ...or on an instance of a CompoundParam a = Atom() a.coord.paramName() # 'coord'
-
parent
(self) → QObject¶
-
property
(self, str) → Any¶
-
pyqtConfigure
(...)¶ Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.
-
receivers
(self, PYQT_SIGNAL) → int¶
-
removeEventFilter
(self, QObject)¶
-
reset
(*args, **kwargs)¶
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setObjectName
(self, str)¶
-
classmethod
setParamValue
(*args, **kwargs)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
classmethod
setReference
(param1, param2)¶ Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of
param1
. Example:class Square(CompoundParam): width: float = 5 height: float = 10 @classmethod def configureParam(cls): super().configureParam() cls.setReference(cls.width, cls.height) square = Square() assert square.width == square.height == 5 # Default value of width # takes priority square.height = 7 assert square.width == square.height == 7 square.width = 6 assert square.width == square.height == 6
Parameters: - param1 – The first abstract param to keep synced
- param2 – The second abstract param. After instantiation, this param will take on the value of param1.
-
setValue
(*args, **kwargs)¶
-
signalsBlocked
(self) → bool¶
-
skip_eq_check
()¶
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
toDict
(*args, **kwargs)¶
-
toJson
(_mark_version=True)¶ Create and returns a data structure made up of jsonable items.
Return type: An instance of one the classes from NATIVE_JSON_DATATYPES
-
toJsonImplementation
(*args, **kwargs)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
valueChanged
¶
-
-
class
schrodinger.tasks.stepper.
StepSubprocessTask
(*args, step=None, **kwargs)¶ Bases:
schrodinger.tasks.stepper.StepTaskMixin
,schrodinger.tasks.tasks.ComboSubprocessTask
-
input
¶
-
output
¶
-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= <object object>¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
ENTRYPOINT
= 'combotask_entry_point.py'¶
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
__init__
(*args, step=None, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
addFuncToGroup
(func, group=None, order=None)¶ Adds a function to the specified chain. Typically used for adding functions that are not methods of this object.
The function may optionally be decorated with a FuncGroupMarker. If so, the default group and order will be determined by the decorator. Any group or order explicitly passed in to addFuncToGroup will take precedence over the decorator settings.
Parameters: - func – the function to add
- group (FuncGroupMarker or None) – the group marker. If the function is decorated with a FuncGoupMarker, that group marker will be the default.
- order (float or None) – the sorting order. If the function is decorated with a FuncGoupMarker, the order specified in the decorator will be the default.
-
addPostprocessor
(func, order=0)¶ Adds a postproceessor function to this task instance. If the function has been decorated with
@postprocessor
, the order specified by the decorator will be used.Parameters: - func (typing.Callable) – the function to add
- order (float) – the sorting order for the function relative to all other preprocessors. Takes precedence over order specified by the preprocessor decorator.
-
addPreprocessor
(func, order=-2000)¶ Adds a preproceessor function to this task instance. If the function has been decorated with @preprocessor, the order specified by the decorator will be used as the default.
Parameters: - func – the function to add
- order (float) – the sorting order for the function relative to all other preprocessors. Takes precedence over order specified by the preprocessor decorator.
-
classmethod
addSubParam
(name, param, update_owner=True)¶
-
backendMain
()¶
-
blockSignals
(self, bool) → bool¶
-
block_signal_propagation
()¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → List[QObject]¶
-
classmethod
configureParam
()¶ Override this class method to set up the abstract param class (e.g. setParamReference on child params.)
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
classmethod
defaultValue
(*args, **kwargs)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, object: QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → List[QByteArray]¶
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
classmethod
fromJson
(json_obj)¶ A factory method which constructs a new object from a given dict loaded from a json string or file.
Parameters: json_obj (dict) – A json-loaded dictionary to create an object from. Returns: An instance of this class. :rtype : cls
-
classmethod
fromJsonFilename
(filename)¶
-
classmethod
fromJsonImplementation
(json_dict)¶ Sets the value of this compound param value object from a JSON dict.
-
getAbstractParam
(*args, **kwargs)¶
-
getAddedFuncs
(group=None)¶
-
getFuncGroup
(group=None)¶ Retrieve the functions belonging to the specified group.
Parameters: group (FuncGroupMarker) – the group marker Returns: the functions in the specified group, in order Return type: list
-
classmethod
getJsonBlacklist
()¶ Override to customize what params are serialized.
Implementations should return a list of abstract params that should be omitted from serialization.
- ..NOTE
- Returned abstract params must be direct child params of
cls
, e.g.cls.name
, notcls.coord.x
.
-
getLogAsString
()¶
-
classmethod
getParamSignal
(*args, **kwargs)¶
-
classmethod
getParamValue
(*args, **kwargs)¶
-
getStepClass
()¶
-
classmethod
getSubParam
(name)¶ Get the value of a subparam using the string name:
c = Coord() assert c.getSubParam('x') == 0
Note
Using the string name to accss params is generally discouraged, but can be useful for serializing/deserializing param data.
Parameters: name (str) – The name of the subparam to get the value for.
-
classmethod
getSubParams
()¶ Return a dictionary mapping subparam names to their values.
-
getTaskDir
()¶ Returns the full path of the task directory. This is only available if the task directory exists (after creation of the taskdir or, if no task dir is specified, any time).
-
getTaskFilename
(fname)¶ Return the appropriate absolute path for an input or output file in the taskdir.
-
get_version
()¶ Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.
-
guard
()¶ Context manager that saves any Exception raised inside
-
inherits
(self, str) → bool¶
-
initAbstract
()¶
-
initConcrete
()¶ Override to customize initialization of concrete params.
-
initializeValue
()¶ @overrides: parameters.CompoundParam
-
inputChanged
¶
-
inputReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isBackendMode
()¶
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
json_filename
¶
-
json_out_filename
¶
-
kill
()¶ @overrides: AbstractTask
Kill the subprocess and set the status to FAILED.
-
killTimer
(self, int)¶
-
mainFunction
()¶
-
makeCmd
()¶ @overrides: AbstractCmdTask
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
outputChanged
¶
-
outputReplaced
¶
-
classmethod
owner
()¶ Get the owner of the param:
# Can be called on an abstract param: assert Coord.x.owner() == Coord # ...or on an instance of a CompoundParam a = Atom() assert a.coord.owner() == a
-
classmethod
ownerChain
()¶ Returns a list of param owners starting from the toplevel param and ending with self. Examples:
foo.bar.atom.coord.ownerChain()
will return[foo, bar, atom, coord]
where every item is a concrete param.Foo.bar.atom.coord.x.ownerChain()
will return[Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x]
where every item is an abstract params.
-
classmethod
paramName
()¶ Get the name of the param:
# Can be called on an abstract param: print(Coord.x.paramName()) # 'x' # ...or on an instance of a CompoundParam a = Atom() a.coord.paramName() # 'coord'
-
parent
(self) → QObject¶
-
postprocessors
()¶ Returns: A list of postprocessors, both decorated methods on the task and external functions that have been added via addPostprocessor()
Return type: list[typing.Callable]
-
preprocessors
()¶ Returns: A list of preprocessors (both decorated methods on the task and external functions that have been added via addPreprocessor)
-
processFuncChain
(chain=None, result_callback=None)¶ Execute each function in the specified chain sequentially in order.
The result_callback is called after each function with the return value of that function. This can be used to respond to the return value (e.g. present information to the user, get user feedback, log the result, etc.)
The return value of the result_callback determines whether processing will proceeed to the next function.
Parameters: - chain (FuncChainDecorator) – which chain to process
- result_callback – the callback that will get called with the result of each function in the chain
Returns: a list of the results from the functions
-
progress
¶
-
progressChanged
¶
-
progressReplaced
¶
-
property
(self, str) → Any¶
-
pyqtConfigure
(...)¶ Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.
-
receivers
(self, PYQT_SIGNAL) → int¶
-
removeEventFilter
(self, QObject)¶
-
replicate
()¶ Create a new task with the same input and settings (but no output)
-
requestInterruption
()¶ Request the task to stop.
To enable this feature, subclasses should periodically check whether an interruption has been requested and terminate if it has been. If such logic has been included,
INTERRUPT_ENABLED
should be set toTrue
.
-
reset
(*args, **kwargs)¶
-
run
()¶
-
runBackend
()¶
-
runCmd
(cmd)¶
-
classmethod
runFromCmdLine
()¶
-
runPostprocessing
(callback=None)¶
-
runPreprocessing
(*args, **kwargs)¶ Run the preprocessors one-by-one. By default, any failing preprocessor will raise a TaskFailure exception and terminate processing. This behavior may be customized by supplying a callback function which will be called after each preprocessor with the result of that preprocessor.
Parameters: - callback – a function that takes result and returns a bool that indicates whether to continue on to the next preprocessor
- calling_context – specify a value here to indicate the context in which this preprocessing is being called. This value will be stored in an instance variable, self.calling_context, which can be accessed from any preprocessor method on this task. Typically this value will be either self.GUI, self.CMDLINE, or None, but any value may be supplied here and checked for in the preprocessor methods. self.calling_context always reverts back to None at the end of runPreprocessing.
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setObjectName
(self, str)¶
-
classmethod
setParamValue
(*args, **kwargs)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
classmethod
setReference
(param1, param2)¶ Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of
param1
. Example:class Square(CompoundParam): width: float = 5 height: float = 10 @classmethod def configureParam(cls): super().configureParam() cls.setReference(cls.width, cls.height) square = Square() assert square.width == square.height == 5 # Default value of width # takes priority square.height = 7 assert square.width == square.height == 7 square.width = 6 assert square.width == square.height == 6
Parameters: - param1 – The first abstract param to keep synced
- param2 – The second abstract param. After instantiation, this param will take on the value of param1.
-
setStep
(step)¶
-
setValue
(*args, **kwargs)¶
-
signalsBlocked
(self) → bool¶
-
skip_eq_check
()¶
-
specifyTaskDir
(taskdir_spec)¶ Specify the taskdir creation behavior. Use one of the following options:
A directory name (string). This may be a relative or absolute path
None - no taskdir is requested. The task will use the CWD as its taskdir
AUTO_TASKDIR - a new subdirectory will be created in the CWD using the task name as the directory name.
TEMP_TASKDIR - a temporary directory will be created in the schrodinger temp dir. This directory is cleaned up when the task is deleted.
Parameters: taskdir_spec – one of the four options listed above
-
start
(*args, **kwargs)¶
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
status
¶
-
statusChanged
¶
-
statusReplaced
¶
-
taskDirSetting
()¶ Returns the taskdir spec. See specifyTaskDir() for details.
-
taskDone
¶
-
taskFailed
¶
-
taskStarted
¶
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
toDict
(*args, **kwargs)¶
-
toJson
(_mark_version=True)¶ Create and returns a data structure made up of jsonable items.
Return type: An instance of one the classes from NATIVE_JSON_DATATYPES
-
toJsonImplementation
(*args, **kwargs)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
valueChanged
¶
-
wait
(timeout=None)¶ Block until the task is finished executing or
timeout
seconds have passed.Parameters: timeout (NoneType or int) – Amount of time in seconds to wait before timing out. If None or a negative number, this method will wait until the task is finished.
-
writeJsonFile
(filename)¶
-
-
class
schrodinger.tasks.stepper.
StepJobTask
(*args, step=None, **kwargs)¶ Bases:
schrodinger.tasks.stepper.StepTaskMixin
,schrodinger.tasks.jobtasks.ComboJobTask
-
input
¶
-
output
¶
-
mainFunction
()¶
-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= <object object>¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
ENTRYPOINT
= 'combotask_entry_point.py'¶
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
PROGRAM_NAME
¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
__init__
(*args, step=None, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
addFuncToGroup
(func, group=None, order=None)¶ Adds a function to the specified chain. Typically used for adding functions that are not methods of this object.
The function may optionally be decorated with a FuncGroupMarker. If so, the default group and order will be determined by the decorator. Any group or order explicitly passed in to addFuncToGroup will take precedence over the decorator settings.
Parameters: - func – the function to add
- group (FuncGroupMarker or None) – the group marker. If the function is decorated with a FuncGoupMarker, that group marker will be the default.
- order (float or None) – the sorting order. If the function is decorated with a FuncGoupMarker, the order specified in the decorator will be the default.
-
addInputDirectory
(directory)¶ Add an input directory to be copied over with the job.
-
addPostprocessor
(func, order=0)¶ Adds a postproceessor function to this task instance. If the function has been decorated with
@postprocessor
, the order specified by the decorator will be used.Parameters: - func (typing.Callable) – the function to add
- order (float) – the sorting order for the function relative to all other preprocessors. Takes precedence over order specified by the preprocessor decorator.
-
addPreprocessor
(func, order=-2000)¶ Adds a preproceessor function to this task instance. If the function has been decorated with @preprocessor, the order specified by the decorator will be used as the default.
Parameters: - func – the function to add
- order (float) – the sorting order for the function relative to all other preprocessors. Takes precedence over order specified by the preprocessor decorator.
-
classmethod
addSubParam
(name, param, update_owner=True)¶
-
backendMain
()¶
-
blockSignals
(self, bool) → bool¶
-
block_signal_propagation
()¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → List[QObject]¶
-
config
¶
-
configChanged
¶
-
configReplaced
¶
-
classmethod
configureParam
()¶ @overrides: parameters.CompoundParam
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
classmethod
defaultValue
(*args, **kwargs)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, object: QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → List[QByteArray]¶
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
classmethod
fromJson
(json_obj)¶ A factory method which constructs a new object from a given dict loaded from a json string or file.
Parameters: json_obj (dict) – A json-loaded dictionary to create an object from. Returns: An instance of this class. :rtype : cls
-
classmethod
fromJsonFilename
(filename)¶
-
classmethod
fromJsonImplementation
(json_dict)¶ Sets the value of this compound param value object from a JSON dict.
-
getAbstractParam
(*args, **kwargs)¶
-
getAddedFuncs
(group=None)¶
-
getFuncGroup
(group=None)¶ Retrieve the functions belonging to the specified group.
Parameters: group (FuncGroupMarker) – the group marker Returns: the functions in the specified group, in order Return type: list
-
classmethod
getJsonBlacklist
()¶ Override to customize what params are serialized.
Implementations should return a list of abstract params that should be omitted from serialization.
- ..NOTE
- Returned abstract params must be direct child params of
cls
, e.g.cls.name
, notcls.coord.x
.
-
getLogAsString
()¶
-
classmethod
getParamSignal
(*args, **kwargs)¶
-
classmethod
getParamValue
(*args, **kwargs)¶
-
getStepClass
()¶
-
classmethod
getSubParam
(name)¶ Get the value of a subparam using the string name:
c = Coord() assert c.getSubParam('x') == 0
Note
Using the string name to accss params is generally discouraged, but can be useful for serializing/deserializing param data.
Parameters: name (str) – The name of the subparam to get the value for.
-
classmethod
getSubParams
()¶ Return a dictionary mapping subparam names to their values.
-
getTaskDir
()¶ Returns the full path of the task directory. This is only available if the task directory exists (after creation of the taskdir or, if no task dir is specified, any time).
-
getTaskFilename
(fname)¶ Return the appropriate absolute path for an input or output file in the taskdir.
-
get_version
()¶ Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.
-
guard
()¶ Context manager that saves any Exception raised inside
-
inherits
(self, str) → bool¶
-
initAbstract
()¶
-
initConcrete
()¶
-
initializeValue
()¶ @overrides: paramters.CompoundParam
-
inputChanged
¶
-
inputReplaced
¶
-
input_files
¶ A Param to represent lists. Values of this param will have a
mutated
signal that will be emitted whenever any mutation method is called.The constructor optionally takes a
item_class
keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the list if specified.
-
input_filesChanged
¶
-
input_filesReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isBackendMode
()¶
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
json_filename
¶
-
json_out_filename
¶
-
kill
()¶ @overrides: tasks.AbstractTask
-
killTimer
(self, int)¶
-
makeCmd
()¶ @overrides: tasks.AbstractCmdTask
Child classes must not override this method.
-
makeJobSpecFromCmd
(cmd)¶
-
makeLaunchParams
()¶
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
outputChanged
¶
-
outputReplaced
¶
-
output_files
¶ A Param to represent lists. Values of this param will have a
mutated
signal that will be emitted whenever any mutation method is called.The constructor optionally takes a
item_class
keyword argument to specify what type of class the items in the list will be. This information will be used for jsonifying the list if specified.
-
output_filesChanged
¶
-
output_filesReplaced
¶
-
classmethod
owner
()¶ Get the owner of the param:
# Can be called on an abstract param: assert Coord.x.owner() == Coord # ...or on an instance of a CompoundParam a = Atom() assert a.coord.owner() == a
-
classmethod
ownerChain
()¶ Returns a list of param owners starting from the toplevel param and ending with self. Examples:
foo.bar.atom.coord.ownerChain()
will return[foo, bar, atom, coord]
where every item is a concrete param.Foo.bar.atom.coord.x.ownerChain()
will return[Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x]
where every item is an abstract params.
-
classmethod
paramName
()¶ Get the name of the param:
# Can be called on an abstract param: print(Coord.x.paramName()) # 'x' # ...or on an instance of a CompoundParam a = Atom() a.coord.paramName() # 'coord'
-
parent
(self) → QObject¶
-
postprocessors
()¶ Returns: A list of postprocessors, both decorated methods on the task and external functions that have been added via addPostprocessor()
Return type: list[typing.Callable]
-
preprocessors
()¶ Returns: A list of preprocessors (both decorated methods on the task and external functions that have been added via addPreprocessor)
-
processFuncChain
(chain=None, result_callback=None)¶ Execute each function in the specified chain sequentially in order.
The result_callback is called after each function with the return value of that function. This can be used to respond to the return value (e.g. present information to the user, get user feedback, log the result, etc.)
The return value of the result_callback determines whether processing will proceeed to the next function.
Parameters: - chain (FuncChainDecorator) – which chain to process
- result_callback – the callback that will get called with the result of each function in the chain
Returns: a list of the results from the functions
-
progress
¶
-
progressChanged
¶
-
progressReplaced
¶
-
property
(self, str) → Any¶
-
pyqtConfigure
(...)¶ Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.
-
receivers
(self, PYQT_SIGNAL) → int¶
-
removeEventFilter
(self, QObject)¶
-
replicate
()¶ @overrides: tasks.AbstractTask
-
requestInterruption
()¶ Request the task to stop.
To enable this feature, subclasses should periodically check whether an interruption has been requested and terminate if it has been. If such logic has been included,
INTERRUPT_ENABLED
should be set toTrue
.
-
reset
(*args, **kwargs)¶
-
run
()¶
-
runBackend
()¶ @overrides: AbstractComboTask
-
runCmd
(cmd)¶ @overrides: tasks.AbstractCmdTask
-
classmethod
runFromCmdLine
()¶ @overrides: tasks.AbstractTask
-
runPostprocessing
(callback=None)¶
-
runPreprocessing
(*args, **kwargs)¶ Run the preprocessors one-by-one. By default, any failing preprocessor will raise a TaskFailure exception and terminate processing. This behavior may be customized by supplying a callback function which will be called after each preprocessor with the result of that preprocessor.
Parameters: - callback – a function that takes result and returns a bool that indicates whether to continue on to the next preprocessor
- calling_context – specify a value here to indicate the context in which this preprocessing is being called. This value will be stored in an instance variable, self.calling_context, which can be accessed from any preprocessor method on this task. Typically this value will be either self.GUI, self.CMDLINE, or None, but any value may be supplied here and checked for in the preprocessor methods. self.calling_context always reverts back to None at the end of runPreprocessing.
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setObjectName
(self, str)¶
-
classmethod
setParamValue
(*args, **kwargs)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
classmethod
setReference
(param1, param2)¶ Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of
param1
. Example:class Square(CompoundParam): width: float = 5 height: float = 10 @classmethod def configureParam(cls): super().configureParam() cls.setReference(cls.width, cls.height) square = Square() assert square.width == square.height == 5 # Default value of width # takes priority square.height = 7 assert square.width == square.height == 7 square.width = 6 assert square.width == square.height == 6
Parameters: - param1 – The first abstract param to keep synced
- param2 – The second abstract param. After instantiation, this param will take on the value of param1.
-
setStep
(step)¶
-
setValue
(*args, **kwargs)¶
-
signalsBlocked
(self) → bool¶
-
skip_eq_check
()¶
-
specifyTaskDir
(taskdir_spec)¶ Specify the taskdir creation behavior. Use one of the following options:
A directory name (string). This may be a relative or absolute path
None - no taskdir is requested. The task will use the CWD as its taskdir
AUTO_TASKDIR - a new subdirectory will be created in the CWD using the task name as the directory name.
TEMP_TASKDIR - a temporary directory will be created in the schrodinger temp dir. This directory is cleaned up when the task is deleted.
Parameters: taskdir_spec – one of the four options listed above
-
start
(*args, **kwargs)¶ @overrides: AbstractTask
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
status
¶
-
statusChanged
¶
-
statusReplaced
¶
-
taskDirSetting
()¶ Returns the taskdir spec. See specifyTaskDir() for details.
-
taskDone
¶
-
taskFailed
¶
-
taskStarted
¶
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
toDict
(*args, **kwargs)¶
-
toJson
(_mark_version=True)¶ Create and returns a data structure made up of jsonable items.
Return type: An instance of one the classes from NATIVE_JSON_DATATYPES
-
toJsonImplementation
(*args, **kwargs)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
valueChanged
¶
-
wait
(timeout=None)¶ Block until the task is finished executing or
timeout
seconds have passed.Parameters: timeout (NoneType or int) – Amount of time in seconds to wait before timing out. If None or a negative number, this method will wait until the task is finished.
-
wrapCmdInLaunchApi
(cmd)¶
-
write
()¶ @overrides: _LaunchAPIMixin
-
writeJsonFile
(filename)¶
-
writeStuZipFile
()¶
-
-
class
schrodinger.tasks.stepper.
BatchSettings
(default_value=<object object>, _param_type=<object object>, **kwargs)¶ Bases:
schrodinger.models.parameters.CompoundParam
-
size
¶ Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:
class Coord(CompoundParam): x: int y: int
An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:
coord = Coord() coord.x = 4
When a Param value is set, the
valueChanged
signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:class Atom(CompoundParam): coord: Coord element: str
-
max_running_tasks
¶ Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:
class Coord(CompoundParam): x: int y: int
An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:
coord = Coord() coord.x = 4
When a Param value is set, the
valueChanged
signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:class Atom(CompoundParam): coord: Coord element: str
-
task_class
¶ Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:
class Coord(CompoundParam): x: int y: int
An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:
coord = Coord() coord.x = 4
When a Param value is set, the
valueChanged
signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:class Atom(CompoundParam): coord: Coord element: str
-
hostname
¶ Base class for all Param classes. A Param is a descriptor for storing data, which means that a single Param instance will manage the data values for multiple instances of the class that owns it. Example:
class Coord(CompoundParam): x: int y: int
An instance of the Coord class can be created normally, and Params can be accessed as normal attributes:
coord = Coord() coord.x = 4
When a Param value is set, the
valueChanged
signal is emitted. Params can be serialized and deserialized to and from JSON. Params can also be nested:class Atom(CompoundParam): coord: Coord element: str
-
DataClass
¶ alias of
builtins.object
-
__init__
(default_value=<object object>, _param_type=<object object>, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
addSubParam
(name, param, update_owner=True)¶
-
blockSignals
(self, bool) → bool¶
-
block_signal_propagation
()¶
-
childEvent
(self, QChildEvent)¶
-
children
(self) → List[QObject]¶
-
classmethod
configureParam
()¶ Override this class method to set up the abstract param class (e.g. setParamReference on child params.)
-
connectNotify
(self, QMetaMethod)¶
-
customEvent
(self, QEvent)¶
-
classmethod
defaultValue
(*args, **kwargs)¶
-
deleteLater
(self)¶
-
destroyed
¶ destroyed(self, object: QObject = None) [signal]
-
disconnect
(self)¶
-
disconnectNotify
(self, QMetaMethod)¶
-
dumpObjectInfo
(self)¶
-
dumpObjectTree
(self)¶
-
dynamicPropertyNames
(self) → List[QByteArray]¶
-
event
(self, QEvent) → bool¶
-
eventFilter
(self, QObject, QEvent) → bool¶
-
findChild
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject¶ findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
-
findChildren
(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]¶ findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
-
classmethod
fromJson
(json_obj)¶ A factory method which constructs a new object from a given dict loaded from a json string or file.
Parameters: json_obj (dict) – A json-loaded dictionary to create an object from. Returns: An instance of this class. :rtype : cls
-
classmethod
fromJsonImplementation
(json_dict)¶ Sets the value of this compound param value object from a JSON dict.
-
getAbstractParam
(*args, **kwargs)¶
-
classmethod
getJsonBlacklist
()¶ Override to customize what params are serialized.
Implementations should return a list of abstract params that should be omitted from serialization.
- ..NOTE
- Returned abstract params must be direct child params of
cls
, e.g.cls.name
, notcls.coord.x
.
-
classmethod
getParamSignal
(*args, **kwargs)¶
-
classmethod
getParamValue
(*args, **kwargs)¶
-
classmethod
getSubParam
(name)¶ Get the value of a subparam using the string name:
c = Coord() assert c.getSubParam('x') == 0
Note
Using the string name to accss params is generally discouraged, but can be useful for serializing/deserializing param data.
Parameters: name (str) – The name of the subparam to get the value for.
-
classmethod
getSubParams
()¶ Return a dictionary mapping subparam names to their values.
-
get_version
()¶ Method to get the version of a particular object. Defaults to the current version of mmshare. This class can be overridden for custom versioning behavior.
-
hostnameChanged
¶
-
hostnameReplaced
¶
-
inherits
(self, str) → bool¶
-
initAbstract
()¶
-
initConcrete
()¶ Override to customize initialization of concrete params.
-
initializeValue
()¶ Override to dynamically set up the default value of the param. Useful for default values that are determined at runtime. This is called any time the param is reset.
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
killTimer
(self, int)¶
-
max_running_tasksChanged
¶
-
max_running_tasksReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
classmethod
owner
()¶ Get the owner of the param:
# Can be called on an abstract param: assert Coord.x.owner() == Coord # ...or on an instance of a CompoundParam a = Atom() assert a.coord.owner() == a
-
classmethod
ownerChain
()¶ Returns a list of param owners starting from the toplevel param and ending with self. Examples:
foo.bar.atom.coord.ownerChain()
will return[foo, bar, atom, coord]
where every item is a concrete param.Foo.bar.atom.coord.x.ownerChain()
will return[Foo, Foo.bar, Foo.atom.coord, Foo.atom.coord.x]
where every item is an abstract params.
-
classmethod
paramName
()¶ Get the name of the param:
# Can be called on an abstract param: print(Coord.x.paramName()) # 'x' # ...or on an instance of a CompoundParam a = Atom() a.coord.paramName() # 'coord'
-
parent
(self) → QObject¶
-
property
(self, str) → Any¶
-
pyqtConfigure
(...)¶ Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.
-
receivers
(self, PYQT_SIGNAL) → int¶
-
removeEventFilter
(self, QObject)¶
-
reset
(*args, **kwargs)¶
-
sender
(self) → QObject¶
-
senderSignalIndex
(self) → int¶
-
setObjectName
(self, str)¶
-
classmethod
setParamValue
(*args, **kwargs)¶
-
setParent
(self, QObject)¶
-
setProperty
(self, str, Any) → bool¶
-
classmethod
setReference
(param1, param2)¶ Call this class method from configureParam to indicate that two params should be kept in sync. The initial values will start with the default value of
param1
. Example:class Square(CompoundParam): width: float = 5 height: float = 10 @classmethod def configureParam(cls): super().configureParam() cls.setReference(cls.width, cls.height) square = Square() assert square.width == square.height == 5 # Default value of width # takes priority square.height = 7 assert square.width == square.height == 7 square.width = 6 assert square.width == square.height == 6
Parameters: - param1 – The first abstract param to keep synced
- param2 – The second abstract param. After instantiation, this param will take on the value of param1.
-
setValue
(*args, **kwargs)¶
-
signalsBlocked
(self) → bool¶
-
sizeChanged
¶
-
sizeReplaced
¶
-
skip_eq_check
()¶
-
startTimer
(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int¶
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
task_classChanged
¶
-
task_classReplaced
¶
-
thread
(self) → QThread¶
-
timerEvent
(self, QTimerEvent)¶
-
toDict
(*args, **kwargs)¶
-
toJson
(_mark_version=True)¶ Create and returns a data structure made up of jsonable items.
Return type: An instance of one the classes from NATIVE_JSON_DATATYPES
-
toJsonImplementation
(*args, **kwargs)¶
-
tr
(self, str, disambiguation: str = None, n: int = -1) → str¶
-
valueChanged
¶
-