diff --git a/sched/assimilate_handler.h b/sched/assimilate_handler.h index ab602369d3..7286c86145 100644 --- a/sched/assimilate_handler.h +++ b/sched/assimilate_handler.h @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2015 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 @@ -34,7 +34,5 @@ extern int assimilate_handler( RESULT& // the canonical instance ); -extern int g_argc; -extern char** g_argv; -extern char* results_prefix; -extern char* transcripts_prefix; +extern int assimilate_handler_init(int argc, char** argv); +extern void assimilate_handler_usage(); diff --git a/sched/assimilator.cpp b/sched/assimilator.cpp index 7f0783cee9..5e30c7b5ae 100644 --- a/sched/assimilator.cpp +++ b/sched/assimilator.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2014 University of California +// Copyright (C) 2015 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 @@ -46,16 +46,11 @@ using std::vector; #define SLEEP_INTERVAL 10 bool update_db = true; -bool noinsert = false; int wu_id_modulus=0, wu_id_remainder=0; int sleep_interval = SLEEP_INTERVAL; int one_pass_N_WU=0; -int g_argc; -char** g_argv; -char* results_prefix = NULL; -char* transcripts_prefix = NULL; -void usage(char** argv) { +void usage(char* name) { fprintf(stderr, "This program is an 'assimilator'; it handles completed jobs.\n" "Normally it is run as a daemon from config.xml.\n" @@ -70,13 +65,13 @@ void usage(char** argv) { " [--one_pass] Do one DB enumeration, then exit\n" " [--one_pass_N_WU N] Process at most N jobs\n" " [-d | --debug_level N] Set verbosity level (1 to 4)\n" - " [--dont_update_db] Don't update DB (for testing)\n" - " [--noinsert] Don't insert records in app-specific DB\n" + " [--dont_update_db] Don't update BOINC DB (for testing)\n" " [-h | --help] Show this\n" - " [-v | --version] Show version information\n", - argv[0] + " [-v | --version] Show version information\n" + "\n", + name ); - exit(0); + assimilate_handler_usage(); } // assimilate all WUs that need it @@ -100,7 +95,7 @@ bool do_pass(APP& app) { } sprintf(buf, - "where appid=%lu and assimilate_state=%d %s limit %d", + "where appid=%ld and assimilate_state=%d %s limit %d", app.id, ASSIMILATE_READY, mod_clause, one_pass_N_WU ? one_pass_N_WU : 1000 ); @@ -127,7 +122,7 @@ bool do_pass(APP& app) { "[%s] assimilating WU %lu; state=%d\n", wu.name, wu.id, wu.assimilate_state ); - sprintf(buf, "where workunitid=%lu", wu.id); + sprintf(buf, "where workunitid=%ld", wu.id); canonical_result.clear(); bool found = false; while (1) { @@ -206,6 +201,13 @@ bool do_pass(APP& app) { return did_something; } +void missing_argument(char* name, char* arg) { + log_messages.printf(MSG_CRITICAL, + "%s requires an argument\n\n", arg + ); + usage(name); +} + int main(int argc, char** argv) { int retval; bool one_pass = false; @@ -215,22 +217,38 @@ int main(int argc, char** argv) { strcpy(app.name, ""); check_stop_daemons(); - g_argc = argc; - g_argv = argv; + + int j=1; for (i=1; i& /*results*/, RESULT& canonical_result ) { diff --git a/sched/sample_dummy_assimilator.cpp b/sched/sample_dummy_assimilator.cpp index 258bd2f642..c2e9a5ea49 100644 --- a/sched/sample_dummy_assimilator.cpp +++ b/sched/sample_dummy_assimilator.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2015 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 @@ -31,6 +31,19 @@ using std::vector; using std::string; +int assimilate_handler_init(int argc, char** argv) { + // handle project specific arguments here + return 0; +} + +void assimilate_handler_usage() { + // describe the project specific arguments here + //fprintf(stderr, + // " Custom options:\n" + // " [--project_option X] a project specific option\n" + //); +} + int assimilate_handler( WORKUNIT& wu, vector& /*results*/, RESULT& canonical_result ) { diff --git a/sched/script_assimilator.cpp b/sched/script_assimilator.cpp index eb02e62143..f41783f884 100644 --- a/sched/script_assimilator.cpp +++ b/sched/script_assimilator.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2014 University of California +// Copyright (C) 2015 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 @@ -47,6 +47,7 @@ #include "boinc_db.h" #include "error_numbers.h" #include "sched_msgs.h" +#include "sched_util.h" #include "validate_util.h" #include "validator.h" #include "sched_config.h" @@ -54,13 +55,13 @@ using std::vector; using std::string; -bool first = true; vector script; -void parse_cmdline() { - for (int i=1; i paths; diff --git a/sched/single_job_assimilator.cpp b/sched/single_job_assimilator.cpp index 55caa05392..f530547532 100644 --- a/sched/single_job_assimilator.cpp +++ b/sched/single_job_assimilator.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2015 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 @@ -39,6 +39,19 @@ using std::vector; using std::string; +int assimilate_handler_init(int argc, char** argv) { + // handle project specific arguments here + return 0; +} + +void assimilate_handler_usage() { + // describe the project specific arguments here + //fprintf(stderr, + // " Custom options:\n" + // " [--project_option X] a project specific option\n" + //); +} + int assimilate_handler( WORKUNIT& wu, vector& /*results*/, RESULT& canonical_result ) {