Assimilator

The purpose of the assimilator is to extract the valid results from the project database. Of course it is possible to extract the results manually from the project database, but developing an assimilator is usually the most convenient method of obtaining the valid results. The assimilator contacts the project server and requests the next valid result and the work unit from which the result was generated. Once the result is assimilated, it needs to be removed from the project database; if the result is not removed, the project server will continue to return that same result when asked for the next valid result. The assimilator component asks the project server for the next valid result, assimilates that result, tells the project server to delete the result that was just assimilated, then repeats this process. The figure below shows an overview of the assimilator's control flow:

Result Validator Control Flow

The first step taken by the result validator is to execute the server.getWorkUnitResultPairForAssimilation RPC on the project server. This RPC does not take any parameters. This RPC will return an exception if there are no results that need to be assimilated. If this is the case, the assimilator should sleep for some amount of time and then execute the RPC again. If there is a result to assimilate, the server returns a vector containing four elements. The first element (index 0) of the vector is the ID of the work unit from which the result was computed. The second element is the work unit data. The third element is the result ID. The fourth element is the result data. After retrieving the result to be assimilated and its associated work unit, some action should be taken by the assimilator to store the result and/or work unit in a database or file system for future analysis, or the result should be examined in order to modify the operation of the PRC project. An example of the latter case could be that the purpose of the project is to examine multiple datasets , and the result that was just returned to the assimilator indicates that the current dataset should not be processed further. In that case, the assimilator could send a message (via XML-RPC for example) to the work unit generator component instructing it to stop generating work units for the current dataset and to move on to the next dataset. After the result and/or work unit has been assimilated, the result and work unit need to be deleted from the project server. If they are not deleted, the same result and work unit will be returned to the assimilator every time it requests the next result for assimilation. To delete the result and work unit from the project database, the assimilator should execute the server.deleteValidResultAndAssociatedWorkUnit RPC. This RPC takes a single parameter: the ID of the result to delete. The project server will find the work unit associated with that result and delete it as well.