*** empty log message ***

svn path=/trunk/boinc/; revision=6519
This commit is contained in:
David Anderson 2005-07-05 08:58:49 +00:00
parent 364edcf987
commit 06da0a6709
7 changed files with 65 additions and 40 deletions

View File

@ -8845,3 +8845,30 @@ Charlie 4 July 2005
BOINCGUIApp.cpp
doc/
mac_advanced.php
David 5 July 2005
- Always show the reason for a scheduler RPC: either
- requested by user
- results due for reporting
- fetching work
Implementation: add "reason" argument to init_op_project().
Store in SCHEDULER_OP.
This eliminates the need for must_get_work.
Remove init_return_results().
- handle RPC init errors (by backing off) in init_op_project(),
NOT in the functions that call it (e.g. init_get_work()).
We were backing off twice for the same error.
- network_query GUI RPC: return false if network suspended by user
- Manager: remove wxASSERT(fBuffer)
from CViewReousrces::FormatDiskSpace().
This causes crash if a project has zero disk usage.
?? Why is the amount of disk called "fBuffer"?
?? why is a PROJECT* called "resource"?
client/
client_state.C
cs_scheduler.C
scheduler_op.C,h
clientgui/
ViewResources.cpp

View File

@ -1315,6 +1315,7 @@ int CLIENT_STATE::version() {
bool CLIENT_STATE::want_network() {
if (http_ops->nops()) return true;
if (network_suspended) return false;
if (want_network_flag) return true;
return false;
}

View File

@ -609,7 +609,7 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
//
p = next_project_sched_rpc_pending();
if (p) {
scheduler_op->init_return_results(p);
scheduler_op->init_op_project(p, REASON_USER_REQ);
action = true;
break;
}
@ -619,7 +619,7 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
//
p = find_project_with_overdue_results();
if (p) {
scheduler_op->init_return_results(p);
scheduler_op->init_op_project(p, REASON_RESULTS_DUE);
action = true;
break;
}

View File

@ -81,39 +81,29 @@ bool SCHEDULER_OP::check_master_fetch_start() {
//
int SCHEDULER_OP::init_get_work() {
int retval;
char err_msg[256];
must_get_work = true;
PROJECT* p = gstate.next_project_need_work();
if (p) {
retval = init_op_project(p);
retval = init_op_project(p, REASON_NEED_WORK);
if (retval) {
sprintf(err_msg, "init_op_project failed, error %d\n", retval);
backoff(p, err_msg);
return retval;
}
}
return 0;
}
// report results for a particular project.
// PRECONDITION: compute_work_requests() has been called
// to fill in PROJECT::work_request
//
int SCHEDULER_OP::init_return_results(PROJECT* p) {
must_get_work = false;
return init_op_project(p);
}
// try to initiate an RPC to the given project.
// If there are multiple schedulers, start with a random one
// If there are multiple schedulers, start with a random one.
// User messages and backoff() is done at this level.
//
int SCHEDULER_OP::init_op_project(PROJECT* p) {
int SCHEDULER_OP::init_op_project(PROJECT* p, SCHEDULER_OP_REASON r) {
int retval;
char err_msg[256];
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_SCHED_OP);
reason = r;
scope_messages.printf(
"SCHEDULER_OP::init_op_project(): starting op for %s\n",
p->master_url
@ -232,6 +222,14 @@ int SCHEDULER_OP::start_rpc(PROJECT* p) {
p, MSG_INFO,
"Sending scheduler request to %s\n", scheduler_url
);
char* why;
switch (reason) {
case REASON_USER_REQ: why = "Requested by user"; break;
case REASON_NEED_WORK: why = "To fetch work"; break;
case REASON_RESULTS_DUE: why = "To report results"; break;
default: why = "Unknown";
}
msg_printf(p, MSG_INFO, "Reason: %s", why);
msg_printf(
p, MSG_INFO,
"Requesting %.0f seconds of work, returning %d results\n",
@ -489,7 +487,7 @@ bool SCHEDULER_OP::poll() {
// if we asked for work and didn't get any,
// back off this project
//
if (must_get_work && nresults==0) {
if (reason==REASON_NEED_WORK && nresults==0) {
backoff(cur_proj, "No work from project\n");
} else {
cur_proj->nrpc_failures = 0;

View File

@ -20,22 +20,29 @@
#ifndef _SCHEDULER_OP_
#define _SCHEDULER_OP_
// SCHEDULER_OP encapsulates the policy and mechanism
// for communicating with scheduling servers.
// It is implemented as a finite-state machine.
// It is active in one of two modes:
// get_work: the client wants to get work, and possibly to
// return results as a side-effect
// return_results: the client wants to return results, and possibly
// to get work as a side-effect
//
#include <vector>
#include "client_types.h"
#include "http.h"
#include "prefs.h"
// SCHEDULER_OP encapsulates the mechanism
// for fetching master files and communicating with scheduling servers.
// Only one such operation can be in progress at once:
//
#define SCHEDULER_OP_STATE_IDLE 0
// invariant: in this state, our HTTP_OP is not in the HTTP_OP_SET
#define SCHEDULER_OP_STATE_GET_MASTER 1
#define SCHEDULER_OP_STATE_RPC 2
// reasons for making a scheduler RPC:
//
typedef enum {
REASON_USER_REQ,
REASON_RESULTS_DUE,
REASON_NEED_WORK
} SCHEDULER_OP_REASON ;
// default constants related to scheduler RPC policy
#define MASTER_FETCH_PERIOD 10
@ -56,10 +63,6 @@
#define SCHED_RETRY_DELAY_MIN 60 // 1 minute
#define SCHED_RETRY_DELAY_MAX (60*60*4) // 4 hours
#define SCHEDULER_OP_STATE_IDLE 0
// invariant: in this state, our HTTP_OP is not in the HTTP_OP_SET
#define SCHEDULER_OP_STATE_GET_MASTER 1
#define SCHEDULER_OP_STATE_RPC 2
class SCHEDULER_OP {
private:
@ -68,24 +71,25 @@ private:
HTTP_OP_SET* http_ops;
PROJECT* cur_proj; // project we're currently contacting
char scheduler_url[256];
bool must_get_work; // true iff in get_work mode
//bool must_get_work; // true iff in get_work mode
int url_index; // index within project's URL list
public:
int state;
SCHEDULER_OP_REASON reason;
double url_random; // used to randomize order
public:
SCHEDULER_OP(HTTP_OP_SET*);
bool poll();
int init_get_work();
int init_return_results(PROJECT*);
int init_op_project(PROJECT*, SCHEDULER_OP_REASON);
// int init_return_results(PROJECT*);
int init_master_fetch(PROJECT*);
bool check_master_fetch_start();
void backoff(PROJECT* p, const char *error_msg);
void abort(PROJECT*);
// if we're doing an op to this project, abort it
private:
int init_op_project(PROJECT*);
int set_min_rpc_time(PROJECT*);
bool update_urls(PROJECT*, std::vector<std::string> &urls);
int start_op(PROJECT*);

View File

@ -227,8 +227,6 @@ wxInt32 CViewResources::FormatDiskSpace(wxInt32 item, wxString& strBuffer) const
fBuffer = resource->disk_usage;
}
wxASSERT(fBuffer);
if (fBuffer >= xTera) {
strBuffer.Printf(wxT("%0.2f TB"), fBuffer/xTera);
} else if (fBuffer >= xGiga) {

View File

@ -1128,9 +1128,6 @@
<File
RelativePath="..\lib\util.h">
</File>
<File
RelativePath="..\client\version.h">
</File>
<File
RelativePath="..\client\win\win_service.h">
</File>