diff --git a/sched/Makefile.am b/sched/Makefile.am index 30bb9be816..1928d448d4 100644 --- a/sched/Makefile.am +++ b/sched/Makefile.am @@ -119,6 +119,7 @@ schedshare_PROGRAMS = \ size_regulator \ transitioner \ trickle_credit \ + trickle_deadline \ trickle_echo \ update_stats @@ -250,6 +251,9 @@ db_purge_LDADD = $(SERVERLIBS) trickle_credit_SOURCES = trickle_credit.cpp trickle_handler.cpp trickle_credit_LDADD = $(SERVERLIBS) +trickle_deadline_SOURCES = trickle_deadline.cpp trickle_handler.cpp +trickle_deadline_LDADD = $(SERVERLIBS) + trickle_echo_SOURCES = trickle_echo.cpp trickle_handler.cpp trickle_echo_LDADD = $(SERVERLIBS) diff --git a/sched/trickle_deadline.cpp b/sched/trickle_deadline.cpp new file mode 100644 index 0000000000..7adcb50eb0 --- /dev/null +++ b/sched/trickle_deadline.cpp @@ -0,0 +1,125 @@ +// 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 . + +// The following is a deadline trickle handler. +// It extends the deadline of the task_id the app sends us. + +// A trickle handler that grants credit based on run time +// +// message format: +// +// x +// x +// +// Required cmdline arg: +// +// --extension_period X add X seconds to the current deadline +// --extension_timeframe X extend only if deadline is within the next X secs +// + +#include "util.h" +#include "sched_msgs.h" +#include "trickle_handler.h" + +double extension_period = 0; +double extension_timeframe = 0; + +int handle_trickle_init(int argc, char** argv) { + for (int i=1; i dtime()) { + log_messages.printf(MSG_DEBUG, + "Report deadline is too far in the future: %d\n", + task.report_deadline + ); + // don't do anything + return 0; + } + // extend the deadline + // + task.report_deadline += extension_period; + retval = task.update(); + if (retval) return retval; + log_messages.printf(MSG_DEBUG, + "Report deadline of result %d extended to %d\n", + task.id, task.report_deadline + ); + return 0; +}