*** empty log message ***

svn path=/trunk/boinc/; revision=6299
This commit is contained in:
David Anderson 2005-06-07 21:46:11 +00:00
parent c0588cba00
commit 24ebadef4c
9 changed files with 54 additions and 35 deletions

View File

@ -7488,3 +7488,19 @@ David 7 June 2005
client_types.C,h
cs_scheduler.C
scheduler_op.C,h
David 7 June 2005
- code cleanup: use new functions (like RESULT::runnable() etc.)
instead of inspecting member variables (like suspended_via_gui)
- Added RESULT::runnable_soon(): true iff result is
downloading or runnable, not suspended, project not suspended
- fix bug in Rom's last checkin (Rom, please verify)
client/
client_types.C,h
cs_apps.C
cs_scheduler.C
scheduler_op.C
lib/
msg_log.C
network.C,h

View File

@ -418,7 +418,7 @@ bool PROJECT::downloading() {
for (unsigned int i=0; i<gstate.results.size(); i++) {
RESULT* rp = gstate.results[i];
if (rp->project != this) continue;
if (rp->state = RESULT_FILES_DOWNLOADING) return true;
if (rp->state == RESULT_FILES_DOWNLOADING) return true;
}
return false;
}
@ -1430,6 +1430,13 @@ bool RESULT::runnable() {
return true;
}
bool RESULT::runnable_soon() {
if (suspended_via_gui) return false;
if (project->suspended_via_gui) return false;
if (computing_done()) return false;
return true;
}
FILE_REF* RESULT::lookup_file(FILE_INFO* fip) {
for (unsigned int i=0; i<output_files.size(); i++) {
FILE_REF& fr = output_files[i];

View File

@ -407,6 +407,9 @@ struct RESULT {
bool computing_done();
bool runnable();
// downloaded, not finished, not suspended, project not suspended
bool runnable_soon();
// downloading or downloaded,
// not finished, suspended, project not suspended
};
#endif

View File

@ -254,12 +254,12 @@ void CLIENT_STATE::assign_results_to_projects() {
//
for (i=0; i<active_tasks.active_tasks.size(); ++i) {
ACTIVE_TASK *atp = active_tasks.active_tasks[i];
if (atp->result->suspended_via_gui) continue;
if (atp->result->already_selected) continue;
project = atp->wup->project;
if (project->suspended_via_gui) continue;
rp = atp->result;
if (rp->already_selected) continue;
if (!rp->runnable()) continue;
project = rp->project;
if (!project->next_runnable_result) {
project->next_runnable_result = atp->result;
project->next_runnable_result = rp;
continue;
}
@ -283,15 +283,13 @@ void CLIENT_STATE::assign_results_to_projects() {
//
for (i=0; i<results.size(); i++) {
rp = results[i];
if (rp->already_selected) continue;
if (lookup_active_task_by_result(rp)) continue;
if (!rp->runnable()) continue;
project = rp->project;
if (project->suspended_via_gui) continue;
if (project->next_runnable_result) continue;
if (rp->already_selected) continue;
if (rp->suspended_via_gui) continue;
if (rp->state != RESULT_FILES_DOWNLOADED) continue;
if (lookup_active_task_by_result(rp)) continue;
project->next_runnable_result = rp;
}
@ -360,18 +358,15 @@ bool CLIENT_STATE::schedule_earliest_deadline_result(double expected_pay_off) {
unsigned int i;
for (i=0; i < results.size(); ++i) {
RESULT *r = results[i];
if (r->state != RESULT_FILES_DOWNLOADED) continue;
if (r->suspended_via_gui) continue;
if (r->project->suspended_via_gui) continue;
if (r->project->non_cpu_intensive) continue;
if (r->already_selected) continue;
if (r->suspended_via_gui) continue;
if (first || r->report_deadline < earliest_deadline) {
RESULT *rp = results[i];
if (!rp->runnable()) continue;
if (rp->project->non_cpu_intensive) continue;
if (rp->already_selected) continue;
if (first || rp->report_deadline < earliest_deadline) {
first = false;
best_project = r->project;
best_result = r;
earliest_deadline = r->report_deadline;
best_project = rp->project;
best_result = rp;
earliest_deadline = rp->report_deadline;
}
}
if (!best_result) return false;

View File

@ -146,7 +146,6 @@ PROJECT* CLIENT_STATE::next_project_need_work() {
PROJECT *p, *p_prospect = NULL;
double work_on_prospect=0;
unsigned int i;
bool cpu_idle = no_work_for_a_cpu();
for (i=0; i<projects.size(); ++i) {
p = projects[i];
@ -969,10 +968,7 @@ bool CLIENT_STATE::no_work_for_a_cpu() {
for (i=0; i< results.size(); i++){
RESULT* rp = results[i];
if (rp->project->non_cpu_intensive ) continue;
if (rp->computing_done()) continue;
if (rp->suspended_via_gui) continue;
if (rp->project->suspended_via_gui) continue;
if (!rp->runnable_soon()) continue;
count++;
}
return ncpus > count;

View File

@ -451,11 +451,13 @@ bool SCHEDULER_OP::poll() {
//
while (1) {
url_index++;
if (url_index == cur_proj->scheduler_urls.size()) break;
if (url_index == (int)cur_proj->scheduler_urls.size()) {
break;
}
retval = start_rpc(cur_proj);
if (!retval) return true;
}
if (url_index == cur_proj->scheduler_urls.size()) {
if (url_index == (int) cur_proj->scheduler_urls.size()) {
backoff(cur_proj, "No schedulers responded");
scheduler_op_done = true;
}

View File

@ -75,10 +75,10 @@ MSG_LOG::MSG_LOG(FILE* output_) {
void MSG_LOG::enter_level(int diff) {
assert (indent_level >= 0);
if (enter_level <= 0 ) enter_level = 0;
if ((enter_level + diff) <= 0) return;
if (enter_level >= 39 ) enter_level = 39;
if ((enter_level + diff) >= 39) return;
if (indent_level <= 0 ) indent_level = 0;
if ((indent_level + diff) <= 0) return;
if (indent_level >= 39 ) indent_level = 39;
if ((indent_level + diff) >= 39) return;
spaces[indent_level] = ' ';
indent_level += diff*2;

View File

@ -34,7 +34,7 @@
#include "error_numbers.h"
#include "network.h"
char* socket_error_str() {
const char* socket_error_str() {
static char buf[80];
#ifdef _WIN32
int e = WSAGetLastError();

View File

@ -24,7 +24,7 @@ extern int boinc_socket(int& sock);
extern int boinc_socket_asynch(int sock, bool asynch);
extern void boinc_close_socket(int sock);
extern int get_socket_error(int fd);
extern char* socket_error_str();
extern const char* socket_error_str();
#if defined(_WIN32)
typedef int boinc_socklen_t;