From dd004404a1458119a98bc5b07ad68b0a8141544c Mon Sep 17 00:00:00 2001 From: Christian Beer Date: Tue, 13 Oct 2015 16:39:04 +0200 Subject: [PATCH] Daemons: add usage function to project specific handler Projects that have there own assimilator need to implement the assimilate_handler_usage() function and should printf() a description of those custom options. For examples see sample_assimilator.cpp or script_assimilator.cpp --- sched/assimilate_handler.h | 1 + sched/assimilator.cpp | 1 + sched/sample_assimilator.cpp | 8 ++++++++ sched/sample_dummy_assimilator.cpp | 8 ++++++++ sched/script_assimilator.cpp | 9 +++++++++ sched/single_job_assimilator.cpp | 8 ++++++++ 6 files changed, 35 insertions(+) diff --git a/sched/assimilate_handler.h b/sched/assimilate_handler.h index 56a15cde12..7286c86145 100644 --- a/sched/assimilate_handler.h +++ b/sched/assimilate_handler.h @@ -35,3 +35,4 @@ extern int assimilate_handler( ); 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 b98db705da..5822be8ee8 100644 --- a/sched/assimilator.cpp +++ b/sched/assimilator.cpp @@ -72,6 +72,7 @@ void usage(char* name) { " [-v | --version] Show version information\n", name ); + assimilate_handler_usage(); } // assimilate all WUs that need it diff --git a/sched/sample_assimilator.cpp b/sched/sample_assimilator.cpp index 67d4240d32..f3ac3652a9 100644 --- a/sched/sample_assimilator.cpp +++ b/sched/sample_assimilator.cpp @@ -50,6 +50,14 @@ int assimilate_handler_init(int argc, char** argv) { 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/sample_dummy_assimilator.cpp b/sched/sample_dummy_assimilator.cpp index 72491f3134..02014ead21 100644 --- a/sched/sample_dummy_assimilator.cpp +++ b/sched/sample_dummy_assimilator.cpp @@ -36,6 +36,14 @@ int assimilate_handler_init(int argc, char** argv) { 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 91f55ac620..bd7083196c 100644 --- a/sched/script_assimilator.cpp +++ b/sched/script_assimilator.cpp @@ -77,6 +77,15 @@ int assimilate_handler_init(int argc, char** argv) { return 0; } +void assimilate_handler_usage() { + // describe the project specific arguments here + fprintf(stderr, + " custom options:\n" + " --script \"X\" call script to assimilate job\n" + " see comment in script_assimilator.cpp for details\n" + ); +} + int assimilate_handler( WORKUNIT& wu, vector& /*results*/, RESULT& canonical_result ) { diff --git a/sched/single_job_assimilator.cpp b/sched/single_job_assimilator.cpp index 198799bbe9..7959159672 100644 --- a/sched/single_job_assimilator.cpp +++ b/sched/single_job_assimilator.cpp @@ -44,6 +44,14 @@ int assimilate_handler_init(int argc, char** argv) { 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 ) {