- client: allow suspension of non-CPU-intensive project or app

(undoes checkin of 25 Jan 2005; I don't remember why we
    made that change.  Next time put in checkin notes!)
- client: Linux: show error msg if can't open /proc/cpuinfo
    or /proc/meminfo; set memory size of 1 GB in latter case.
    Remove duplicate code that read /proc/meminfo
- 'start' script; handle <disabled>0</disable> in tasks and daemon
    elements of config.xml (can't handle <disable/>, however).
    
client/
    gui_rpc_server_ops.C
    hostinfo_unix.C
sched/
    feeder.C
    start

svn path=/trunk/boinc/; revision=12807
This commit is contained in:
David Anderson 2007-06-03 19:37:45 +00:00
parent 594da3cc4c
commit 610d4cfa77
6 changed files with 49 additions and 42 deletions

View File

@ -5689,3 +5689,20 @@ David 1 June 2007
client/
client_state.C
net_stats.C
David 3 June 2007
- client: allow suspension of non-CPU-intensive project or app
(undoes checkin of 25 Jan 2005; I don't remember why we
made that change. Next time put in checkin notes!)
- client: Linux: show error msg if can't open /proc/cpuinfo
or /proc/meminfo; set memory size of 1 GB in latter case.
Remove duplicate code that read /proc/meminfo
- 'start' script; handle <disabled>0</disable> in tasks and daemon
elements of config.xml (can't handle <disable/>, however).
client/
gui_rpc_server_ops.C
hostinfo_unix.C
sched/
feeder.C
start

View File

@ -236,14 +236,10 @@ static void handle_project_op(char* buf, MIOFILE& fout, const char* op) {
gstate.request_work_fetch("project reset by user");
gstate.reset_project(p); // writes state file
} else if (!strcmp(op, "suspend")) {
if (p->non_cpu_intensive) {
msg_printf(p, MSG_USER_ERROR, "Can't suspend non-CPU-intensive project");
} else {
p->suspended_via_gui = true;
gstate.request_schedule_cpus("project suspended by user");
gstate.request_work_fetch("project suspended by user");
gstate.set_client_state_dirty("Project suspended by user");
}
p->suspended_via_gui = true;
gstate.request_schedule_cpus("project suspended by user");
gstate.request_work_fetch("project suspended by user");
gstate.set_client_state_dirty("Project suspended by user");
} else if (!strcmp(op, "resume")) {
p->suspended_via_gui = false;
gstate.request_schedule_cpus("project resumed by user");
@ -478,12 +474,8 @@ static void handle_result_op(char* buf, MIOFILE& fout, const char* op) {
}
gstate.request_work_fetch("result aborted by user");
} else if (!strcmp(op, "suspend")) {
if (p->non_cpu_intensive) {
msg_printf(p, MSG_USER_ERROR, "Can't suspend non-CPU-intensive result");
} else {
rp->suspended_via_gui = true;
gstate.request_work_fetch("result suspended by user");
}
rp->suspended_via_gui = true;
gstate.request_work_fetch("result suspended by user");
} else if (!strcmp(op, "resume")) {
rp->suspended_via_gui = false;
}

View File

@ -247,7 +247,14 @@ static void parse_meminfo_linux(HOST_INFO& host) {
char buf[256];
double x;
FILE* f = fopen("/proc/meminfo", "r");
if (!f) return;
if (!f) {
msg_printf(NULL, MSG_USER_ERROR,
"Can't open /proc/meminfo - defaulting to 1 GB."
);
host.m_nbytes = GIGA;
host.m_swap = GIGA;
return;
}
while (fgets(buf, 256, f)) {
if (strstr(buf, "MemTotal:")) {
sscanf(buf, "MemTotal: %lf", &x);
@ -261,6 +268,7 @@ static void parse_meminfo_linux(HOST_INFO& host) {
sscanf(buf, "Swap: %lf", &host.m_swap);
}
}
fclose(f);
}
// Unfortunately the format of /proc/cpuinfo is not standardized.
@ -277,7 +285,12 @@ static void parse_cpuinfo_linux(HOST_INFO& host) {
char buf2[256];
FILE* f = fopen("/proc/cpuinfo", "r");
if (!f) return;
if (!f) {
msg_printf(NULL, MSG_USER_ERROR, "Can't open /proc/cpuinfo.");
strcpy(host.p_model, "unknown");
strcpy(host.p_vendor, "unknown");
return;
}
#ifdef __mips__
strcpy(host.p_model, "MIPS ");
@ -600,8 +613,7 @@ int HOST_INFO::get_host_info() {
parse_meminfo_linux(*this);
#elif defined(_SC_USEABLE_MEMORY)
// UnixWare
m_nbytes = (double)sysconf(_SC_PAGESIZE)
* (double)sysconf(_SC_USEABLE_MEMORY);
m_nbytes = (double)sysconf(_SC_PAGESIZE) * (double)sysconf(_SC_USEABLE_MEMORY);
#elif defined(_SC_PHYS_PAGES)
m_nbytes = (double)sysconf(_SC_PAGESIZE) * (double)sysconf(_SC_PHYS_PAGES);
if (m_nbytes < 0) {
@ -661,24 +673,9 @@ int HOST_INFO::get_host_info() {
swapctl(SWAP_STATS, s, n);
m_swap = 0.0;
for (i = 0; i < n; i ++) {
if (s[i].se_flags & SWF_ENABLE)
m_swap += 512. * (double)s[i].se_nblks;
}
#elif defined(HAVE__PROC_MEMINFO)
// Linux
FILE *fp;
if ((fp = fopen("/proc/meminfo", "r")) != 0) {
char minfo_buf[1024];
int n;
if ((n = fread(minfo_buf, sizeof(char), sizeof(minfo_buf)-1, fp))) {
char *p;
minfo_buf[n] = '\0';
if ((p = strstr(minfo_buf, "SwapTotal:"))) {
p += 10; // move past "SwapTotal:"
m_swap = 1024.*(double) strtoul(p, NULL, 10);
}
if (s[i].se_flags & SWF_ENABLE) {
m_swap += 512. * (double)s[i].se_nblks;
}
fclose(fp);
}
#elif defined(__APPLE__)
// The sysctl(vm.vmmeter) function doesn't work on OS X. However, swap

View File

@ -103,7 +103,7 @@ $astro_phys_chem = array(
),
array(
"LHC@home",
"http://lhcathome.cern.ch/",
"http://lhcathome.cern.ch/lhcathome/",
"CERN (European Organization for Nuclear Research)",
"Physics",
"The Large Hadron Collider (LHC) is a particle accelerator which is being built at CERN, the European Organization for Nuclear Research, the world's largest particle physics laboratory. When it switches on in 2007, it will be the most powerful instrument ever built to investigate on particles proprieties. LHC@home simulates particles traveling around the LHC to study the stability of their orbits.",

View File

@ -132,12 +132,12 @@ int check_reread_trigger() {
return 0;
}
// Scan work items for a given appp until one found
// that is not already on the shared memory segment.
// Scan work items for a given app until one found
// that is not already in the shared memory segment.
// Errors that can occur:
// 1) No valid work item found even after restarting the enumeration
// ACTION: return false
// 2) The work item can be for a app that doesn't exist in the database
// 2) The work item is for a app that doesn't exist in the database
// ACTION: exit application
//
static bool find_work_item(
@ -169,7 +169,8 @@ static bool find_work_item(
restarted_enum = true;
log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,
"restarted enumeration for appid %d\n",
ssp->apps[work_item_index].id);
ssp->apps[work_item_index].id
);
} else {
// Check for a work item with an invalid application id
//

View File

@ -117,7 +117,7 @@ def assign_task_defaults():
if not host:
task.host = config.config.host
disabled = task.__dict__.get('disabled')
if disabled:
if disabled and disabled != "0":
task.disabled = 1
else:
task.disabled = 0
@ -126,7 +126,7 @@ def assign_task_defaults():
if not host:
task.host = config.config.host
disabled = task.__dict__.get('disabled')
if disabled:
if disabled and disabled != "0":
task.disabled = 1
else:
task.disabled = 0