Listener

Listener(parent, listen_func, listen_status, map_property, max_attempts=None, fail_results=None)

Listener class which is running in the background and collects state change information of jobs attached to the parent JobHandler instance.

  • parent Parent JobHandler instance.
  • listen_func The function definition used to collect the state change information. Results are collected in self._results as a dictionary with the keys being the defined map_property of the jobs.
  • listen_status The job status the listener will consider.
  • map_property Property name of jobs to which the respective job name is mapped to. The choice of the property name is driven by the definition of the listen_func.
  • max_attempts Maximum number of attempts that the information collection will be executed.
  • fail_results The results the job properties should be set to in case the max_attempts limit is reached.

Member functions

start

Listener.start(self, interval=1)

Spawn subprocess which continuously collects information by configurable mechanism and match any updates in the output to a state change decision of jobs.

  • interval Interval at which information is collected by subprocess.

stop

Listener.stop(self)

Stop listening subprocess.

update_jobs

Listener.update_jobs(self)

Update jobs associated to parent JobHandler with the collected information.