Update some of the code and added some documentation...

svn path=/trunk/boinc/; revision=14554
This commit is contained in:
Mark Somers 2008-01-15 08:36:59 +00:00
parent c44635f5ab
commit 5fbc198fa2
5 changed files with 118 additions and 47 deletions

View File

@ -6,3 +6,95 @@
// Please read and understand all the code before using it.
//
// Contributed by Dr. M.F. Somers, Leiden University
//
// BASIC INSTALL:
//
// 1) add tables to database using create_queue.sql:
//
// mysql yourprojectdb < create_queue.sql
//
// 2) copy files into html directory of your project so
// apache will server them:
//
// cp inc/* ~/Classical/html/inc (beware the user.inc might be overwritten, use diff!)
// cp user/* ~/Classical/html/user
// cp ops/* ~/Classical/html/ops
//
// 3) Make sure you have defined the following tags in your config.xml:
//
// <uldl_dir_fanout>
// <long_name>
// <bin_dir>
// <download_dir>
// <upload_dir>
// <project_dir>
// <create_work_program>
//
// 4) Make sure you have a WU and a result template in the template directory
// for each application with the names similar to 'queue_uppercase_work_unit_template'
// and 'queue_uppercase_result_unit_template'. These will be used to invoke 'make_work'.
//
// That shoult be it; now the queue has been setup and by default allows users to have 5
// jobslots per application. If your do not want users to be able to submit to an application
// make sure you list that app (it's ID) into the new q_restricted_apps table. The new
// q_users table can be used to allow users access to restricted apps or set different
// limits that the default 5 jobslots. The new q_list table is the list of allw WU's that
// have been submitted through the queue code...
//
// questions? send me a mail at m.somers@chem.leidenuniv.nl
//
// Example work unit template:
//
// <file_info>
// <number> 0 </number>
// </file_info>
//
// <workunit>
// <file_ref>
// <file_number> 0 </file_number>
// <open_name> classical.in </open_name>
// </file_ref>
//
// <command_line> classical.in classical.out classical.stdout </command_line>
// <min_quorum> 2 </min_quorum>
// <target_nresults> 2 </target_nresults>
// <max_error_results> 16 </max_error_results>
// <max_total_results> 16 </max_total_results>
// <max_success_results> 8 </max_success_results>
// <delay_bound> 43200 </delay_bound>
// </workunit>
//
//
// Example result template:
//
// <file_info>
// <name> <OUTFILE_0/> </name>
// <max_nbytes> 536870912 </max_nbytes>
// <url> <UPLOAD_URL/> </url>
// <generated_locally/>
// <queue_tag/>
// <upload_when_present/>
// </file_info>
//
// <file_info>
// <name> <OUTFILE_1/> </name>
// <max_nbytes> 536870912 </max_nbytes>
// <url> <UPLOAD_URL/> </url>
// <generated_locally/>
// <queue_tag/>
// <upload_when_present/>
// </file_info>
//
// <result>
// <file_ref>
// <file_name> <OUTFILE_0/> </file_name>
// <open_name> classical.out </open_name>
// </file_ref>
// <file_ref>
// <file_name> <OUTFILE_1/> </file_name>
// <open_name> classical.stdout </open_name>
// </file_ref>
// </result>
//
//

View File

@ -32,25 +32,10 @@ row2( "Job submit time: ", $jobsubmittime );
row2( "Job name: ", $jobname );
row2( "Old job status: ", $jobstatusstring );
$allresults = mysql_query( "SELECT * FROM result WHERE workunitid=".$workunitid );
$nrofresults = mysql_num_rows( $allresults );
for( $resultindex = 0; $resultindex < $nrofresults; ++$resultindex )
{
$result = mysql_fetch_object( $allresults );
$result -> xml_doc_in = remove_tags( $result -> xml_doc_in, "<queue_tag/>" );
$query = "UPDATE result SET xml_doc_in='".$result -> xml_doc_in."' WHERE id=".$result -> id;
mysql_query( $query );
}
$query = "UPDATE result SET server_state=5,outcome=5 WHERE server_state=2 AND workunitid=".$workunit -> id;
mysql_query( $query );
$workunit -> xml_doc = remove_tags( $workunit -> xml_doc, "<queue_tag/>" );
$query = "UPDATE workunit SET xml_doc='".$workunit -> xml_doc."' WHERE id=".$workunit -> id;
mysql_query( $query );
$query = "UPDATE workunit SET error_mask=error_mask|16,transition_time=".time(0)." WHERE id=".$workunit -> id;
$query = "UPDATE workunit SET error_mask=error_mask|16,transition_time=".time(0).",batch=0 WHERE id=".$workunit -> id;
mysql_query( $query );
$query = "DELETE FROM q_list WHERE id=".$job -> id;

