From 48e1de534830ddec80ba0acd64583c153e8ef879 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 14 Feb 2013 20:31:35 -0800 Subject: [PATCH] - remote job submission: bug fixes, and avoid divide by zero in adjust_user_priority. From Niclas Lockner. --- html/user/submit_rpc_handler.php | 3 +-- tools/backend_lib.cpp | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php index 9ce4f0d8ac..32b7a338e6 100644 --- a/html/user/submit_rpc_handler.php +++ b/html/user/submit_rpc_handler.php @@ -160,7 +160,6 @@ function xml_get_jobs($r) { } function submit_batch($r) { - print_r($r); $app = get_app($r); list($user, $user_submit) = authenticate_user($r, $app); $template = read_input_template($app); @@ -201,7 +200,7 @@ function submit_batch($r) { } } $cmd = "cd ../../bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; - $x = system($cmd); + $x = exec($cmd); if (!is_numeric($x) || (double)$x == 0) { xml_error(-1, "$cmd returned $x"); } diff --git a/tools/backend_lib.cpp b/tools/backend_lib.cpp index 1aa1db3ff7..b9757e32b7 100644 --- a/tools/backend_lib.cpp +++ b/tools/backend_lib.cpp @@ -622,6 +622,9 @@ double user_priority_delta( double total_quota, double project_flops ) { + if (total_quota == 0) return 0; + if (project_flops == 0) return 0; + double runtime = flop_count / project_flops; double share = us.quota / total_quota; #if 0