From fdc6692734ffbc93df8396f473828836fdf6132b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 27 Jun 2024 23:23:01 -0700 Subject: [PATCH] remote job submission: create_batch(): generate batch name if not supplied Finish query_completed_job() --- html/user/forum_user_posts.php | 1 + html/user/submit_rpc_handler.php | 3 +++ lib/boinc_submit.py | 13 ++++++++++--- lib/submit_api.py | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/html/user/forum_user_posts.php b/html/user/forum_user_posts.php index 740e50f89d..34206749c4 100644 --- a/html/user/forum_user_posts.php +++ b/html/user/forum_user_posts.php @@ -31,6 +31,7 @@ if (!$offset) $offset=0; $items_per_page = 20; $user = BoincUser::lookup_id($userid); +if (!$user) error_page('no such user'); $logged_in_user = get_logged_in_user(false); BoincForumPrefs::lookup($logged_in_user); diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php index 1624507cf3..15962ec6af 100644 --- a/html/user/submit_rpc_handler.php +++ b/html/user/submit_rpc_handler.php @@ -571,6 +571,9 @@ function create_batch($r) { list($user, $user_submit) = check_remote_submit_permissions($r, $app); $now = time(); $batch_name = (string)($r->batch_name); + if (!$batch_name) { + $batch_name = make_batch_name($user, $app); + } $batch_name = BoincDb::escape_string($batch_name); $expire_time = (double)($r->expire_time); $state = BATCH_STATE_INIT; diff --git a/lib/boinc_submit.py b/lib/boinc_submit.py index e848dcf041..249fe75d14 100644 --- a/lib/boinc_submit.py +++ b/lib/boinc_submit.py @@ -94,7 +94,7 @@ class BOINC_SERVER: def submit_batch(self, batch_desc): return self.do_http_post(self.batch_desc_xml(batch_desc, 'submit_batch')) - def create_batch(self, app_name, batch_name, expire_time): + def create_batch(self, app_name, batch_name='', expire_time=0): return self.do_http_post( self.create_batch_xml(app_name, batch_name, expire_time) ) @@ -116,11 +116,11 @@ class BOINC_SERVER: def query_batches(self, get_cpu_time): return self.do_http_post(self.query_batches_xml(get_cpu_time)) +########## job operations + def query_completed_job(self, job_name): return self.do_http_post(self.query_completed_job_xml(job_name)) -########## job operations - def abort_jobs(self, job_names): return self.do_http_post(self.abort_jobs_xml(job_names)) @@ -290,6 +290,13 @@ class BOINC_SERVER: '\n' ) %(self.authenticator, 1 if get_cpu_time else 0) + def query_completed_job_xml(self, job_name): + return ('\n' + '%s\n' + '%s\n' + '\n' + ) %(self.authenticator, job_name) + def abort_jobs_xml(self, job_names): xml = ('\n' '%s\n' diff --git a/lib/submit_api.py b/lib/submit_api.py index 4a3126de25..679fcc8695 100644 --- a/lib/submit_api.py +++ b/lib/submit_api.py @@ -1,3 +1,5 @@ +# THIS IS DEPRECATED. USE boinc_submit.py INSTEAD + # This file is part of BOINC. # http://boinc.berkeley.edu # Copyright (C) 2020 University of California