mirror of https://github.com/BOINC/boinc.git
- Added a -dont_update_db command-line option to assimilator.C which prevents it from updating
the database, and so is useful for testing. svn path=/trunk/boinc/; revision=4668
This commit is contained in:
parent
c28a5e7170
commit
9a8151dd63
|
@ -20288,3 +20288,9 @@ Bruce and Reinhard 2004-11-26
|
||||||
Makefile.am
|
Makefile.am
|
||||||
test/
|
test/
|
||||||
boinc_db.inc [removed: this file is autogenerated]
|
boinc_db.inc [removed: this file is autogenerated]
|
||||||
|
|
||||||
|
Bruce 2004-11-27
|
||||||
|
- Added a -dont_update_db command-line option to assimilator.C which prevents it from updating
|
||||||
|
the database, and so is useful for testing.
|
||||||
|
sched/
|
||||||
|
assimilator.C
|
||||||
|
|
|
@ -44,7 +44,8 @@ using std::vector;
|
||||||
#define PIDFILE "assimilator.pid"
|
#define PIDFILE "assimilator.pid"
|
||||||
|
|
||||||
SCHED_CONFIG config;
|
SCHED_CONFIG config;
|
||||||
bool noinsert = false;
|
bool update_db = true;
|
||||||
|
|
||||||
|
|
||||||
#define SLEEP_INTERVAL 10
|
#define SLEEP_INTERVAL 10
|
||||||
|
|
||||||
|
@ -64,7 +65,10 @@ bool do_pass(APP& app) {
|
||||||
sprintf(buf, "where appid=%d and assimilate_state=%d limit 1000", app.id, ASSIMILATE_READY);
|
sprintf(buf, "where appid=%d and assimilate_state=%d limit 1000", app.id, ASSIMILATE_READY);
|
||||||
while (!wu.enumerate(buf)) {
|
while (!wu.enumerate(buf)) {
|
||||||
vector<RESULT> results; // must be inside while()!
|
vector<RESULT> results; // must be inside while()!
|
||||||
did_something = true;
|
|
||||||
|
// for testing purposes, can pretend we did nothing.
|
||||||
|
if (update_db)
|
||||||
|
did_something = true;
|
||||||
|
|
||||||
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
log_messages.printf(SCHED_MSG_LOG::DEBUG,
|
||||||
"[%s] assimilating; state=%d\n", wu.name, wu.assimilate_state
|
"[%s] assimilating; state=%d\n", wu.name, wu.assimilate_state
|
||||||
|
@ -80,17 +84,19 @@ bool do_pass(APP& app) {
|
||||||
|
|
||||||
assimilate_handler(wu, results, canonical_result);
|
assimilate_handler(wu, results, canonical_result);
|
||||||
|
|
||||||
sprintf(
|
if (did_something) {
|
||||||
buf, "assimilate_state=%d, transition_time=%d",
|
sprintf(
|
||||||
ASSIMILATE_DONE, (int)time(0)
|
buf, "assimilate_state=%d, transition_time=%d",
|
||||||
);
|
ASSIMILATE_DONE, (int)time(0)
|
||||||
retval = wu.update_field(buf);
|
);
|
||||||
if (retval) {
|
retval = wu.update_field(buf);
|
||||||
|
if (retval) {
|
||||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
|
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
|
||||||
"[%s] update failed: %d\n", wu.name, retval
|
"[%s] update failed: %d\n", wu.name, retval
|
||||||
);
|
);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (did_something) {
|
if (did_something) {
|
||||||
boinc_db.commit_transaction();
|
boinc_db.commit_transaction();
|
||||||
|
@ -115,10 +121,15 @@ int main(int argc, char** argv) {
|
||||||
log_messages.set_debug_level(atoi(argv[++i]));
|
log_messages.set_debug_level(atoi(argv[++i]));
|
||||||
} else if (!strcmp(argv[i], "-app")) {
|
} else if (!strcmp(argv[i], "-app")) {
|
||||||
strcpy(app.name, argv[++i]);
|
strcpy(app.name, argv[++i]);
|
||||||
} else if (!strcmp(argv[i], "-noinsert")) {
|
} else if (!strcmp(argv[i], "-dont_update_db")) {
|
||||||
noinsert = true;
|
// This option is for testing your assimilator. When set,
|
||||||
|
// it ensures that the assimilator does not actually modify
|
||||||
|
// the assimilate_state of the workunits, so you can run
|
||||||
|
// your assimilator over and over again without affecting
|
||||||
|
// your project.
|
||||||
|
update_db = false;
|
||||||
} else {
|
} else {
|
||||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Unrecognized arg: %s\n", argv[i]);
|
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Unrecognized arg: %s\n", argv[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue