From bd245ca0556e8353d285a07f1eb65ad65eafb89b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 23 May 2006 06:46:19 +0000 Subject: [PATCH] next RPC delay svn path=/trunk/boinc/; revision=10186 --- apps/wrapper.C | 6 ++++++ checkin_notes | 12 ++++++++++- client/client_types.C | 5 +++++ client/client_types.h | 46 +++++++++++++++++++++++-------------------- client/cs_scheduler.C | 11 ++++++++++- client/scheduler_op.C | 2 ++ client/scheduler_op.h | 1 + doc/index.php | 2 +- 8 files changed, 61 insertions(+), 24 deletions(-) diff --git a/apps/wrapper.C b/apps/wrapper.C index e2e6df94fc..5fc3c856a7 100644 --- a/apps/wrapper.C +++ b/apps/wrapper.C @@ -26,6 +26,12 @@ // - reporting CPU time // - loss of heartbeat from core client // +// Does NOT handle: +// - checkpointing +// If your app does checkpointing, +// and there's some way to figure out when it's done it, +// this program could be modified to report to the core client. +// // Takes an input file "job.xml" of the form // // NAME diff --git a/checkin_notes b/checkin_notes index 6656659d0b..c0c8e1e860 100755 --- a/checkin_notes +++ b/checkin_notes @@ -4955,7 +4955,7 @@ Rom 22 May 2006 lib/ diagnostics_win.C -David 23 May 2006 +David 22 May 2006 - core client: fix logic error involving the "5 minutes of network after GUI RPC" thing. @@ -4973,3 +4973,13 @@ Bruce 23 May 2006 sched/ transitioner.C +David 22 May 2006 + - Client: handle "" element in scheduler reply. + This tells the client to do another scheduler RPC after X seconds. + + apps/ + wrapper.C + client/ + client_types.C,h + cs_scheduler.C + scheduler_op.C,h diff --git a/client/client_types.C b/client/client_types.C index 03efff2589..72b47f4e6c 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -81,6 +81,7 @@ void PROJECT::init() { min_rpc_time = 0; master_url_fetch_pending = false; sched_rpc_pending = false; + next_rpc_time = 0; trickle_up_pending = false; tentative = false; anonymous_platform = false; @@ -162,6 +163,7 @@ int PROJECT::parse_state(MIOFILE& in) { } else if (match_tag(buf, "")) master_url_fetch_pending = true; else if (match_tag(buf, "")) sched_rpc_pending = true; + else if (parse_double(buf, "", next_rpc_time)) continue; else if (match_tag(buf, "")) trickle_up_pending = true; else if (match_tag(buf, "")) send_file_list = true; else if (match_tag(buf, "")) non_cpu_intensive = true; @@ -212,6 +214,7 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) { " %d\n" " %d\n" " %f\n" + " %f\n" " %f\n" " %f\n" " %f\n" @@ -235,6 +238,7 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) { nrpc_failures, master_fetch_failures, min_rpc_time, + next_rpc_time, short_term_debt, long_term_debt, resource_share, @@ -295,6 +299,7 @@ void PROJECT::copy_state_fields(PROJECT& p) { nrpc_failures = p.nrpc_failures; master_fetch_failures = p.master_fetch_failures; min_rpc_time = p.min_rpc_time; + next_rpc_time = p.next_rpc_time; master_url_fetch_pending = p.master_url_fetch_pending; sched_rpc_pending = p.sched_rpc_pending; trickle_up_pending = p.trickle_up_pending; diff --git a/client/client_types.h b/client/client_types.h index 8a67abe864..2bf01be21f 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -181,29 +181,41 @@ public: std::vector scheduler_urls; // where to find scheduling servers char project_name[256]; // descriptive. not unique - char symstore[256]; + char symstore[256]; // URL of symbol server (Windows) char user_name[256]; char team_name[256]; char email_hash[MD5_LEN]; char cross_project_id[MD5_LEN]; - double user_total_credit; // as reported by server - double user_expavg_credit; // as reported by server - double user_create_time; // as reported by server - int rpc_seqno; + double user_total_credit; + double user_expavg_credit; + double user_create_time; int hostid; - double host_total_credit; // as reported by server - double host_expavg_credit; // as reported by server - double host_create_time; // as reported by server + double host_total_credit; + double host_expavg_credit; + double host_create_time; + + // stuff related to scheduler RPCs and master fetch + // + int rpc_seqno; int nrpc_failures; // # of consecutive times we've failed to // contact all scheduling servers int master_fetch_failures; double min_rpc_time; // earliest time to contact any server - // of this project (or zero) + // of this project (or zero) + void set_min_rpc_time(double future_time); + bool waiting_until_min_rpc_time(); + // returns true if min_rpc_time > now bool master_url_fetch_pending; // need to fetch and parse the master URL - bool sched_rpc_pending; // contact scheduling server for preferences + bool sched_rpc_pending; + // we need to do a scheduler RPC, for various possible reasons: + // user request, propagate host CPID, time-based, etc + double next_rpc_time; + // if nonzero, specifies a time when another scheduler RPC + // should be done (as requested by server) bool trickle_up_pending; // have trickle up to send bool tentative; // master URL and account ID not confirmed + bool anonymous_platform; // app_versions.xml file found in project dir; // use those apps rather then getting from server bool non_cpu_intensive; @@ -212,9 +224,9 @@ public: // in the next scheduler reply bool suspended_via_gui; bool dont_request_more_work; - // set the project to only return work and not request more - // for a clean exit to a project, or if a user wants to - // pause doing work for the project + // Return work, but don't request more + // Used for a clean exit to a project, + // or if a user wants to pause doing work for the project bool attached_via_acct_mgr; char code_sign_key[MAX_KEY_LEN]; std::vector user_files; @@ -318,14 +330,6 @@ public: int parse_state(MIOFILE&); int write_state(MIOFILE&, bool gui_rpc=false); void attach_failed(int reason); -#if 0 - bool associate_file(FILE_INFO*); -#endif - - // set min_rpc_time and have_reported_min_rpc_time - void set_min_rpc_time(double future_time); - // returns true if min_rpc_time > now; may print a message - bool waiting_until_min_rpc_time(); // statistic of the last x days std::vector statistics; diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index f54756d884..392f1c2cf0 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -89,7 +89,6 @@ void PROJECT::set_min_rpc_time(double future_time) { } // Return true iff we should not contact the project yet. -// Print a message to the user if we haven't recently // bool PROJECT::waiting_until_min_rpc_time() { return (min_rpc_time > gstate.now); @@ -122,6 +121,10 @@ PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() { for (i=0; iwaiting_until_min_rpc_time()) continue; + if (p->next_rpc_time && p->next_rpc_timesched_rpc_pending = true; + p->next_rpc_time = 0; + } //if (p->suspended_via_gui) continue; // do the RPC even if suspended. // This is critical for acct mgrs, to propagate new host CPIDs @@ -1092,6 +1095,12 @@ int CLIENT_STATE::handle_scheduler_reply( project->min_rpc_time = 0; } + if (sr.next_rpc_delay) { + project->next_rpc_time = gstate.now + sr.next_rpc_delay; + } else { + project->next_rpc_time = 0; + } + // The project returns a hostid only if it has created a new host record. // In that case reset RPC seqno // diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 927c82efc2..e7e5a854a7 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -567,6 +567,7 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) { hostid = 0; request_delay = 0; + next_rpc_delay = 0; global_prefs_xml = 0; project_prefs_xml = 0; strcpy(host_venue, ""); @@ -637,6 +638,7 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) { else if (parse_str(buf, "", host_venue, sizeof(host_venue))) continue; else if (parse_double(buf, "", project->host_create_time)) continue; else if (parse_double(buf, "", request_delay)) continue; + else if (parse_double(buf, "", next_rpc_delay)) continue; else if (match_tag(buf, "")) { retval = dup_element_contents( in, diff --git a/client/scheduler_op.h b/client/scheduler_op.h index 7c0241dbe6..75a53fe123 100644 --- a/client/scheduler_op.h +++ b/client/scheduler_op.h @@ -103,6 +103,7 @@ struct USER_MESSAGE { struct SCHEDULER_REPLY { int hostid; double request_delay; + double next_rpc_delay; std::vector messages; char* global_prefs_xml; // not including tags; diff --git a/doc/index.php b/doc/index.php index d1a0ad8c41..0d96fcb0ad 100644 --- a/doc/index.php +++ b/doc/index.php @@ -139,7 +139,7 @@ echo " "; shuffle($projects); foreach ($projects as $p) { - echo "
  • Home: $p[2]
    Area: $p[3]
    Goal: $p[4]')\">$p[0]
    + echo "
  • Home: $p[2]
    Area: $p[3]
    Goal: $p[4]')\">$p[0]
    "; } echo "