-
Notifications
You must be signed in to change notification settings - Fork 479
Validators in scripting languages
The validator script_validator allows you to write your validation logic in your language of choice (Python, PHP, Perl, Java, bash). script_validator takes two additional command-line arguments:
script to check the validity of a result. Exit zero if valid.
script to compare two results. Exit zero if outputs are equivalent.
arg1 ... argn represent cmdline args to be passed to the scripts. The options for init_script are:
list of paths of output files of the result
result ID
task runtime in seconds
Additional options for compare_script, for the second result:
list of paths of output files
result ID
task runtime
arg1 ... argn can be omitted, in which case only the output file paths are passed to the scripts.
The scripts must be put in your project's bin/ directory.
For applications that don't use replication, the compare script need not be given. For applications that don't need output file syntax checking, the init script need not be given.
As an example, the following PHP script, used as a compare script, would require that results match exactly:
#/usr/bin/env
<?php
$f1 = $argv[1];
$f2 = $argv[2];
if (md5_file($f1) != md5_file($f2)) {
fwrite(STDERR, "$f1 and $f2 don't match\n");
exit(1);
}
?>
The corresponding entry in config.xml would look like
<daemon>
<cmd>script_validator --app uppercase -d 3 --compare_script compare.php</cmd>
</daemon>