Package park :: Package core :: Module monitor

Module monitor

source code

Asychronous execution monitoring service.

Long running computations need to convey status information to the user. This status can take multiple forms, such as output to the console or activity on a GUI, or even mail to your inbox.

park.core.message defines several standard messages:

`Started` for job start
`Joined` first message when joining an already running job
`Progress` for job activity
`Improved` for partial results
`Completed` for final result
`Aborted` when job is killed
`Error` when job has an error
`Log` for various debugging messages

The Monitor class handles the stream of messages, dispatching each to a user defined handler. For each message, Monitor.put(message) will look for the method named onMonitorName where Name is the name of the message class. For example, onMonitorStarted(self, message) will be called in response to the Started message. If onMonitorName is not defined, then onMonitorMessage will be called. The default behaviour of onMonitorMessage is to print the message on the console.

Individual services may have specialized message types. Such services may also provide a specialized Monitor subclass to handle these messages.

Log messages are sent to the standard system logger using onMonitorLog. See logging in the python standard library for details on controlling the logger.

park.core.wxmonitor.Monitor is a predefined monitor which dispatches events to a wx GUI.

Classes
  Monitor
Messages that are received during the processing of the job.