From 5fbc198fa2d46889db25864fd0b070cbfb46eb4c Mon Sep 17 00:00:00 2001 From: Mark Somers Date: Tue, 15 Jan 2008 08:36:59 +0000 Subject: [PATCH] Update some of the code and added some documentation... svn path=/trunk/boinc/; revision=14554 --- html/queue/README | 92 +++++++++++++++++++ html/queue/ops/ops_queue_remove_job.php | 17 +--- html/queue/user/queue_new_job_form.php | 7 +- html/queue/user/queue_new_job_form_action.php | 32 ++++--- html/queue/user/queue_remove_job.php | 17 +--- 5 files changed, 118 insertions(+), 47 deletions(-) diff --git a/html/queue/README b/html/queue/README index 810b9b4e59..44d6fe56d2 100644 --- a/html/queue/README +++ b/html/queue/README @@ -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: +// +// +// +// +// +// +// +// +// +// 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: +// +// +// 0 +// +// +// +// +// 0 +// classical.in +// +// +// classical.in classical.out classical.stdout +// 2 +// 2 +// 16 +// 16 +// 8 +// 43200 +// +// +// +// Example result template: +// +// +// +// 536870912 +// +// +// +// +// +// +// +// +// 536870912 +// +// +// +// +// +// +// +// +// +// classical.out +// +// +// +// classical.stdout +// +// +// +// + diff --git a/html/queue/ops/ops_queue_remove_job.php b/html/queue/ops/ops_queue_remove_job.php index 9d85cb6374..74fa44ce5f 100644 --- a/html/queue/ops/ops_queue_remove_job.php +++ b/html/queue/ops/ops_queue_remove_job.php @@ -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, "" ); - $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, "" ); -$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; diff --git a/html/queue/user/queue_new_job_form.php b/html/queue/user/queue_new_job_form.php index 36d658516b..a7c91fdbe8 100644 --- a/html/queue/user/queue_new_job_form.php +++ b/html/queue/user/queue_new_job_form.php @@ -43,6 +43,12 @@ if( $nrofapps ) row2( "Name of job (no spaces, quotes or slashes): ", '' ); row2( "Input: ", '' ); + // 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 = ''; $selection .= ''; $selection .= ''; @@ -72,7 +78,6 @@ if( $nrofapps ) row2( "", '' ); row1( "Commands" ); - row2( "", 'Run Classical-Builder' ); row2( "", 'Go back to your queue' ); row2( "", 'Log out' ); diff --git a/html/queue/user/queue_new_job_form_action.php b/html/queue/user/queue_new_job_form_action.php index 9b0345c1e1..de6234d906 100644 --- a/html/queue/user/queue_new_job_form_action.php +++ b/html/queue/user/queue_new_job_form_action.php @@ -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 ); diff --git a/html/queue/user/queue_remove_job.php b/html/queue/user/queue_remove_job.php index 45c9e6b008..64c7e22343 100644 --- a/html/queue/user/queue_remove_job.php +++ b/html/queue/user/queue_remove_job.php @@ -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, "" ); - $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, "" ); -$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;