Contains PySys extensions required by IAF and correlator support.
- class apama.common.ApamaServerProcess(parent, name, port=None, host=None)Â¶
Abstract parent helper class for Apama server processes.
~.parent â Reference to the PySys pysys.basetest.BaseTest testcase (or pysys.process.user.ProcessUser) instantiating this instance.
~.port (int) â Port used for starting and interaction with the process. If no port parameter is used in the argument list an available port will be dynamically found from the OS and used for starting the process, and performing all operations against it.
~.host (str) â Hostname for interaction with a remote process. The host parameter is only used to perform operations against a remote process started externally to the PySys framework - the class does not support the starting of a remote process.
~.environ (dict(str,str)) â The environment for running the process
- waitForLogGrep(expr, errorExpr=['(ERROR|FATAL|Failed to parse) .*'], ignores=None, mappers=None, **kwargs)Â¶
Wait until this componentâs
logfilecontains the specified regular expression, such as a message indicating that the test has completed.
correlator.waitForLogGrep(r'INFO .* Test completed')
This is a wrapper around
pysys.basetest.BaseTest.waitForGrepthat adds functionality specific to Apama components, such as aborting early (with a clear outcome reason) if an error message is found in the log file or the process dies while waiting (with mappers to convert multi-line stack traces to a self-contained message), and always using the UTF-8 encoding to read the log file.
Any of the standard
waitForGrepkeywords such as
timeout=may also be pass in as keyword arguments.
expr (str) â The regular expression to search for in the log file. Remember to escape characters such as
condition (str) â The condition to be met for the number of lines matching the regular expression; by default we wait until there is at least one occurrence.
timeout (int) â The number of seconds to wait for the regular expression before giving up and aborting the test with
pysys.constants.TIMEDOUT(unless abortOnError=False in which case execution will continue).
ignores (list[str]) â A list of regular expressions used to identify lines in the file which should be ignored when matching both
errorExpr. By default this is taken from the value of the
mappers (List[callable[str]->str]) â A list of filter functions that will be used to pre-process each line of the log. Unless explicitly overridden, mappers for EPL and Java will be used (
A list of the matches; see
New in version 10.11.0.
- waitForComponentUp(timeout=60, **xargs)Â¶
Block until the the component declares itself to be ready for processing.
- shutdown(message='Shutdown requested by test', timeout=60, **args)Â¶
Requests a clean shutdown of the component.
If it was started by this object, also waits for the process to terminate, and silently ignores requests to shutdown if the process was already stopped.
Returns True if this has a local process that is running, or False if it has stopped, or was not started by this object.
- manage(arguments=, displayName='manage', **xargs)Â¶
Execute component_management operations against the process.
arguments â The arguments to be passed to component_management
xargs â Optional startProcess keyword arguments, e.g. timeout, ignoreExitStatus, arguments, workingDir