ooici/coi-services — pull request #562 by swarbhanu (2013-02-13 16:03:13+00:00)
Title: Fixed the SA test breaking in pycc mode where the data process was not actually running before assertions were made

* Instead of using UNS' find_events() method which is being refactored, we use pyon's event repository's find_events(). This method is used AFTER a create_data_process() method to look into the immediate past and find ProcessLifeCycle events for the process launched by the create_data_process() with the state equal to ProcessStateEnum.RUNNING. The find_events() method is not used in a bare way, otherwise it would miss a process that gets to running mode slowly. Instead, it is wrapped in a poller using a poll method in pyon utility. The poller blocks with a timeout of 10 seconds, until it finds the good event ("process is running") and only after that the rest of the test code is executed.

This should ensure that test does not prematurely try to continue down the road with assertions, when the process launched through create_data_process() is not actually running.

Note that we could not use EventSubscriber() since the process id used to listen is actually inside the data process returned by the create_data_process(). So we cannot setup the EventSubscriber before executing a create_data_process(). On the other hand, we could not use the EventSubscriber() after the create_data_process(), because then we would not be able to catch the superfast process launches.

So instead of looking to the future for process launch events, using a way that looked to the past for events in the database works.

* The test works with or without pycc mode.