2004-06-09 19:09:16 +00:00
|
|
|
<?php
|
2003-12-24 00:50:51 +00:00
|
|
|
require_once("docutil.php");
|
|
|
|
page_head("Validation");
|
|
|
|
echo "
|
2004-02-09 05:11:05 +00:00
|
|
|
<p>
|
2004-03-15 20:40:59 +00:00
|
|
|
<b>Validation</b> is the process of comparing redundant results
|
|
|
|
and deciding which is to be considered correct.
|
2004-03-17 01:26:44 +00:00
|
|
|
Because floating-point arithmetic varies between platforms,
|
|
|
|
this decision is an application-specific.
|
|
|
|
<p>
|
|
|
|
A <b>validator</b> is a back-end program that does validation
|
|
|
|
and credit-granting.
|
|
|
|
You must supply a validator for each application in your project.
|
2004-09-10 00:41:48 +00:00
|
|
|
BOINC supplies a framework program <b>validator.C</b>.
|
2004-03-15 20:40:59 +00:00
|
|
|
This program must be linked with two application-specific functions:
|
|
|
|
<pre>",
|
|
|
|
htmlspecialchars("
|
2004-09-10 00:41:48 +00:00
|
|
|
int check_set(vector<RESULT> results, DB_WORKUNIT& wu, int& canonicalid, double& credit, bool& retry);
|
2004-03-15 20:40:59 +00:00
|
|
|
"),
|
|
|
|
"</pre>
|
2004-09-10 00:41:48 +00:00
|
|
|
<ul>
|
|
|
|
<li><b>check_set()</b> takes a set of results (all with outcome=SUCCESS).
|
|
|
|
If there is a quorum of matching results,
|
|
|
|
it selects one of them as the canonical result, returning its ID.
|
|
|
|
In this case it also returns the credit to
|
2004-02-09 05:11:05 +00:00
|
|
|
be granted for correct results for this workunit.
|
2004-09-10 00:41:48 +00:00
|
|
|
|
|
|
|
<li>
|
|
|
|
If, when an output file for a result has a nonrecoverable error
|
2004-12-01 05:03:53 +00:00
|
|
|
(e.g. the directory is there but the file isn't,
|
|
|
|
or the file is present but has invalid contents),
|
2004-09-10 21:02:11 +00:00
|
|
|
then it must set the result's outcome (in memory, not database)
|
|
|
|
to VALIDATE_ERROR.
|
2004-09-10 00:41:48 +00:00
|
|
|
Note: the function try_fopen() (in lib/util.C) can be used
|
|
|
|
to detect recoverable/nonrecoverable errors.
|
|
|
|
<li>
|
|
|
|
If a canonical result is found, check_set() must set the
|
|
|
|
validate_state field of each non-ERROR result to either VALID or INVALID.
|
|
|
|
|
|
|
|
<li>
|
|
|
|
If a recoverable error occurs while reading output files
|
2004-09-21 19:58:30 +00:00
|
|
|
(e.g. a directory wasn't visible due to NFS mount failure)
|
2004-09-10 00:41:48 +00:00
|
|
|
then check_set() should return retry=true.
|
|
|
|
This tells the validator to arrange for this WU to be
|
|
|
|
examined again in a few hours.
|
|
|
|
<li>
|
2004-09-21 19:58:30 +00:00
|
|
|
check_set() should return nonzero if a major error occurs.
|
2004-09-10 00:41:48 +00:00
|
|
|
This tells the validator to write an error message and exit.
|
|
|
|
</ul>
|
2004-02-09 05:11:05 +00:00
|
|
|
<p>
|
2004-09-10 00:41:48 +00:00
|
|
|
<pre>",
|
|
|
|
htmlspecialchars("
|
|
|
|
int check_pair(RESULT& new_result, RESULT& canonical_result, bool& retry);
|
|
|
|
"),
|
|
|
|
"</pre>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<b>check_pair()</b> compares a new result to the canonical result.
|
|
|
|
In the absence of errors,
|
|
|
|
it sets the new result's validate_state to either VALID or INVALID.
|
|
|
|
<li>
|
|
|
|
If it has a nonrecoverable error reading an output file of either result,
|
2004-12-01 05:03:53 +00:00
|
|
|
or if the new result's output file is invalid,
|
2004-09-10 21:02:11 +00:00
|
|
|
it must set the new result's outcome (in memory, not database)
|
|
|
|
to VALIDATE_ERROR.
|
2004-09-10 00:41:48 +00:00
|
|
|
<li>
|
|
|
|
If it has a recoverable error while reading an output file of either result,
|
|
|
|
it returns retry=true,
|
|
|
|
which causes the validator to arrange for the WU to be examined
|
|
|
|
again in a few hours.
|
|
|
|
<li>
|
2004-09-21 19:58:30 +00:00
|
|
|
check_pair() should return nonzero if a major error occurs.
|
2004-09-10 00:41:48 +00:00
|
|
|
This tells the validator to write an error message and exit.
|
|
|
|
</ul>
|
2004-02-09 05:11:05 +00:00
|
|
|
|
2004-11-29 22:26:34 +00:00
|
|
|
<p>
|
|
|
|
Neither function should delete files.
|
2004-02-09 05:11:05 +00:00
|
|
|
<p>
|
2004-03-17 01:26:44 +00:00
|
|
|
Two example validators are supplied
|
|
|
|
(each implements check_set() and check_pair()):
|
|
|
|
<ul>
|
|
|
|
<li>
|
2004-09-10 00:41:48 +00:00
|
|
|
<b>sample_bitwise_validator</b> requires a strict majority,
|
2004-03-17 01:26:44 +00:00
|
|
|
and regards results as equivalent only if they agree byte for byte.
|
|
|
|
<li>
|
2004-09-10 00:41:48 +00:00
|
|
|
<b>sample_trivial_validator</b>
|
2004-03-17 01:26:44 +00:00
|
|
|
regards any two results as equivalent if their CPU time
|
|
|
|
exceeds a given minimum.
|
|
|
|
</ul>
|
|
|
|
<p>
|
2004-11-17 00:01:58 +00:00
|
|
|
<b>validate_util.C</b> contains support functions for both of the above.
|
2004-03-17 01:26:44 +00:00
|
|
|
|
|
|
|
<hr>
|
|
|
|
<b>NOTE: the above code assumes that each result
|
|
|
|
has a single output file.
|
|
|
|
Revisions will be needed to handle multiple output files.
|
|
|
|
To do this you will need to know the following:
|
|
|
|
</b>
|
2004-02-09 05:11:05 +00:00
|
|
|
|
2003-12-24 00:50:51 +00:00
|
|
|
<p>
|
2004-03-17 01:26:44 +00:00
|
|
|
The database field 'result.xml_doc_out'
|
|
|
|
describes a result's output files.
|
|
|
|
It has the form
|
|
|
|
<pre>
|
2004-03-15 20:40:59 +00:00
|
|
|
",htmlspecialchars("
|
|
|
|
<file_info>...</file_info>
|
2003-12-24 00:50:51 +00:00
|
|
|
[ ... ]
|
2004-03-15 20:40:59 +00:00
|
|
|
<result>
|
|
|
|
<name>foobar</name>
|
|
|
|
<wu_name>blah</wu_name>
|
|
|
|
<exit_status>blah</exit_status>
|
|
|
|
<file_ref>...</file_ref>
|
2003-12-24 00:50:51 +00:00
|
|
|
[ ... ]
|
2004-03-15 20:40:59 +00:00
|
|
|
</result>
|
|
|
|
"),"
|
2003-12-24 00:50:51 +00:00
|
|
|
</pre>
|
|
|
|
The components are:
|
|
|
|
<ul>
|
|
|
|
<li> The <b><name></b> element is the result name.
|
|
|
|
<li> The <b><wu_name></b> element is the workunit name.
|
2004-03-17 01:26:44 +00:00
|
|
|
<li> Each <b><file_ref></b> element is an association to an output file,
|
|
|
|
described by a corresponding <b><file_info></b> element.
|
2003-12-24 00:50:51 +00:00
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
The XML document describing the sizes and checksums of the output
|
2004-03-17 01:26:44 +00:00
|
|
|
files is a list of <b><file_info></b> elements,
|
|
|
|
with the <b>nbytes</b> and <b>md5_cksum</b> fields present.
|
2003-12-24 00:50:51 +00:00
|
|
|
The project back end
|
|
|
|
must parse this field to find the locations and checksums of output files.
|
|
|
|
";
|
|
|
|
page_tail();
|
|
|
|
?>
|