-
Notifications
You must be signed in to change notification settings - Fork 448
Assimilators in C
David Anderson edited this page Jan 11, 2024
·
1 revision
To create an assimilator, link the program sched/assimilator.cpp with a function of the form
int assimilate_handler(
WORKUNIT& wu, vector<RESULT>& results, RESULT& canonical_result
);
This function is called when either
- The workunit has a nonzero error mask (indicating, for example, too many error results). In this case the handler might write a message to a log or send an email to the project administrator.
- The workunit has a canonical result. In this case wu.canonical_resultid will be nonzero, and canonical_result will contain the canonical result.
In both cases the 'results' vector will be populated with all the workunit's results (including unsuccessful and unsent ones). All files (both input and output) will generally be on disk.
It's possible that both conditions might hold.
The return values of assimilate_handler()
are:
- 0: success: the workunit will be marked as assimilated.
- DEFER_ASSIMILATION: the workunit will be processed again when another instance finishes. This is useful for applications where you want to see all the completed results.
- Other nonzero values: the assimilator will log an error message and exit. Typically assimilate_handler() should return nonzero for any error condition. This way the system administrator can fix the problem before any completed or erroneous workunits are mis-handled by BOINC.
You can use BOINC's back-end utility functions to get file pathnames and open files.