From c05e74321ff3b674a8f07258f0b4bef6cc486e21 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 20 May 2014 10:40:34 -0700 Subject: [PATCH] Scheduler: only one instance of assigned jobs should be in progress --- sched/sched_assign.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sched/sched_assign.cpp b/sched/sched_assign.cpp index 894ddfec91..c2ea636bad 100644 --- a/sched/sched_assign.cpp +++ b/sched/sched_assign.cpp @@ -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",