From dd332d61edc1823f6afb9478430ce9dfbabd5b95 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 24 Sep 2020 22:06:53 -0700 Subject: [PATCH] remote job submission: specify all fields on batch creation. Newer versions of MySQL error out if you don't. --- html/user/submit_rpc_handler.php | 6 ++++-- lib/submit_api.py | 2 +- tools/submit_api_test.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php index bae51231cf..0f8bb7c98c 100644 --- a/html/user/submit_rpc_handler.php +++ b/html/user/submit_rpc_handler.php @@ -496,8 +496,9 @@ function submit_batch($r) { } else { $batch_name = (string)($r->batch->batch_name); $batch_name = BoincDb::escape_string($batch_name); + $state = BATCH_STATE_INIT; $batch_id = BoincBatch::insert( - "(user_id, create_time, njobs, name, app_id, logical_end_time, state) values ($user->id, $now, $njobs, '$batch_name', $app->id, $let, ".BATCH_STATE_INIT.")" + "(user_id, create_time, logical_start_time, logical_end_time, est_completion_time, njobs, fraction_done, nerror_jobs, state, completion_time, credit_estimate, credit_canonical, credit_total, name, app_id, project_state, description, expire_time) values ($user->id, $now, 0, $let, 0, $njobs, 0, 0, $state, 0, 0, 0, 0, '$batch_name', $app->id, 0, '', 0)" ); if (!$batch_id) { log_write("can't create batch"); @@ -550,8 +551,9 @@ function create_batch($r) { $batch_name = (string)($r->batch_name); $batch_name = BoincDb::escape_string($batch_name); $expire_time = (double)($r->expire_time); + $state = BATCH_STATE_INIT; $batch_id = BoincBatch::insert( - "(user_id, create_time, name, app_id, state, expire_time) values ($user->id, $now, '$batch_name', $app->id, ".BATCH_STATE_INIT.", $expire_time)" + "(user_id, create_time, logical_start_time, logical_end_time, est_completion_time, njobs, fraction_done, nerror_jobs, state, completion_time, credit_estimate, credit_canonical, credit_total, name, app_id, project_state, description, expire_time) values ($user->id, $now, 0, 0, 0, 0, 0, 0, $state, 0, 0, 0, 0, '$batch_name', $app->id, 0, '', $expire_time)" ); if (!$batch_id) { log_write("Can't create batch: ".BoincDb::error()); diff --git a/lib/submit_api.py b/lib/submit_api.py index bff5e4dc62..3228f7b509 100644 --- a/lib/submit_api.py +++ b/lib/submit_api.py @@ -24,7 +24,7 @@ import urllib2 import copy import xml.etree.ElementTree as ET import requests - # you'll need to "yip install requests" + # you'll need to "pip install requests" import hashlib # describes an input file diff --git a/tools/submit_api_test.py b/tools/submit_api_test.py index 65f9df57ef..06b17445de 100644 --- a/tools/submit_api_test.py +++ b/tools/submit_api_test.py @@ -192,11 +192,11 @@ def test_get_output_files(): def test_get_job_counts(): req = REQUEST() - req.project = 'http://isaac.ssl.berkeley.edu/test/' + [req.project, req.authenticator] = get_auth() x = get_job_counts(req) print x.find('results_ready_to_send').text #test_query_batch(328) #test_submit_batch('batch_39') set_timeout(10) -test_create_batch('batch_138') +test_create_batch('batch_140')