- bug fixes in remote job submission tools

(manage_privileges and get_output.php).
    From Nico Schlitter.
- change things so that
    make_project --test_app
    will produce input/output templates that are compatible
    with the remote job submission tools


svn path=/trunk/boinc/; revision=24774
This commit is contained in:
David Anderson 2011-12-10 22:03:43 +00:00
parent 9c7c7a22ad
commit fa3f5a945e
9 changed files with 180 additions and 137 deletions

View File

@ -8906,24 +8906,24 @@ Charlie 7 Dec 2011
release_boinc.sh
Rom 9 Dec 2011
- VBOX: Remove unused function, I don't remember what I was going to use that
hook for.
- VBOX: Remove unused function,
I don't remember what I was going to use that hook for.
samples/vboxwrapper/
vbox.cpp, .h
vboxwrapper.cpp
Rom 9 Dec 2011
- VBOX: Remove the guru meditation state, apparently that is when the vbox host
process for the vm crashes.
- VBOX: Remove the guru meditation state,
apparently that is when the vbox host process for the vm crashes.
samples/vboxwrapper/
vbox.cpp
Rom 9 Dec 2011
- VBOX: Add the ability for the wrapper to know if vboxmanage has hung or is stuck
in a loop. If so, terminate the process and return an error to the calling
function.
- VBOX: Add the ability for the wrapper to know if vboxmanage has hung
or is stuck in a loop.
If so, terminate the process and return an error.
samples/vboxwrapper/
vbox.cpp
@ -8942,3 +8942,21 @@ Rom 9 Dec 2011
ptp_IsDialogBitmap.bmp
ptp_splash.bmp
ptp_Wizard.bmp
David 10 Dec 2011
- bug fixes in remote job submission tools
(manage_privileges and get_output.php).
From Nico Schlitter.
- change things so that
make_project --test_app
will produce input/output templates that are compatible
with the remote job submission tools
tools/
example_app_in,out (removed .xml from name)
manage_privileges
make_project
html/user/
get_output.php
ssim/
ssim.cpp

View File

@ -22,7 +22,7 @@
require_once("../inc/util.inc");
require_once("../inc/result.inc");
require_once("../inc/submit_db.inc");
require_once("../inc/submit_util.inc");
// get a single output file
//

View File

