diff --git a/html/inc/submit.inc b/html/inc/submit.inc index 0aa1751512..ea280f836d 100644 --- a/html/inc/submit.inc +++ b/html/inc/submit.inc @@ -48,6 +48,10 @@ function req_to_xml($req, $op) { } if ((isset($req->workunit_template_file)) && ($req->workunit_template_file)) { $x .= " $req->workunit_template_file +"; + } + if ((isset($req->app_version_num)) && ($req->app_version_num)) { + $x .= " $req->app_version_num "; } foreach ($req->jobs as $job) { @@ -332,7 +336,8 @@ if (0) { $req->project = "http://isaac.ssl.berkeley.edu/test/"; $req->authenticator = trim(file_get_contents("test_auth")); $req->app_name = "uppercase"; - $req->batch_name = "batch_name3"; + $req->batch_name = "batch_name5"; + $req->app_version_num = 710; $req->jobs = array(); $job = new StdClass; diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php index 8c152f9b61..2fc89f73cd 100644 --- a/html/user/submit_rpc_handler.php +++ b/html/user/submit_rpc_handler.php @@ -192,7 +192,7 @@ function stage_files(&$jobs) { // submit a list of jobs with a single create_work command. // function submit_jobs( - $jobs, $template, $app, $batch_id, $priority, + $jobs, $template, $app, $batch_id, $priority, $app_version_num, $result_template_file, // batch-level; can also specify per job $workunit_template_file ) { @@ -242,6 +242,9 @@ function submit_jobs( if ($workunit_template_file) { $cmd .= " --wu_template templates/$workunit_template_file"; } + if ($app_version_num) { + $cmd .= " --app_version_num $app_version_num"; + } $cmd .= " --stdin >$errfile 2>&1"; $h = popen($cmd, "w"); if ($h === false) { @@ -353,6 +356,8 @@ function xml_get_jobs($r) { return $jobs; } +// $r is a simplexml object for the request message +// function submit_batch($r) { xml_start_tag("submit_batch"); $app = get_submit_app((string)($r->batch->app_name)); @@ -365,6 +370,7 @@ function submit_batch($r) { stage_files($jobs); $njobs = count($jobs); $now = time(); + $app_version_num = (int)($r->batch->app_version_num); $batch_id = (int)($r->batch->batch_id); if ($batch_id) { $batch = BoincBatch::lookup_id($batch_id); @@ -432,7 +438,7 @@ function submit_batch($r) { } submit_jobs( - $jobs, $template, $app, $batch_id, $let, + $jobs, $template, $app, $batch_id, $let, $app_version_num, $result_template_file, $workunit_template_file ); diff --git a/lib/remote_submit.cpp b/lib/remote_submit.cpp index 0b7ad5a112..4dbc3aa04b 100644 --- a/lib/remote_submit.cpp +++ b/lib/remote_submit.cpp @@ -395,7 +395,8 @@ int submit_jobs( char app_name[256], int batch_id, vector jobs, - string& error_msg + string& error_msg, + int app_version_num ) { char buf[1024], url[1024]; sprintf(buf, @@ -403,10 +404,12 @@ int submit_jobs( "%s\n" "\n" " %d\n" - " %s\n", + " %s\n" + " %d\n", authenticator, batch_id, - app_name + app_name, + app_version_num ); string request = buf; for (unsigned int i=0; i jobs, - std::string& error_msg + std::string& error_msg, + int app_version_num = 0 ); extern int estimate_batch( diff --git a/lib/submit_api.py b/lib/submit_api.py index 7c482d5ce3..76af6d77eb 100644 --- a/lib/submit_api.py +++ b/lib/submit_api.py @@ -82,6 +82,10 @@ class BATCH_DESC: xml += '%s\n'%(self.batch_id) elif hasattr(self, 'batch_name'): xml += '%s\n'%(self.batch_name) + + if hasattr(self, 'app_version_num'): + xml += '%d\n'%(self.app_version_num) + for job in self.jobs: xml += job.to_xml() xml += '\n\n' %(op) diff --git a/tools/submit_api_test.py b/tools/submit_api_test.py index fd097d5ddb..c48959ae0c 100644 --- a/tools/submit_api_test.py +++ b/tools/submit_api_test.py @@ -46,6 +46,7 @@ def make_batch_desc(batch_name): [batch.project, batch.authenticator] = get_auth() batch.app_name = "uppercase" batch.batch_name = batch_name + batch.app_version_num = 710; batch.jobs = [] for i in range(2): @@ -191,5 +192,5 @@ def test_get_output_files(): print(r) #test_query_batch(328) -#test_submit_batch('batch_32') -test_create_batch('batch_33') +test_submit_batch('batch_35') +#test_create_batch('batch_33')