Contains PySys extensions required by IAF and correlator support.


class apama.common.ApamaServerProcess(parent, name, port=None, host=None)[source]¶

Bases: object

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)[source]¶

Wait until this component’s logfile contains the specified regular expression, such as a message indicating that the test has completed.

For example:

correlator.waitForLogGrep(r'INFO .* Test completed')

This is a wrapper around pysys.basetest.BaseTest.waitForGrep that 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 waitForGrep keywords such as ignores=, 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 expr and errorExpr. By default this is taken from the value of the apama.testplugin.ApamaPlugin.defaultLogIgnores.

  • 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 ( apama.testplugin.ApamaPlugin.JoinEPLStackLines and pysys.mappers.JoinLines.JavaStackTrace).


A list of the matches; see pysys.basetest.BaseTest.waitForGrep for details.

New in version 10.11.0.

waitForComponentUp(timeout=60, **xargs)[source]¶

Block until the the component declares itself to be ready for processing.

shutdown(message='Shutdown requested by test', timeout=60, **args)[source]¶

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)[source]¶

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