@ -58,16 +58,19 @@
// Terminology:
//
// A chunk may or may not be "present_on_server".
// An encoded data unit is "present_on_server" if at least N
// of its subunits are present_on_server.
// A data unit is "recoverable" if it can be reconstruct on the server,
// based on current state.
// A chunk is "recoverable" if it is assigned at least 1 host.
// (if it is downloading, it's still present on the server)
// An encoded data unit is "recoverable" if at least N
// A data unit is "recoverable" if it can be recovered on the server
// by uploading data from hosts.
// A chunk is recoverable if it's present on the server or on at least 1 host.
// (note: if it's downloading, it's still present on the server)
// An encoded data unit is recoverable if at least N
// of its subunits are recoverable.
// A data unit is "reconstructible" if it can be reconstructed
// from data currently on the server.
// A chunk is reconstructible if it's present on the server.
// An encoded unit is reconstructible if at least N of its subunits are.
// A chunk is "uploading" if at least one of its instances
// is being uploaded to the server.
// An encoded data unit is "uploading" if at least
@ -107,7 +110,6 @@ using std::set;
// similar, meta-packets per file
#define META_N 10
SIMULATOR sim;
inline double drand() {
@ -221,7 +223,8 @@ struct CHUNK : DATA_UNIT {
}
virtual void start_upload() {
// if no upload of this chunk is in progress, start one.
// NOTE: all instances are inherently present_on_host
// NOTE: all instances are inherently present_on_host,
// since this is only called if chunk is not present on server
//
CHUNK_ON_HOST* c;
set<CHUNK_ON_HOST*>::iterator i;
@ -281,21 +284,7 @@ struct META_CHUNK : DATA_UNIT {
// a child has become unrecoverable.
// reconstruct this data unit if we still can.
//
void child_unrecoverable() {
int n = n_recoverable_children();
printf("%s: a child of %s has become unrecoverable\n", now_str(), name);
if (n >= ENCODING_N) {
uploading = true;
for (unsigned int i=0; i<children.size(); i++) {
DATA_UNIT* c = children[i];
if (c->recoverable()) {
c->start_upload();
}
}
} else {
printf("%s: only %d recoverable children\n", now_str(), n);
}
}
void child_unrecoverable();
// start download of descendant chunks as needed
//
@ -313,28 +302,7 @@ struct META_CHUNK : DATA_UNIT {
// a child is now present on the server.
//
void child_upload_complete() {
printf("%s: child upload complete for %s\n", now_str(), name);
int n = 0;
for (unsigned int i=0; i<children.size(); i++) {
DATA_UNIT* c = children[i];
if (c->is_present_on_server()) {
n++;
}
}
if (n >= ENCODING_N) {
now_present();
assign();
if (parent && parent->uploading) {
parent->child_upload_complete();
} else {
// if we're not reconstructing parent,
// delete any chunks not being downloaded
//
delete_chunks_from_server();
}
}
}
void child_upload_complete();
};
static int next_file_id=0;
@ -485,66 +453,15 @@ CHUNK::CHUNK(META_CHUNK* mc, double s, int index) {
parent->dfile->disk_usage.sample_inc(size, false);
}
void CHUNK::host_failed(CHUNK_ON_HOST* p) {
set<CHUNK_ON_HOST*>::iterator i = hosts.find(p);
hosts.erase(i);
printf("%s: handling loss of %s\n", now_str(), p->name);
if (_is_present_on_server) {
// if data is on server, make a new replica
//
assign();
} else if (!hosts.empty()) {
start_upload();
} else {
parent->child_unrecoverable();
}
}
void CHUNK::upload_complete() {
if (!_is_present_on_server) {
_is_present_on_server = true;
parent->dfile->disk_usage.sample_inc(
size,
parent->dfile->collecting_stats()
);
}
assign();
if (parent->uploading) {
parent->child_upload_complete();
}
}
void CHUNK::now_present() {
if (_is_present_on_server) return;
_is_present_on_server = true;
parent->dfile->disk_usage.sample_inc(size, false);
}
void CHUNK::download_complete() {
// we can remove chunk from server if enough replicas
// have downloaded
//
int n=0;
set<CHUNK_ON_HOST*>::iterator i;
for (i=hosts.begin(); i!=hosts.end(); i++) {
CHUNK_ON_HOST* c = *i;
if (c->present_on_host) {
n++;
}
}
if (n >= REPLICATION_LEVEL) {
printf("%s: %s replicated, removing from server\n", now_str(), name);
_is_present_on_server = false;
parent->dfile->disk_usage.sample_inc(
-size,
parent->dfile->collecting_stats()
);
}
if (parent->dfile->pending_init_downloads) {
parent->dfile->pending_init_downloads--;
}
}
// if there aren't enough replicas of this chunk,
// pick new hosts and start downloads
//
void CHUNK::assign() {
if (!_is_present_on_server) return;
while (hosts.size() < REPLICATION_LEVEL) {
@ -606,6 +523,110 @@ META_CHUNK::META_CHUNK(
}
}
//////////////////// HOST FAILURE ///////////////////////
void CHUNK::host_failed(CHUNK_ON_HOST* p) {
set<CHUNK_ON_HOST*>::iterator i = hosts.find(p);
hosts.erase(i);
printf("%s: handling loss of %s\n", now_str(), p->name);
if (_is_present_on_server) {
// if data is on server, make a new replica
//
assign();
} else if (!hosts.empty()) {
start_upload();
} else {
parent->child_unrecoverable();
}
}
void META_CHUNK::child_unrecoverable() {
int n = n_recoverable_children();
printf("%s: a child of %s has become unrecoverable\n", now_str(), name);
if (n >= ENCODING_N) {
uploading = true;
for (unsigned int i=0; i<children.size(); i++) {
DATA_UNIT* c = children[i];
if (c->recoverable()) {
c->start_upload();
}
}
} else {
printf("%s: only %d recoverable children\n", now_str(), n);
}
}
//////////////////// UPLOAD COMPLETION //////////////////
void CHUNK::upload_complete() {
if (!_is_present_on_server) {
_is_present_on_server = true;
parent->dfile->disk_usage.sample_inc(
size,
parent->dfile->collecting_stats()
);
}
assign();
if (parent->uploading) {
parent->child_upload_complete();
}
}
void META_CHUNK::child_upload_complete() {
printf("%s: child upload complete for %s\n", now_str(), name);
int n = 0;
for (unsigned int i=0; i<children.size(); i++) {
DATA_UNIT* c = children[i];
if (c->is_present_on_server()) {
n++;
}
}
if (n >= ENCODING_N) {
now_present();
assign();
if (parent && parent->uploading) {
parent->child_upload_complete();
} else {
// if we're not reconstructing parent,
// delete any chunks not being downloaded
//
delete_chunks_from_server();
}
}
}
//////////////////// DOWNLOAD COMPLETION ////////////////
// when a download completes, we need to decide whether
// to delete the chunk from the server.
// We can do this if:
// - enough replicas have downloaded
// - this chunk isn't needed for recovery going on elsewhere
//
void CHUNK::download_complete() {
int n=0;
set<CHUNK_ON_HOST*>::iterator i;
for (i=hosts.begin(); i!=hosts.end(); i++) {
CHUNK_ON_HOST* c = *i;
if (c->present_on_host) {
n++;
}
}
if (n >= REPLICATION_LEVEL) {
printf("%s: %s replicated, removing from server\n", now_str(), name);
_is_present_on_server = false;
parent->dfile->disk_usage.sample_inc(
-size,
parent->dfile->collecting_stats()
);
}
if (parent->dfile->pending_init_downloads) {
parent->dfile->pending_init_downloads--;
}
}
////////////////////
set<DFILE*> dfiles;
int main() {

12
tools/example_app_in Normal file
View File

@ -0,0 +1,12 @@
<input_template>
<file_info>
<number>0</number>
</file_info>
<workunit>
<file_ref>
<file_number>0</file_number>
<open_name>in</open_name>
</file_ref>
<command_line>-cpu_time 30</command_line>
</workunit>
</input_template>

View File

@ -1,10 +0,0 @@
<file_info>
<number>0</number>
</file_info>
<workunit>
<file_ref>
<file_number>0</file_number>
<open_name>in</open_name>
</file_ref>
<command_line>-cpu_time 30</command_line>
</workunit>

15
tools/example_app_out Normal file
View File

@ -0,0 +1,15 @@
<output_template>
<file_info>
<name><OUTFILE_0/></name>
<generated_locally/>
<upload_when_present/>
<max_nbytes>5000000</max_nbytes>
<url><UPLOAD_URL/></url>
</file_info>
<result>
<file_ref>
<file_name><OUTFILE_0/></file_name>
<open_name>out</open_name>
</file_ref>
</result>
</output_template>

View File

@ -1,13 +0,0 @@
<file_info>
<name><OUTFILE_0/></name>
<generated_locally/>
<upload_when_present/>
<max_nbytes>5000000</max_nbytes>
<url><UPLOAD_URL/></url>
</file_info>
<result>
<file_ref>
<file_name><OUTFILE_0/></file_name>
<open_name>out</open_name>
</file_ref>
</result>

View File

@ -306,8 +306,8 @@ if options.test_app:
app_dir = proot+'/apps/example_app/'
os.mkdir(app_dir)
os.system('cp -r ../samples/example_app/bin/* ' + app_dir);
shutil.copy('example_app_in.xml', proot+'/templates/')
shutil.copy('example_app_out.xml', proot+'/templates/')
shutil.copy('example_app_in', proot+'/templates/')
shutil.copy('example_app_out', proot+'/templates/')
shutil.copy('../tools/create_work_example', proot+'/bin/')
httpd_conf_template_filename = os.path.join(

View File

@ -122,13 +122,13 @@ if ($argv[3] === "all") {
}
} else {
if ($grant) {
BoincUserSubmit::insert("user_id=$user->id and manage_all=1");
BoincUserSubmit::insert("set user_id=$user->id, manage_all=1)");
} else {
die("User $user->id does not have global manage access\n");
}
}
} else {
$app = BoincApp::lookup_name($argv[3]);
$app = BoincApp::lookup("name='".$argv[3]."'");
if (!$app) die("no such app: ".$argv[2]."\n");
$busa = BoincUserSubmitApp::lookup("user_id=$user->id and app_id=$app->id");
if ($busa) {
@ -149,9 +149,9 @@ if ($argv[3] === "all") {
if ($grant) {
$bus = BoincUserSubmit::lookup_userid($user->id);
if (!$bus) {
BoincUserSubmit::insert("user_id=$user->id=1");
BoincUserSubmit::insert("set user_id=$user->id");
}
BoincUserSubmitApp::insert("user_id=$user->id and app_id=$app->id and manage=1");
BoincUserSubmitApp::insert("set user_id=$user->id, app_id=$app->id, manage=1");
} else {
die("User $user->id does not have manage access for $app->name\n");
}