From 7baddb24e357aee29ee4f1b4d4ea0b58d2b880e2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 7 Dec 2010 19:28:08 +0000 Subject: [PATCH] - Fix bugs in Rappture wrapper - Add README file and templates for Rappture wrapper - create_work: create defaults for --wu_name, --wu_template, --result_template - user web: fix typo on workunit.php svn path=/trunk/boinc/; revision=22826 --- checkin_notes | 17 +++++++++++ doc/projects.inc | 4 +-- html/user/style2.css | 2 -- html/user/workunit.php | 2 +- samples/wrappture/README | 52 +++++++++++++++++++++++++++++++++ samples/wrappture/fermi_in | 13 +++++++++ samples/wrappture/fermi_out | 14 +++++++++ samples/wrappture/wrappture.cpp | 9 +++++- tools/create_work.cpp | 31 ++++++++++++-------- 9 files changed, 126 insertions(+), 18 deletions(-) create mode 100644 samples/wrappture/README create mode 100644 samples/wrappture/fermi_in create mode 100644 samples/wrappture/fermi_out diff --git a/checkin_notes b/checkin_notes index ab19df66db..289cf58f45 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8638,3 +8638,20 @@ Bernd 7 Dec 2010 api/ boinc_api.cpp + +David 7 Dec 2010 + - Fix bugs in Rappture wrapper + - Add README file and templates for Rappture wrapper + - create_work: create defaults for --wu_name, --wu_template, --result_template + - user web: fix typo on workunit.php + + tools/ + create_work.cpp + html/user/ + workunit.php + style2.css + samples/wrappture/ + fermi_in (new) + fermi_out (new) + wrappture.cpp + README (new) diff --git a/doc/projects.inc b/doc/projects.inc index 3d466ee55f..79c26c16a0 100644 --- a/doc/projects.inc +++ b/doc/projects.inc @@ -106,8 +106,8 @@ $biomed = array( ), array( "SIMAP", - "http://boinc.bio.wzw.tum.de/boincsimap/", - "Technical University of Munich", + "http://www.boincsimap.org/boincsimap/", + "University of Vienna", "Biology", "Calculate similarities between proteins. SIMAP provides a public database of the resulting data, which plays a key role in many bioinformatics research projects.", "simaplogo.jpg" diff --git a/html/user/style2.css b/html/user/style2.css index 631db682e7..4ee20a87e7 100644 --- a/html/user/style2.css +++ b/html/user/style2.css @@ -144,12 +144,10 @@ a.navbar:hover { } tr.row1 { - text-align: left; } tr.row0 td { background-color: #eeeeee; - text-align: left; } tr.row0 td.postheader { diff --git a/html/user/workunit.php b/html/user/workunit.php index d97840cf8d..c255f111b7 100644 --- a/html/user/workunit.php +++ b/html/user/workunit.php @@ -48,7 +48,7 @@ if ($wu->canonical_resultid) { // don't show anything more // (so that bad guys can't tell if they have an unreplicated job) -if ($app->target_nresults>0 && !$wu->canonical_resultid && !wu->error_mask) { +if ($app->target_nresults>0 && !$wu->canonical_resultid && !$wu->error_mask) { row2(tra("Tasks in progress"), tra("suppressed pending completion")); end_table(); } else { diff --git a/samples/wrappture/README b/samples/wrappture/README new file mode 100644 index 0000000000..a599b3d5b7 --- /dev/null +++ b/samples/wrappture/README @@ -0,0 +1,52 @@ +Example of running a Rappture app under BOINC + +-------------------------- +Creating app versions + +A Rappture app version has at minimum two files: + +- The core application +- A wrapper that parses the XML parameter file, + runs the core application with appropriate cmdline, + parses its stdout for progress messages, + and interfaces with the BOINC client. + +In this directory, fermi.cpp is the core app. +The wrapper consists of two files: + - wrappture_example.cpp (app-specific) + - wrappture.cpp (app-independent) + +Suppose you want to deploy this app for 64-bit Linux. +Suppose the app name is "fermi". + +- compile the programs on a 64-bit Linux machine. + producing executables "fermi" and "wrappture_example" +- in your project's apps/fermi directory, create a directory + fermi_1.0_x86_64-pc-linux-gnu + (the "1.0" is a version number) +- Into this directory, copy + wrappture_example as fermi_1.0_x86_64-pc-linux-gnu + fermi as fermi=fermi-core_1.0_x86_64-pc-linux-gnu +- run update_versions. + +-------------------------- +Submitting jobs + +- create input and output templates in your project/templates + fermi_in: 1 file, logical name "driver.xml" + fermi_out: 1 file, logical name "fermi_out.dat" + (you can copy the ones here) +- copy driver.xml to project/driver_1.xml + (the "1" is a version number) +- copy cw_fermi to project/ + (this is a job-submission script) +- in project/, run cw_fermi + +-------------------------- +Notes + +- wrappture_example links libexpat and libz (among others) dynamically, + so it won't run on systems that don't have them. + It would be better to link everything statically, + i.e. linking libexpat.a rather libexpat.so. + You may need to download or build the .a versions. diff --git a/samples/wrappture/fermi_in b/samples/wrappture/fermi_in new file mode 100644 index 0000000000..cd94299573 --- /dev/null +++ b/samples/wrappture/fermi_in @@ -0,0 +1,13 @@ + + 0 + + + + 0 + driver.xml + + 1 + 1 + 446797000000000 + 279248000000000 + diff --git a/samples/wrappture/fermi_out b/samples/wrappture/fermi_out new file mode 100644 index 0000000000..ed4f2b9f13 --- /dev/null +++ b/samples/wrappture/fermi_out @@ -0,0 +1,14 @@ + + + + + 5000000 + + + + + + fermi_out.dat + + + diff --git a/samples/wrappture/wrappture.cpp b/samples/wrappture/wrappture.cpp index fa928e6556..0418c862fe 100644 --- a/samples/wrappture/wrappture.cpp +++ b/samples/wrappture/wrappture.cpp @@ -413,11 +413,18 @@ static void block_sigalrm() { pthread_sigmask(SIG_BLOCK, &mask, NULL); } +// we create a thread to parse the stdout from the worker app +// static void* parse_app_stdout(void*) { block_sigalrm(); #endif char buf[1024]; - FILE* f = boinc_fopen("rappture_stdout.txt", "r"); + FILE* f; + while (1) { + f = boinc_fopen("rappture_stdout.txt", "r"); + if (f) break; + boinc_sleep(1.); + } while (1) { if (fgets(buf, sizeof(buf), f)) { diff --git a/tools/create_work.cpp b/tools/create_work.cpp index 69e9dbaba1..bce5584857 100644 --- a/tools/create_work.cpp +++ b/tools/create_work.cpp @@ -23,9 +23,14 @@ // // create_work // --appname name -// --wu_name name -// --wu_template filename relative to project root; usually in templates/ -// --result_template filename relative to project root; usually in templates/ +// [ --wu_name name ] +// // default: generate a name based on app name +// [ --wu_template filename ] +// relative to project root; usually in templates/ +// default: appname_in +// [ --result_template filename ] +// relative to project root; usually in templates/ +// default: appname_out // [ --config_dir path ] // [ --batch n ] // the following can be supplied in WU template; see defaults below @@ -57,11 +62,12 @@ #include #include -#include "boinc_db.h" -#include "crypt.h" #include "backend_lib.h" +#include "boinc_db.h" #include "common_defs.h" +#include "crypt.h" #include "sched_config.h" +#include "util.h" bool arg(const char** argv, int i, const char* name) { char buf[256]; @@ -90,6 +96,7 @@ int main(int argc, const char** argv) { int assign_id = 0; int assign_type = ASSIGN_NONE; + strcpy(wu_template_file, ""); strcpy(result_template_file, ""); strcpy(app.name, ""); strcpy(db_passwd, ""); @@ -202,16 +209,14 @@ int main(int argc, const char** argv) { exit(1); } if (!strlen(wu.name)) { - fprintf(stderr, "create_work: missing --wu_name\n"); - exit(1); + sprintf(wu.name, "%s_%d_%f", app.name, getpid(), dtime()); + printf("workunit name: %s\n", wu.name); } if (!strlen(wu_template_file)) { - fprintf(stderr, "create_work: missing --wu_template\n"); - exit(1); + sprintf(wu_template_file, "templates/%s_in", app.name); } if (!strlen(result_template_file)) { - fprintf(stderr, "create_work: missing --result_template\n"); - exit(1); + sprintf(result_template_file, "templates/%s_out", app.name); } if (assign_flag) { @@ -248,7 +253,9 @@ int main(int argc, const char** argv) { retval = read_filename(wu_template_file, wu_template, sizeof(wu_template)); if (retval) { - fprintf(stderr, "create_work: can't open WU template: %d\n", retval); + fprintf(stderr, + "create_work: can't open input template %s\n", wu_template_file + ); exit(1); }