View File

@ -43,6 +43,12 @@ if( $nrofapps )
row2( "Name of job (no spaces, quotes or slashes): ", '<input type="text" size="65" name="name" value="" maxlength="128" >' );
row2( "Input: ", '<textarea wrap="off" rows="20" cols="74" name="input"></textarea>' );
// These numbers have been based on running our app on our pool of 10000 desktops at that time
// for about 10000 WU's. For each successfull result the 'cpu_time' was multiplied with the hosts
// 'p_fpops' to get an estimate for the WU number of fops (which sould be fairly constant). This
// number was the devided by the average of all hosts 'cpu_time'. If your pool is bigger/different
// you might check these numbers first with your app, but they should be fairly okay...
$selection = '<option value="461274818700"> 5 min. </option>';
$selection .= '<option value="1383824456100"> 15 min. </option>';
$selection .= '<option value="2767648912200"> 30 min. </option>';
@ -72,7 +78,6 @@ if( $nrofapps )
row2( "", '<input type="submit" value=" Submit Job ">' );
row1( "Commands" );
row2( "", '<a href="download/DownLoads/ClassicalBuilder/webstart_ClassicalBuilder.jnlp">Run Classical-Builder</a>' );
row2( "", '<a href="queue_show_queue.php">Go back to your queue</a>' );
row2( "", '<a href="logout.php">Log out</a>' );

View File

@ -97,20 +97,24 @@ if( !fwrite( $filehandle, $jobinput ) )
fclose( $filehandle );
if( strpos( $jobapplicationname, "classical" ) !== false )
{
$testinputcommand = $bin_dir."/verify_classical_input ".$temporaryinputfile." /dev/null /dev/stdout /dev/stdout";
$testinputcommand = escapeshellcmd( $testinputcommand );
$testinputcommand = "cd ".$config_dir."; ".$testinputcommand;
$errorline = 0;
exec( $testinputcommand, &$outputoftest, &$errorline );
if( $errorline != 0 )
{
$errorstring = "Your input had an error on line ".$errorline." ! The job was not submitted !";
unlink( $temporaryinputfile );
exit_with_text( $errorstring );
}
}
// We at Leiden Classical have a special mode for our app, it can verify the user supplied
// input and return an exit code signaling an error. We tend to parse the input before let
// it run on our desktop pool ;-)... Here's how...
//
// if( strpos( $jobapplicationname, "classical" ) !== false )
// {
// $testinputcommand = $bin_dir."/verify_classical_input ".$temporaryinputfile." /dev/null /dev/stdout /dev/stdout";
// $testinputcommand = escapeshellcmd( $testinputcommand );
// $testinputcommand = "cd ".$config_dir."; ".$testinputcommand;
// $errorline = 0;
// exec( $testinputcommand, &$outputoftest, &$errorline );
// if( $errorline != 0 )
// {
// $errorstring = "Your input had an error on line ".$errorline." ! The job was not submitted !";
// unlink( $temporaryinputfile );
// exit_with_text( $errorstring );
// }
// }
system( $command_to_submit );

View File

@ -36,25 +36,10 @@ row2( "Job submit time: ", $jobsubmittime );
row2( "Job name: ", $jobname );
row2( "Old job status: ", $jobstatusstring );
$allresults = mysql_query( "SELECT * FROM result WHERE workunitid=".$workunitid );
$nrofresults = mysql_num_rows( $allresults );
for( $resultindex = 0; $resultindex < $nrofresults; ++$resultindex )
{
$result = mysql_fetch_object( $allresults );
$result -> xml_doc_in = remove_tags( $result -> xml_doc_in, "<queue_tag/>" );
$query = "UPDATE result SET xml_doc_in='".$result -> xml_doc_in."' WHERE id=".$result -> id;
mysql_query( $query );
}
$query = "UPDATE result SET server_state=5,outcome=5 WHERE server_state=2 AND workunitid=".$workunit -> id;
mysql_query( $query );
$workunit -> xml_doc = remove_tags( $workunit -> xml_doc, "<queue_tag/>" );
$query = "UPDATE workunit SET xml_doc='".$workunit -> xml_doc."' WHERE id=".$workunit -> id;
mysql_query( $query );
$query = "UPDATE workunit SET error_mask=error_mask|16,transition_time=".time(0)." WHERE id=".$workunit -> id;
$query = "UPDATE workunit SET error_mask=error_mask|16,transition_time=".time(0).",batch=0 WHERE id=".$workunit -> id;
mysql_query( $query );
$query = "DELETE FROM q_list WHERE id=".$job -> id;