- backend API: added function cancel_jobs(minid, maxid)

for canceling jobs
- added program cancel_jobs for canceling jobs
- DB interface: it's not an error if update_fields_noid()
    affects != 1 rows


svn path=/trunk/boinc/; revision=24413
This commit is contained in:
David Anderson 2011-10-18 07:15:04 +00:00
parent de72c0b4b9
commit 3410abef6f
10 changed files with 138 additions and 38 deletions

View File

@ -7391,3 +7391,22 @@ Rom 17 Oct 2011
background_image.png
clientgui/skins/Default/
skin.xml
David 18 Oct 2011
- backend API: added function cancel_jobs(minid, maxid)
for canceling jobs
- added program cancel_jobs for canceling jobs
- DB interface: it's not an error if update_fields_noid()
affects != 1 rows
db/
db_base.cpp
tools/
backend_lib.cpp,h
cancel_jobs.cpp (new)
poll_wu.cpp
Makefile.am
lib/
parse.cpp
py/Boinc/
setup_project.py

View File

@ -329,7 +329,6 @@ int DB_BASE::update_fields_noid(char* set_clause, char* where_clause) {
);
int retval = db->do_query(query);
if (retval) return retval;
if (db->affected_rows() != 1) return ERR_DB_NOT_FOUND;
return 0;
}

View File

