mirror of https://github.com/BOINC/boinc.git
- upgrade script: fix it, and add --web_only option (fixes #527)
- web: replace "Result" by "Task" a couple of places svn path=/trunk/boinc/; revision=14446
This commit is contained in:
parent
9b2998009f
commit
40f594b07c
|
@ -12549,3 +12549,15 @@ David 27 Dec 2007
|
|||
log_flags.C,h
|
||||
lib/
|
||||
common_defs.h
|
||||
|
||||
David 27 Dec 2007
|
||||
- upgrade script: fix it, and add --web_only option (fixes #527)
|
||||
- web: replace "Result" by "Task" a couple of places
|
||||
|
||||
html/
|
||||
inc/
|
||||
host.inc
|
||||
user/
|
||||
hosts_user.php
|
||||
tools/
|
||||
upgrade
|
||||
|
|
|
@ -41,6 +41,7 @@ abstract class BoltUnit {
|
|||
class BoltIter {
|
||||
public $top; // topmost unit
|
||||
public $state; // state array
|
||||
public $xset; // exercise set, if any
|
||||
|
||||
// the following are temps
|
||||
public $item; // current item
|
||||
|
@ -62,6 +63,7 @@ class BoltIter {
|
|||
// get current item and fraction done
|
||||
//
|
||||
function at() {
|
||||
$this->xset = null;
|
||||
$this->top->walk($this, false, $this->frac_done);
|
||||
}
|
||||
|
||||
|
@ -245,6 +247,114 @@ class BoltRandom extends BoltUnit {
|
|||
}
|
||||
}
|
||||
|
||||
class BoltExerciseSet extends BoltUnit {
|
||||
public $units;
|
||||
public $reviews;
|
||||
function __construct($n, $u, $n, $r) {
|
||||
$this->name = $n;
|
||||
$this->units = $u;
|
||||
$this->is_item = false;
|
||||
$this->number = $n;
|
||||
$this->shuffled = false;
|
||||
$this->reviews = $r;
|
||||
}
|
||||
|
||||
// the scheduler calls this when an exercise in this set
|
||||
// has just been graded.
|
||||
// - record the score
|
||||
// - if this is the last exercise in the set,
|
||||
// create exercise_set_result record
|
||||
// and optionally create or update bolt_refresh record
|
||||
// - return a structure saying what navigation info to show:
|
||||
// - review
|
||||
// - repeat now
|
||||
// - next
|
||||
//
|
||||
function xset_callback($score, &$nav_info) {
|
||||
}
|
||||
|
||||
function walk(&$iter, $incr, &$frac_done) {
|
||||
$iter->xset = $this;
|
||||
$n = count($this->units);
|
||||
if (array_key_exists($this->name, $iter->state)) {
|
||||
$state_rec = $iter->state[$this->name];
|
||||
$child_name = $state_rec['child_name'];
|
||||
$number_shown = $state_rec['number_shown'];
|
||||
if (!$this->shuffled) {
|
||||
srand($state_rec['seed']);
|
||||
shuffle($this->units);
|
||||
$this->shuffled = true;
|
||||
}
|
||||
|
||||
// look up unit by name
|
||||
//
|
||||
$child = null;
|
||||
for ($i=0; $i<$n; $i++) {
|
||||
$c = $this->units[$i];
|
||||
if ($c->name == $child_name) {
|
||||
$child = $c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if not there, look up by index
|
||||
//
|
||||
if (!$child) {
|
||||
$i = $state_rec['i'];
|
||||
if ($i >= $n) {
|
||||
// and if index is too big, use last unit
|
||||
//
|
||||
$i = $n-1;
|
||||
}
|
||||
$child = $this->units[$i];
|
||||
}
|
||||
|
||||
// at this point, $child is the current unit, and $i is its index
|
||||
//
|
||||
if ($incr) {
|
||||
$my_inc = false;
|
||||
if ($child->is_item) {
|
||||
$my_inc = true;
|
||||
} else {
|
||||
$my_inc = $child->walk($iter, $incr, $frac_done);
|
||||
}
|
||||
if ($my_inc) {
|
||||
$i = ($i+1)%$n;
|
||||
$number_shown++;
|
||||
if ($number_shown >= $this->number) {
|
||||
$frac_done = 1;
|
||||
$state_rec['i'] = $i;
|
||||
$state_rec['number_shown'] = 0;
|
||||
$state_rec['child_name'] = null;
|
||||
$iter->state[$this->name] = $state_rec;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$i = 0;
|
||||
$number_shown = 0;
|
||||
$state_rec = null;
|
||||
$seed = ((double)microtime()*1000000);
|
||||
srand($seed);
|
||||
shuffle($this->units);
|
||||
$state_rec['seed'] = $seed;
|
||||
}
|
||||
$child = $this->units[$i];
|
||||
$frac_done = $number_shown/$this->number;
|
||||
$state_rec['i'] = $i;
|
||||
$state_rec['number_shown'] = $number_shown;
|
||||
$state_rec['child_name'] = $child->name;
|
||||
$iter->state[$this->name] = $state_rec;
|
||||
if ($child->is_item) {
|
||||
$iter->item = $child;
|
||||
} else {
|
||||
$child->walk($iter, false, $f);
|
||||
$frac_done += $f*(1/$number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BoltItem extends BoltUnit {
|
||||
public $filename;
|
||||
function __construct($name, $title, $filename) {
|
||||
|
@ -387,7 +497,8 @@ function sequence() {
|
|||
if (is_subclass_of($arg, "BoltUnit")) {
|
||||
$units[] = $arg;
|
||||
} else {
|
||||
echo "Unrecognized arg";
|
||||
echo "Unrecognized arg: ";
|
||||
print_r($arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +522,8 @@ function random() {
|
|||
if (is_subclass_of($arg, "BoltUnit")) {
|
||||
$units[] = $arg;
|
||||
} else {
|
||||
echo "Unrecognized arg";
|
||||
echo "Unrecognized arg: ";
|
||||
print_r($arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +533,9 @@ function random() {
|
|||
function exercise_set() {
|
||||
$args = func_get_args();
|
||||
$units = array();
|
||||
$reviews = array();
|
||||
$name = "";
|
||||
$number = 1;
|
||||
foreach ($args as $arg) {
|
||||
if (is_array($arg)) {
|
||||
switch ($arg[0]) {
|
||||
|
@ -433,12 +547,15 @@ function exercise_set() {
|
|||
} else if (is_object($arg)) {
|
||||
if (is_subclass_of($arg, "BoltUnit")) {
|
||||
$units[] = $arg;
|
||||
} else if (get_class($arg) == "BoltReview") {
|
||||
$reviews[] = $arg;
|
||||
} else {
|
||||
echo "Unrecognized arg";
|
||||
echo "Unrecognized arg: ";
|
||||
print_r($arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new BoltExerciseSet($name, $units, $number);
|
||||
return new BoltExerciseSet($name, $units, $number, $reviews);
|
||||
}
|
||||
|
||||
function enum_course($course) {
|
||||
|
|
|
@ -142,7 +142,7 @@ function show_host($host, $private, $ipprivate, $user) {
|
|||
row2("Average CPU efficiency", $host->cpu_efficiency);
|
||||
}
|
||||
if ($host->duration_correction_factor) {
|
||||
row2("Result duration correction factor", $host->duration_correction_factor);
|
||||
row2("Task duration correction factor", $host->duration_correction_factor);
|
||||
}
|
||||
row2("Location", location_form($host));
|
||||
if ($nresults == 0) {
|
||||
|
|
|
@ -34,7 +34,7 @@ function user_host_table_start($private) {
|
|||
<th>".link_with_GET_variables("Operating system", "hosts_user.php", 'sort', 'os')."</th>
|
||||
";
|
||||
$config = get_config();
|
||||
if (parse_bool($config, "show_results")) echo "<th>Results</th>";
|
||||
if (parse_bool($config, "show_results")) echo "<th>Tasks</th>";
|
||||
echo "<th>".link_with_GET_variables("Last contact", "hosts_user.php", 'sort', 'rpc_time')."</th>";
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@ from Boinc.setup_project import *
|
|||
import os, getopt
|
||||
|
||||
def usage():
|
||||
print "Usage: upgrade [--project_root] project_name"
|
||||
print "Usage: upgrade [--project_root] [--web_only] project_name"
|
||||
raise SystemExit
|
||||
|
||||
def syntax_error(str):
|
||||
raise SystemExit('%s; See "%s --help" for help\n' % (str, sys.argv[0]))
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], '', ['help', 'project_root='])
|
||||
opts, args = getopt.getopt(sys.argv[1:], '', ['help', 'project_root=', 'web_only'])
|
||||
except getopt.GetoptError, e:
|
||||
syntax_error(e)
|
||||
|
||||
|
@ -37,6 +37,7 @@ options.project_root = os.path.join(home, 'projects')
|
|||
for o,a in opts:
|
||||
if o == '--help': usage()
|
||||
elif o == '--project_root': options.project_root = a
|
||||
elif o == '--web_only': options.web_only = True
|
||||
else:
|
||||
raise SystemExit('internal error o=%s'%o)
|
||||
|
||||
|
@ -57,7 +58,7 @@ print "Upgrading files... "
|
|||
|
||||
options.install_method = 'copy'
|
||||
init()
|
||||
install_boinc_files(INSTALL_DIR)
|
||||
install_boinc_files(INSTALL_DIR, options.web_only)
|
||||
|
||||
print "Upgrading files... done"
|
||||
print "You may need to do database upgrades also."
|
||||
|
|
Loading…
Reference in New Issue