Scheduler: only one instance of assigned jobs should be in progress

This commit is contained in:
David Anderson 2014-05-20 10:40:34 -07:00
parent ba9709cb9f
commit c05e74321f
1 changed files with 19 additions and 1 deletions

View File

@ -177,7 +177,7 @@ bool send_jobs(int assign_type) {
DB_ASSIGNMENT asg;
DB_RESULT result;
DB_WORKUNIT wu;
int retval;
int retval, n;
bool sent_something = false;
char query[256], buf[256];
@ -217,6 +217,24 @@ bool send_jobs(int assign_type) {
if (wu.canonical_resultid) continue;
if (wu.transition_time < time(0)) continue;
// don't send if an instance is currently in progress
//
sprintf(buf,
"where workunitid=%d and server_state=%d",
asg.workunitid,
RESULT_SERVER_STATE_IN_PROGRESS
);
retval = result.count(n, buf);
if (retval) {
log_messages.printf(MSG_CRITICAL,
"result.count() failed: %s\n", boincerror(retval)
);
continue;
}
if (n>0) {
continue;
}
// don't send if we already sent an instance to this host
//
sprintf(buf, "where workunitid=%d and hostid=%d",