diff --git a/checkin_notes b/checkin_notes index bc402d5f3a..1dccede6b6 100755 --- a/checkin_notes +++ b/checkin_notes @@ -20256,6 +20256,8 @@ Bruce and Reinhard 2004-11-26 under Mac OSX. Also make dist now works (make distcheck still broken). Karl, since you were the last person to fix up this mess, how about taking a look?? + - Added placeholders in sched/ for user: assimilator_placeholder.C and validator_placeholder.C. + These are built by the build system, but can be replaced by user code as desired. Makefile.am configure.ac diff --git a/sched/Makefile.am b/sched/Makefile.am index 12cf81dc3b..780a13d741 100644 --- a/sched/Makefile.am +++ b/sched/Makefile.am @@ -14,7 +14,9 @@ noinst_PROGRAMS = \ transitioner \ message_handler \ update_stats \ + assimilator_placeholder \ sample_dummy_assimilator \ + validator_placeholder \ sample_bitwise_validator \ sample_trivial_validator \ get_file \ @@ -99,9 +101,15 @@ sample_bitwise_validator_DEPENDENCIES = $(LIB_SCHED) sample_trivial_validator_SOURCES = validator.C sample_trivial_validator.C validate_util.C validate_util.h sample_trivial_validator_DEPENDENCIES = $(LIB_SCHED) +validator_placeholder_SOURCES = validator.C validator_placeholder.C validate_util.C validate_util.h +validator_placeholder_DEPENDENCIES = $(LIB_SCHED) + sample_dummy_assimilator_SOURCES = assimilator.C sample_dummy_assimilator.C sample_dummy_assimilator_DEPENDENCIES = $(LIB_SCHED) +assimilator_placeholder_SOURCES = assimilator.C assimilator_placeholder.C +assimilator_placeholder_DEPENDENCIES = $(LIB_SCHED) + db_dump_SOURCES = db_dump.C db_dump_DEPENDENCIES = $(LIB_SCHED) diff --git a/sched/assimilator_placeholder.C b/sched/assimilator_placeholder.C new file mode 100644 index 0000000000..70df9e453e --- /dev/null +++ b/sched/assimilator_placeholder.C @@ -0,0 +1,65 @@ +// This is a placeholder for you to put your project's assimilator. +// It is currently a copy of sample_dummy_assimilator.C, but you can +// replace it with your own code and then 'make' in this Directory +// will build it. + +static volatile const char *BOINCrcsid="$Id$"; + + +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// + +// A sample assimilator that only writes a log message. + +#include + +#include "boinc_db.h" +#include "sched_msgs.h" +#include "sched_util.h" +#include "assimilate_handler.h" + +using std::vector; + +void assimilate_handler( + WORKUNIT& wu, vector& results, RESULT& canonical_result +) { + SCOPE_MSG_LOG scope_messages(log_messages, SCHED_MSG_LOG::NORMAL); + scope_messages.printf("[%s] Assimilating\n", wu.name); + if (wu.canonical_resultid) { + scope_messages.printf("[%s] Found canonical result\n", wu.name); + log_messages.printf_multiline( + SCHED_MSG_LOG::DEBUG, canonical_result.xml_doc_out, + "[%s] canonical result", wu.name + ); + } else { + scope_messages.printf("[%s] No canonical result\n", wu.name); + } + if (wu.error_mask&WU_ERROR_COULDNT_SEND_RESULT) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: couldn't send a result\n", wu.name); + } + if (wu.error_mask&WU_ERROR_TOO_MANY_ERROR_RESULTS) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: too many error results\n", wu.name); + } + if (wu.error_mask&WU_ERROR_TOO_MANY_TOTAL_RESULTS) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: too many total results\n", wu.name); + } + if (wu.error_mask&WU_ERROR_TOO_MANY_SUCCESS_RESULTS) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "[%s] Error: too many success results\n", wu.name); + } +} diff --git a/sched/validator_placeholder.C b/sched/validator_placeholder.C new file mode 100644 index 0000000000..c040e29f29 --- /dev/null +++ b/sched/validator_placeholder.C @@ -0,0 +1,77 @@ +// This is a placeholder for you to put your own validator code. It +// is a copy of sample_trivial_validator, but is built by the +// Makefile. So you can substitute your own code and just type 'make' +// to build it. + +static volatile const char *BOINCrcsid="$Id$"; +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// + +// A sample validator that grants credit to any result whose CPU time is above +// a certain minimum + +#include "validate_util.h" + +using std::vector; + +static const double MIN_CPU_TIME = 0; + +int init_result_trivial(RESULT const& result, void*& data) { + return 0; +} + +int check_pair_initialized_trivial( + RESULT & r1, void* /*data1*/, + RESULT const& r2, void* /*data2*/, + bool& match +) { + match = (r1.cpu_time >= MIN_CPU_TIME && r2.cpu_time >= MIN_CPU_TIME); + return 0; +} + +int cleanup_result_trivial(RESULT const&, void*) { + return 0; +} + +int check_set( + vector& results, WORKUNIT&, int& canonicalid, double& credit, + bool& retry +) { + retry = false; + return generic_check_set( + results, canonicalid, credit, + init_result_trivial, + check_pair_initialized_trivial, + cleanup_result_trivial, + 1 + ); +} + +int check_pair(RESULT & r1, RESULT const& r2, bool& retry) { + bool match; + retry = false; + int retval = check_pair_initialized_trivial( + r1, NULL, + r2, NULL, + match + ); + r1.validate_state = match?VALIDATE_STATE_VALID:VALIDATE_STATE_INVALID; + return retval; +} +