Skip to content

Commit

Permalink
- scheduler: move startup checks (stop_sched, shmem) inside FCGI loop.
Browse files Browse the repository at this point in the history
    Hopefully this will make it feasible to run scheduler
    even when project is down.
- lib: fix cygwin build error

svn path=/trunk/boinc/; revision=13172
  • Loading branch information
davidpanderson committed Jul 17, 2007
1 parent 1cb66f1 commit 2d74b13
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 135 deletions.
11 changes: 11 additions & 0 deletions checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -7331,3 +7331,14 @@ Charlie 17 July 2007

clientgui/
ViewWorkGrid.cpp

David 17 July 2007
- scheduler: move startup checks (stop_sched, shmem) inside FCGI loop.
Hopefully this will make it feasible to run scheduler
even when project is down.
- lib: fix cygwin build error

lib/
filesys.C
sched/
main.C
6 changes: 3 additions & 3 deletions doc/addon_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,11 @@
'The BOINC User Statistics Widget is highly configurable and displays your choice of statistics from almost any BOINC project.',
1149646406
),
array('http://www.esea.dk/bos/BOINC%20Server%20Status.zip',
array('BOINC_server_status.zip',
'BOINC Server Status',
'1.0',
'1.1',
'Yahoo! widget adds the BOINC Online Scheduler image to your desktop.',
'http://www.esea.dk/bos/BOINC%20Server%20Status.zip',
'http://www.esea.dk/bos/',
'Yahoo! Widget Engine - http://widgets.yahoo.com/',
'Adds the BOINC Online Scheduler image to your desktop.
(requires the <a href=http://widgets.yahoo.com/>Yahoo! widget engine</a>)',
Expand Down
2 changes: 1 addition & 1 deletion doc/addon_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function show_item($y) {
list_start();
list_item(
"Name<br><font size=-2>Click to download</font>",
"<a href=$url>".$y[1].'</a>');
"<a href=\"$url\">".$y[1].'</a>');
if ($y[2]) {
list_item("Version", $y[2]);
}
Expand Down
4 changes: 4 additions & 0 deletions doc/boinc_news.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?

$project_news = array(
array("July 16, 2007",
"If you use the Yahoo! Widget Engine,
check out version 1.1 of the <a href=http://boinc.berkeley.edu/addon_item.php?platform=browser&item=BOINC_server_status.zip>BOINC Server Status</a> widget."
),
array("July 16, 2007",
"BOINC is now the preferred client software at
<a href=http://worldcommunitygrid.org>World Community Grid</a>."
Expand Down
102 changes: 0 additions & 102 deletions doc/sim.php

This file was deleted.

32 changes: 21 additions & 11 deletions doc/sim_form.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

require_once("docutil.php");

function show_form() {
echo "
<h2>BOINC client simulator</h2>
<form action=sim_form.php method=post>
sim_projects.xml:
Expand Down Expand Up @@ -103,23 +104,24 @@ function show_form() {
</cc_config></textarea>
<p>
Duration: <input name=duration value=86400>
Time step: <input name=delta value=60>
<br>Time step: <input name=delta value=60>
<br>Duration: <input name=duration value=86400>
<br>(may not exceed TimeStep*10000)
<p>
Server uses workload? <input type=checkbox name=suw>
Server does EDF simulation based on current workload? <input type=checkbox name=suw>
<p>
Client uses RR CPU sched? <input type=checkbox name=rr_only>
Client uses Round-Robin (old-style) CPU scheduling? <input type=checkbox name=rr_only>
<p>
Client uses old work fetch policy? <input type=checkbox name=work_fetch_old>
<p>
DCF: <input type=radio name=dcf value=normal checked> Normal
Duration correction factor: <input type=radio name=dcf value=normal checked> Normal
: <input type=radio name=dcf value=stats> Stats
: <input type=radio name=dcf value=dual> Dual
: <input type=radio name=dcf value=none> None
<p>
HTML output lines per file: <input name=line_limit>
<p>
<input type=submit name=submit>
<input type=submit name=submit value=\"Run simulation\">
</form>
";
Expand All @@ -138,16 +140,17 @@ function show_form() {
}
$duration = $_POST['duration'];

if ($duration > 100000) {
echo "duration must be <= 100000";
exit();
}
$delta = $_POST['delta'];
if ($delta < 1) {
echo "time step must be >= 1";
exit();
}

if ($duration/$delta > 10000) {
echo "duration/step must be <= 10000";
exit();
}

$suw = '';
if ($_POST['suw']) {
$suw = '--server_uses_workload';
Expand Down Expand Up @@ -183,6 +186,13 @@ function show_form() {
system("/bin/rm sim_log.txt sim_out_*.html");
system($cmd);
} else {
page_head("BOINC client simulator");
echo "
This is a web interface to the BOINC client simulator.
Fill in the following form to specify the parameters
of your simulation.
Click <a href=trac/wiki/ClientSim>here</a> for more info.
";
show_form();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/filesys.C
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ int dir_size(const char* dirpath, double& size, bool recurse) {
dir_size(buf, dsize, recurse);
size += dsize;
} else {
size += findData.nFileSizeLow + (__int64(findData.nFileSizeHigh) << 32);
size += findData.nFileSizeLow + ((__int64)(findData.nFileSizeHigh) << 32);
}
} while (FindNextFile(hFind, &findData));
::FindClose(hFind);
Expand Down
33 changes: 16 additions & 17 deletions sched/main.C
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ PROJECT_FILES project_files;
key_t sema_key;
int g_pid;
static bool db_opened=false;
bool shmem_failed = false;
SCHED_SHMEM* ssp = 0;
bool batch = false;
bool mark_jobs_done = false;
Expand Down Expand Up @@ -254,7 +253,7 @@ void set_core_dump_size_limit() {
}
#endif

SCHED_SHMEM* attach_to_feeder_shmem() {
void attach_to_feeder_shmem() {
char path[256];
get_project_dir(path, sizeof(path));
get_key(path, 'a', sema_key);
Expand All @@ -267,7 +266,6 @@ SCHED_SHMEM* attach_to_feeder_shmem() {
"Can't attach shmem: %d (feeder not running?)\n",
retval
);
shmem_failed = true;
} else {
ssp = (SCHED_SHMEM*)p;
retval = ssp->verify();
Expand Down Expand Up @@ -296,7 +294,6 @@ SCHED_SHMEM* attach_to_feeder_shmem() {
exit(0);
}
}
return ssp;
}

int main(int argc, char** argv) {
Expand Down Expand Up @@ -337,8 +334,7 @@ int main(int argc, char** argv) {
}
// install a larger buffer for stderr. This ensures that
// log information from different scheduler requests running
// in parallel don't collide in the log file and appear
// intermingled.
// in parallel don't collide in the log file and appear intermingled.
//
if (!(stderr_buffer=(char *)malloc(32768)) || setvbuf(stderr, stderr_buffer, _IOFBF, 32768)) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
Expand All @@ -363,11 +359,6 @@ int main(int argc, char** argv) {
exit(0);
}

if (check_stop_sched()) {
send_message("Project is temporarily shut down for maintenance", 3600);
goto done;
}

log_messages.set_debug_level(config.sched_debug_level);

gui_urls.init();
Expand All @@ -383,11 +374,6 @@ int main(int argc, char** argv) {
exit(0);
}

ssp = attach_to_feeder_shmem();
if (shmem_failed) {
send_message("Server error: can't attach shared memory", 3600);
goto done;
}

g_pid = getpid();
#ifdef _USING_FCGI_
Expand All @@ -397,6 +383,19 @@ int main(int argc, char** argv) {
#endif
log_request_info(length);

if (check_stop_sched()) {
send_message("Project is temporarily shut down for maintenance", 3600);
goto done;
}

if (!ssp) {
attach_to_feeder_shmem();
}
if (!ssp) {
send_message("Server error: can't attach shared memory", 3600);
goto done;
}

if (use_files) {
struct stat statbuf;
// the code below is convoluted because,
Expand Down Expand Up @@ -468,6 +467,7 @@ int main(int argc, char** argv) {
} else {
handle_request(stdin, stdout, *ssp, code_sign_key);
}
done:
#ifdef _USING_FCGI_
fprintf(stderr, "FCGI: counter: %d\n", counter);
continue;
Expand All @@ -481,7 +481,6 @@ int main(int argc, char** argv) {
// about "incomplete headers"
fprintf(stdout,"Content-type: text/plain\n\n");
#endif
done:
if (db_opened) {
boinc_db.close();
}
Expand Down

0 comments on commit 2d74b13

Please sign in to comment.