@ -75,12 +75,10 @@ function show_scenario_summary($f) {
function show_scenarios() {
page_head("The BOINC Client Emulator");
echo "
Welcome to the BOINC Client Emulator (BCE).
BCE <b>emulates</b> a BOINC client attached to one or more projects.
The BOINC Client Emulator (BCE)
<b>emulates</b> a BOINC client attached to one or more projects.
It predicts, in a few seconds,
what the BOINC client will do over a period of day or months.
This lets you predict how future versions of BOINC
will perform on your computers.
what the latest BOINC client will do over a period of day or months.
By reporting problem situations to BOINC developers,
you can help us fix bugs and improve performance.
<h3>Scenarios</h3>
@ -92,37 +90,33 @@ function show_scenarios() {
Any projects that don't currently have tasks are ignored.
<li> <b>global_prefs.xml</b> and <b>global_prefs_override.xml</b>:
computing preferences (optional).
<li> <b>cc_config.xml</b>: options such as GPU exclusions
</ul>
You create a scenario by uploading these files
using the <b>Create a scenario</b> button below.
You can use the files from a running BOINC client
to emulate that client.
You can modify these files, or create new ones, to study hypothetical scenarios
<p>
You can modify these files, or create new ones,
to study hypothetical scenarios
(e.g. hosts with a large number of CPUs,
hosts attached to a large number of projects,
projects with very short or long jobs, and so on).
See <a href=http://boinc.berkeley.edu/trac/wiki/ClientSim>The
BCE documentation</a> for details.
<p>
You create a scenario by uploading these files to the BOINC server.
<h3>Simulations</h3>
You can run <b>simulations</b> based on existing scenarios
(including scenarios created by other people).
The parameters of a simulation include
<ul>
<li> The duration and time resolution of the simulation.
<li> Choices for various client policy alternatives, including:
<ul>
<li>Whether to use Recent Estimated Credit scheduling
(the proposed policy for the 6.14 client)
<li>Whether to use Hysteresis-based work fetch
(the proposed policy for the 6.14 client)
</ul>
<li> log flags
<li> Log flags
</ul>
The outputs of a simulation include
<ul>
<li> A 'time line' showing CPU and GPU usage.
<li> The client's message log
<li> graphs of scheduling-related data (debt, REC).
<li> graphs of scheduling-related data (REC).
<li> A summary of several <b>figures of merit</b>, including
<ul>
<li>idle fraction: the fraction of processing power that was unused
@ -140,14 +134,17 @@ function show_scenarios() {
made bad scheduling or work-fetch decisions.
Or you find may places where the simulator doesn't
seem to be working correctly.
<p>
In such cases, please add a <b>comment</b> to the simulation,
indicating the nature of the problem
and the simulation time when it occurred.
<p>
Also, please post to the <a href=http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev>boinc_dev</a> email list
if you have problems using BCE,
or if you have suggestions for new features.
Please post to the <a href=http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev>boinc_dev</a> email list if
<ul>
<li> a simulation reveals a bug or bad scheduling decision
<li> you have problems using BCE
<li> BCE doesn't do more or less the same thing as your client
<li> you have suggestions for new features.
</ul>
<hr>
";
show_button(

View File

@ -438,10 +438,10 @@ void xml_unescape(char* buf) {
*out++ = c;
p = strchr(in, ';');
if (p) {
in=p+1;
} else {
while (isdigit(*in)) in++;
}
in = p+1;
} else {
while (isdigit(*in)) in++;
}
} else {
*out++ = *in++;
}

View File

@ -384,7 +384,7 @@ sys.path.insert(0, os.path.join('%s', 'py'))
[ 'appmgr', 'create_work', 'xadd', 'dbcheck_files_exist', 'run_in_ops',
'update_versions', 'parse_config', 'grep_logs', 'db_query',
'watch_tcp', 'sign_executable', 'dir_hier_move',
'manage_privileges',
'manage_privileges', 'cancel_jobs',
'dir_hier_path', 'boinc_submit', 'demo_submit', 'demo_query' ])
map(lambda (s): install(srcdir('lib',s), dir('bin',s)),
[ 'crypt_prog' ])

View File

@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.incl
scheddir = $(libexecdir)/sched
bin_PROGRAMS = create_work sign_executable dir_hier_path dir_hier_move
bin_PROGRAMS = create_work sign_executable dir_hier_path dir_hier_move cancel_jobs
dist_bin_SCRIPTS = \
boinc_submit \
@ -26,6 +26,9 @@ dist_sched_SCRIPTS = \
AM_CXXFLAGS += $(MYSQL_CFLAGS)
AM_LDFLAGS += -static
cancel_jobs_SOURCES = cancel_jobs.cpp
cancel_jobs_LDADD = $(SERVERLIBS)
create_work_SOURCES = create_work.cpp
create_work_LDADD = $(SERVERLIBS)

View File

@ -464,4 +464,28 @@ int put_file(
return 0;
}
int cancel_jobs(int min_id, int max_id) {
DB_WORKUNIT wu;
DB_RESULT result;
char set_clause[256], where_clause[256];
int retval;
sprintf(set_clause, "server_state=%d, outcome=%d",
RESULT_SERVER_STATE_OVER, RESULT_OUTCOME_DIDNT_NEED
);
sprintf(where_clause, "server_state=%d and workunitid >=%d and workunitid<= %d",
RESULT_SERVER_STATE_UNSENT, min_id, max_id
);
retval = result.update_fields_noid(set_clause, where_clause);
if (retval) return retval;
sprintf(set_clause, "error_mask=error_mask|%d, transition_time=%d",
WU_ERROR_CANCELLED, (int)(time(0))
);
sprintf(where_clause, "id>=%d and id<=%d", min_id, max_id);
retval = wu.update_fields_noid(set_clause, where_clause);
if (retval) return retval;
return 0;
}
const char *BOINC_RCSID_b5f8b10eb5 = "$Id$";

View File

@ -86,4 +86,8 @@ extern int get_file(
R_RSA_PRIVATE_KEY& key
);
// cancel jobs from min_id to max_id inclusive
//
extern int cancel_jobs(int min_id, int max_id);
#endif

54
tools/cancel_jobs.cpp Normal file
View File

@ -0,0 +1,54 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2011 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// cancel_jobs min-ID max-ID
//
// cancel jobs from min-ID to max-ID inclusive
#include <stdio.h>
#include "backend_lib.h"
#include "sched_config.h"
void usage() {
fprintf(stderr, "Usage: cancel_jobs min-ID max-ID\n");
exit(1);
}
int main(int argc, char** argv) {
if (argc != 3) usage();
int min_id = atoi(argv[1]);
int max_id = atoi(argv[2]);
if (!min_id || !max_id) usage();
int retval = config.parse_file();
if (retval) exit(1);
retval = boinc_db.open(
config.db_name, config.db_host, config.db_user, config.db_passwd
);
if (retval) {
printf("boinc_db.open: %s\n", boincerror(retval));
exit(1);
}
retval = cancel_jobs(min_id, max_id);
if (retval) {
fprintf(stderr, "cancel_jobs() failed: %s\n", boincerror(retval));
exit(retval);
}
}

View File

@ -15,18 +15,18 @@
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
//a program for polling the status of a WU in the BOINC
//system this is needed for integration with GRID.
// a program for polling the status of a WU in the BOINC
// system this is needed for integration with GRID.
//
//the states have to be the of the type the GRAM framework supplies:
//Globus::GRAM::JobState
// the states have to be the of the type the GRAM framework supplies:
// Globus::GRAM::JobState
//
//Pending: 1
//Active: 2
//Done: 3
//Failed: 4
//Suspended: 5
//Unsubmitted: 6
// Pending: 1
// Active: 2
// Done: 3
// Failed: 4
// Suspended: 5
// Unsubmitted: 6
//
//
// Author: Christian Soettrup