schrodinger.tasks.tasks module¶
A task represents a block of work that has a defined input and output and runs without user intervention. Different task classes share a common external API but have different implementations for defining and executing the work, such as blocking calls, threads, subprocesses, or job control (see jobtasks).
To define a task, follow these basic instructions:
1. Choose a task class to subclass. The choice of task class is primarily dictated by how the task needs to run - thread, subprocess, job, etc. See the Task Class Selection Guide for help.
2. Override the input and output params. The task.input and task.output params may be of any Param type, including CompoundParam (typical). For CompoundParams, either use an existing class to override task.input, OR define a nested class named Input within the task. Doing so will automatically override task.input. The same goes for task.output. Example:
class FooTask(tasks.ThreadFunctionTask):
input = AtomPair() # AtomPair is an existing CompoundParam subclass
# This will magically override FooTask.output = Output()
class Output(parameters.CompoundParam):
charge: float
processed_atom_pair: AtomPair
3. Define the work of the task. This is done differently for different task classes, but generally involves overriding a method to either provide python logic directly as the work to be done or to construct a command line with the appropriate arguments that will be invoked via the appropriate mechanism for the task type.
Once a task is defined, it can be instantiated, set up, and started:
task = FooThreadTask()
task.input.x = 3
task.input.y = 4
task.start()
assert task.status is tasks.Status.RUNNING
task.wait()
assert task.status is tasks.Status.DONE
print(task.output)
Pre/postprocessors
Tasks support pre/post processing functions. These can either be methods in the class that are decorated with the preprocessor or postprocessor decorators, or external functions that are added to a task instance. Example:
class MyTask(tasks.BlockingFunctionTask):
@tasks.preprocessor
def checkInput(self):
if self.input.x <0:
return False, 'x must be a nonnegative number.'
For more information, see the module-level preprocessor and postprocessor decorators as well as the start(), preprocessors(), and addPreprocessor() methods of AbstractTask.
Task directory (taskdir)
Tasks have a concept of a taskdir. While the task framework will never actually chdir into a different directory, the task provides functions for specifying and accessing a directory that is considered that task’s directory by convention. Subprocesses started by the task will use the taskdir as their working directory.
To specify a taskdir, override AbstractTask.DEFAULT_TASK_SPEC or use task.specifyTaskDir(). Example:
class MyTask(tasks.BlockingFunctionTask):
DEFAULT_TASK_SPEC = tasks.AUTO_TASKDIR
task = MyTask()
task.specifyTaskDir('foo_dir')
The taskdir is created during preprocessing. Once the taskdir is created, use task.getTaskDir() and task.getTaskFilename() when reading and writing files for the task. Example:
class MyTask(tasks.SubprocessCmdTask):
@tasks.preprocessor(order=tasks.AFTER_TASKDIR)
def writeInputFiles(self):
with open(self.getTaskFilename('foo_data.txt'), 'w') as f:
f.write(self.input.foo_data)
For more details on taskdir, see task.specifyTaskDir() task.getTaskDir().
Input/Output File Handling¶
To specify a task input file or folder, use the TaskFile
or TaskFolder
classes as a subparam on the task.input param. If the task runs its unit
of work on a different machine or process, the input files/folders will
automatically be copied to the right location on the compute host. The
path to the TaskFile
/TaskFolder
will also be updated so it points
to the right location, regardless of when or where it’s accessed.
TaskFile
/TaskFolder`s may be nested under the input param in supported
container types. Supported container types are:
There are few restrictions on how nested you can define your
`TaskFile/TaskFolder
on the input param. For example, if you have
a variable number of input files, you can define the input with a list:
- List
- Dict
- Set
- Tuple
- CompoundParam
For example:
class Input(parameters.CompoundParam):
receptor_filename: TaskFile
ligand_filenames: List[TaskFile]
Task output files/folders behave in the exact same way as task input
files/folders except they’re defined as TaskFile
/`TaskFolder`s on the
output param.
-
class
schrodinger.tasks.tasks.
TaskFile
¶ Bases:
str
See the “Input/Output File Handling” section of the module docstring for information.
-
__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 ‘}’).
-
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.
-
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.
-
-
class
schrodinger.tasks.tasks.
TaskFolder
¶ Bases:
str
See the “Input/Output File Handling” section of the module docstring for information.
-
__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 ‘}’).
-
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.
-
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.
-
-
class
schrodinger.tasks.tasks.
ProcessingResult
(passed, message=None)¶ Bases:
object
A general-purpose return value for task pre/post processors
-
__init__
(passed, message=None)¶ Parameters: - passed (bool) – Whether the result is considered to be passing
- message (str) – A message for this result
-
processorName
()¶
-
-
class
schrodinger.tasks.tasks.
CallingContext
¶ Bases:
enum.IntEnum
An enumeration.
-
CMDLINE
= 1¶
-
GUI
= 2¶
-
-
exception
schrodinger.tasks.tasks.
TaskFailure
¶ Bases:
Exception
Exception raised when a task fails for reasons other than an unexpected error occuring during execution.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.tasks.tasks.
TaskKilled
¶ Bases:
schrodinger.tasks.tasks.TaskFailure
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
schrodinger.tasks.tasks.
FailureInfo
¶ Bases:
schrodinger.tasks.tasks.FailureInfo
-
__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¶
-
exception
¶ Alias for field number 0
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
message
¶ Alias for field number 2
-
traceback
¶ Alias for field number 1
-
-
class
schrodinger.tasks.tasks.
Status
(*args, **kwargs)¶ Bases:
schrodinger.models.jsonable.JsonableIntEnum
An enumeration.
-
WAITING
= 0¶
-
RUNNING
= 1¶
-
FAILED
= 2¶
-
DONE
= 3¶
-
-
class
schrodinger.tasks.tasks.
AbstractTask
(*args, **kwargs)¶ Bases:
schrodinger.utils.funcchains.FuncChainMixin
,schrodinger.models.parameters.CompoundParam
-
input
¶
-
output
¶
-
status
¶
-
name
¶
-
progress
¶
-
max_progress
¶
-
taskDone
¶
-
taskStarted
¶
-
taskFailed
¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
AUTO_TASKDIR
= <object object>¶
-
TEMP_TASKDIR
= <object object>¶
-
classmethod
runFromCmdLine
()¶
-
classmethod
fromJsonFilename
(filename)¶
-
initConcrete
()¶ Override to customize initialization of concrete params.
-
initializeValue
()¶ @overrides: parameters.CompoundParam
-
INTERRUPT_ENABLED
= False¶
-
run
()¶
-
kill
()¶ Implementations are responsible for immediately stopping the task. No threads or processes should be running after this method is complete.
This method should be called sparingly since in many contexts the task will be forced to terminate without a chance to clean up or free resources.
-
start
(skip_preprocessing=False)¶ This is the main method for starting a task. Start will check if a task is not already running, run preprocessing, and then run the task.
Failures in preprocessing will interrupt the task start, and the task will never enter the RUNNING state.
Parameters: skip_preprocessing (bool) – whether to skip preprocessing. This can be useful if preprocessing was already performed prior to calling start.
-
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.
-
isRunning
()¶
-
isStartable
()¶
-
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
-
taskDirSetting
()¶ Returns the taskdir spec. See specifyTaskDir() for details.
-
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.
-
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.
-
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.
-
preprocessors
()¶ Returns: A list of preprocessors (both decorated methods on the task and external functions that have been added via addPreprocessor)
-
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]
-
reset
(*args, **kwargs)¶
-
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
.
-
isInterruptionRequested
()¶
-
runPreprocessing
(callback=None, calling_context=None)¶ 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.
-
runPostprocessing
(callback=None)¶
-
guard
()¶ Context manager that saves any Exception raised inside
-
CMDLINE
= 1¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
FAILED
= 2¶
-
GUI
= 2¶
-
RUNNING
= 1¶
-
WAITING
= 0¶
-
__init__
(*args, **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.
-
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)¶
-
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
.
-
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.
-
getTypeHint
()¶
-
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
()¶
-
inputChanged
¶
-
inputReplaced
¶
-
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_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
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¶
-
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
-
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)¶
-
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>¶
-
statusChanged
¶
-
statusReplaced
¶
-
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.tasks.
AbstractCmdTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.AbstractTask
-
run
()¶
-
runCmd
(cmd)¶
-
makeCmd
()¶
-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
__init__
(*args, **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)¶
-
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
.
-
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.
-
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.
-
getTypeHint
()¶
-
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
-
input
¶
-
inputChanged
¶
-
inputReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
kill
()¶ Implementations are responsible for immediately stopping the task. No threads or processes should be running after this method is complete.
This method should be called sparingly since in many contexts the task will be forced to terminate without a chance to clean up or free resources.
-
killTimer
(self, int)¶
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
output
¶
-
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)¶
-
classmethod
runFromCmdLine
()¶
-
runPostprocessing
(callback=None)¶
-
runPreprocessing
(callback=None, calling_context=None)¶ 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.
-
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
(skip_preprocessing=False)¶ This is the main method for starting a task. Start will check if a task is not already running, run preprocessing, and then run the task.
Failures in preprocessing will interrupt the task start, and the task will never enter the RUNNING state.
Parameters: skip_preprocessing (bool) – whether to skip preprocessing. This can be useful if preprocessing was already performed prior to calling start.
-
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.
-
-
class
schrodinger.tasks.tasks.
AbstractComboTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.AbstractCmdTask
,schrodinger.tasks.tasks._AbstractFunctionTask
-
ENTRYPOINT
= 'combotask_entry_point.py'¶
-
json_filename
¶
-
json_out_filename
¶
-
start
(*args, **kwargs)¶ @overrides: AbstractTask
-
isBackendMode
()¶
-
makeCmd
()¶ @overrides: AbstractCmdTask
-
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.
-
backendMain
()¶
-
writeJsonFile
(filename)¶
-
runBackend
()¶
-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
__init__
(*args, **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)¶
-
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
.
-
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.
-
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.
-
getTypeHint
()¶
-
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
-
input
¶
-
inputChanged
¶
-
inputReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
kill
()¶ Implementations are responsible for immediately stopping the task. No threads or processes should be running after this method is complete.
This method should be called sparingly since in many contexts the task will be forced to terminate without a chance to clean up or free resources.
-
killTimer
(self, int)¶
-
mainFunction
()¶
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
output
¶
-
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
()¶
-
runCmd
(cmd)¶
-
classmethod
runFromCmdLine
()¶
-
runPostprocessing
(callback=None)¶
-
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
()¶
-
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
-
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.
-
-
schrodinger.tasks.tasks.
get_schrodinger_run
()¶
-
class
schrodinger.tasks.tasks.
BlockingMixin
¶ Bases:
object
Compatible with subclasses of AbstractFunctionTask.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.tasks.tasks.
ThreadMixin
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks._SaveTaskReferenceMixin
-
MAX_THREAD_TASKS
= 500¶
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
kill
()¶ @overrides: AbstractTask
Killing threads is dangerous and can leading to deadlocking on Windows, so we intentionally leave it unimplemented rather than using QThread.terminate.
-
start
(*args, **kwargs)¶
-
-
exception
schrodinger.tasks.tasks.
QProcessError
(message)¶ Bases:
Exception
-
__init__
(message)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.tasks.tasks.
QProcessFailedToStartError
(message)¶ Bases:
schrodinger.tasks.tasks.QProcessError
-
__init__
(message)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.tasks.tasks.
QProcessCrashedError
(message)¶ Bases:
schrodinger.tasks.tasks.QProcessError
-
__init__
(message)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.tasks.tasks.
QProcessTimedout
(message)¶ Bases:
schrodinger.tasks.tasks.QProcessError
-
__init__
(message)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.tasks.tasks.
QProcessWriteError
(message)¶ Bases:
schrodinger.tasks.tasks.QProcessError
-
__init__
(message)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.tasks.tasks.
QProcessReadError
(message)¶ Bases:
schrodinger.tasks.tasks.QProcessError
-
__init__
(message)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
schrodinger.tasks.tasks.
QProcessUnknownError
(message)¶ Bases:
schrodinger.tasks.tasks.QProcessError
-
__init__
(message)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
schrodinger.tasks.tasks.
SubprocessMixin
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks._SaveTaskReferenceMixin
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
printingOutputToTerminal
()¶ Returns: whether the StdOut
andStdErr
output from this task is being printed to the terminalReturn type: bool
-
setPrintingOutputToTerminal
(print_to_terminal)¶ Set this task to print
StdOut
andStdErr
output to terminal, or not.Parameters: print_to_terminal (bool) – whether to send process output to terminal
-
runCmd
(cmd)¶
-
getLogAsString
()¶
-
kill
()¶ @overrides: AbstractTask
Kill the subprocess and set the status to FAILED.
-
start
(*args, **kwargs)¶
-
-
class
schrodinger.tasks.tasks.
BlockingFunctionTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.BlockingMixin
,schrodinger.tasks.tasks._AbstractFunctionTask
A task that simply runs a function and blocks for the duration of it. To use, implement
mainFunction
.-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
__init__
(*args, **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)¶
-
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
.
-
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.
-
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.
-
getTypeHint
()¶
-
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
-
input
¶
-
inputChanged
¶
-
inputReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
kill
()¶ Implementations are responsible for immediately stopping the task. No threads or processes should be running after this method is complete.
This method should be called sparingly since in many contexts the task will be forced to terminate without a chance to clean up or free resources.
-
killTimer
(self, int)¶
-
mainFunction
()¶
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
output
¶
-
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
()¶
-
classmethod
runFromCmdLine
()¶
-
runPostprocessing
(callback=None)¶
-
runPreprocessing
(callback=None, calling_context=None)¶ 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.
-
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
(skip_preprocessing=False)¶ This is the main method for starting a task. Start will check if a task is not already running, run preprocessing, and then run the task.
Failures in preprocessing will interrupt the task start, and the task will never enter the RUNNING state.
Parameters: skip_preprocessing (bool) – whether to skip preprocessing. This can be useful if preprocessing was already performed prior to calling start.
-
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.
-
-
class
schrodinger.tasks.tasks.
ThreadFunctionTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.ThreadMixin
,schrodinger.tasks.tasks._AbstractFunctionTask
A task that runs a function in a separate thread. To use, implement
mainFunction
.-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
MAX_THREAD_TASKS
= 500¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
__init__
(*args, **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)¶
-
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
.
-
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.
-
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.
-
getTypeHint
()¶
-
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
-
input
¶
-
inputChanged
¶
-
inputReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
kill
()¶ @overrides: AbstractTask
Killing threads is dangerous and can leading to deadlocking on Windows, so we intentionally leave it unimplemented rather than using QThread.terminate.
-
killTimer
(self, int)¶
-
mainFunction
()¶
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
output
¶
-
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
()¶
-
classmethod
runFromCmdLine
()¶
-
runPostprocessing
(callback=None)¶
-
runPreprocessing
(callback=None, calling_context=None)¶ 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.
-
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.
-
-
class
schrodinger.tasks.tasks.
SubprocessCmdTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.SubprocessMixin
,schrodinger.tasks.tasks.AbstractCmdTask
A task that launches a subprocess. To use, implement
makeCmd
and return a list of strings.-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
__init__
(*args, **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)¶
-
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)¶
-
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.
-
getTypeHint
()¶
-
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
-
input
¶
-
inputChanged
¶
-
inputReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
kill
()¶ @overrides: AbstractTask
Kill the subprocess and set the status to FAILED.
-
killTimer
(self, int)¶
-
makeCmd
()¶
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
output
¶
-
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)
-
printingOutputToTerminal
()¶ Returns: whether the StdOut
andStdErr
output from this task is being printed to the terminalReturn type: bool
-
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
()¶
-
runCmd
(cmd)¶
-
classmethod
runFromCmdLine
()¶
-
runPostprocessing
(callback=None)¶
-
runPreprocessing
(callback=None, calling_context=None)¶ 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)¶
-
setPrintingOutputToTerminal
(print_to_terminal)¶ Set this task to print
StdOut
andStdErr
output to terminal, or not.Parameters: print_to_terminal (bool) – whether to send process output to terminal
-
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
()¶
-
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.
-
-
class
schrodinger.tasks.tasks.
ComboBlockingFunctionTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.AbstractComboTask
This is mostly for testing purposes.
-
runCmd
(cmd)¶
-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
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, **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
.
-
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.
-
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.
-
getTypeHint
()¶
-
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
-
input
¶
-
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
()¶ Implementations are responsible for immediately stopping the task. No threads or processes should be running after this method is complete.
This method should be called sparingly since in many contexts the task will be forced to terminate without a chance to clean up or free resources.
-
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]
-
output
¶
-
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
()¶
-
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.
-
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.
-
writeJsonFile
(filename)¶
-
-
class
schrodinger.tasks.tasks.
ComboSubprocessTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.SubprocessMixin
,schrodinger.tasks.tasks.AbstractComboTask
-
runBackend
()¶
-
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).
-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
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, **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)¶
-
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.
-
getTaskFilename
(fname)¶ Return the appropriate absolute path for an input or output file in the taskdir.
-
getTypeHint
()¶
-
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
-
input
¶
-
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]
-
output
¶
-
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)
-
printingOutputToTerminal
()¶ Returns: whether the StdOut
andStdErr
output from this task is being printed to the terminalReturn type: bool
-
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
()¶
-
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)¶
-
setPrintingOutputToTerminal
(print_to_terminal)¶ Set this task to print
StdOut
andStdErr
output to terminal, or not.Parameters: print_to_terminal (bool) – whether to send process output to terminal
-
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
()¶
-
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.tasks.
SignalTask
(*args, **kwargs)¶ Bases:
schrodinger.tasks.tasks.AbstractTask
A task that relies on signals to proceed. Runs asynchronously via the event loop without requiring a worker thread. To use, implement setUpMain to connect any per-run signals and slots. Any slots should be decorated with SignalTask.guard_method so that exceptions in slots get converted into task failures. To end the task, emit self.mainDone to indicate the task has successfully completed. To fail, raise a TaskFailure or other exception.
-
mainDone
¶
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
static
guard_method
(func)¶
-
run
()¶
-
AUTO_TASKDIR
= <object object>¶
-
CMDLINE
= 1¶
-
DEFAULT_TASKDIR_SETTING
= None¶
-
DONE
= 3¶
-
DataClass
¶ alias of
builtins.object
-
FAILED
= 2¶
-
GUI
= 2¶
-
INTERRUPT_ENABLED
= False¶
-
RUNNING
= 1¶
-
TEMP_TASKDIR
= <object object>¶
-
WAITING
= 0¶
-
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)¶
-
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
.
-
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.
-
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.
-
getTypeHint
()¶
-
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
-
input
¶
-
inputChanged
¶
-
inputReplaced
¶
-
installEventFilter
(self, QObject)¶
-
classmethod
isAbstract
()¶ Whether the param is an “abstract” param.
-
isDefault
(*args, **kwargs)¶
-
isInterruptionRequested
()¶
-
isRunning
()¶
-
isSignalConnected
(self, QMetaMethod) → bool¶
-
isStartable
()¶
-
isWidgetType
(self) → bool¶
-
isWindowType
(self) → bool¶
-
kill
()¶ Implementations are responsible for immediately stopping the task. No threads or processes should be running after this method is complete.
This method should be called sparingly since in many contexts the task will be forced to terminate without a chance to clean up or free resources.
-
killTimer
(self, int)¶
-
max_progress
¶
-
max_progressChanged
¶
-
max_progressReplaced
¶
-
metaObject
(self) → QMetaObject¶
-
moveToThread
(self, QThread)¶
-
name
¶
-
nameChanged
¶
-
nameReplaced
¶
-
objectName
(self) → str¶
-
objectNameChanged
¶ objectNameChanged(self, str) [signal]
-
output
¶
-
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)¶
-
classmethod
runFromCmdLine
()¶
-
runPostprocessing
(callback=None)¶
-
runPreprocessing
(callback=None, calling_context=None)¶ 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.
-
setUpMain
()¶
-
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
(skip_preprocessing=False)¶ This is the main method for starting a task. Start will check if a task is not already running, run preprocessing, and then run the task.
Failures in preprocessing will interrupt the task start, and the task will never enter the RUNNING state.
Parameters: skip_preprocessing (bool) – whether to skip preprocessing. This can be useful if preprocessing was already performed prior to calling start.
-
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.
-