mirror of https://github.com/BOINC/boinc.git
parent
2f2e02985c
commit
ada18d1d46
|
@ -2077,3 +2077,41 @@ David Oct 3 2002
|
|||
David Oct 3 2002
|
||||
- updated test scripts to use new framework
|
||||
- got rid of some obsolete scripts
|
||||
|
||||
David Oct 8 2002
|
||||
- progress getting "make_work" (dummy work generator) to work.
|
||||
Removed the <name> element from workunit XML,
|
||||
and the <name> and <wu_name> elements from result XML;
|
||||
instead, the scheduler server inserts these as it sends them.
|
||||
|
||||
This simplifies things a little in work generation,
|
||||
and removes some redundancy.
|
||||
|
||||
Everything seems to work now except that the file upload signature
|
||||
ends up being wrong, which is expected,
|
||||
and it shows that the security mechanism works.
|
||||
- added test_loop.php, which simulates a system that is complete
|
||||
except for the validation process.
|
||||
|
||||
client/
|
||||
http.C
|
||||
db/
|
||||
db.h
|
||||
db_mysql.C
|
||||
html_ops/
|
||||
index.html
|
||||
sched/
|
||||
Makefile.in
|
||||
feeder.C
|
||||
file_upload_handler.C
|
||||
handle_request.C
|
||||
main.C
|
||||
make_work.C (new)
|
||||
test/
|
||||
*_result
|
||||
*_wu
|
||||
*.php
|
||||
test_loop.php (new)
|
||||
tools/
|
||||
backend_lib.C,h
|
||||
process_result_template.C
|
||||
|
|
|
@ -482,9 +482,8 @@ bool HTTP_OP_SET::poll() {
|
|||
break;
|
||||
case HTTP_OP_POST:
|
||||
retval = unlink(htp->outfile);
|
||||
if (retval) {
|
||||
printf("ERROR: unlink %d\n", retval);
|
||||
}
|
||||
// no error check here because file need not already exist
|
||||
//
|
||||
// fall through
|
||||
case HTTP_OP_GET:
|
||||
htp->http_op_state = HTTP_STATE_REPLY_BODY;
|
||||
|
|
1
db/db.h
1
db/db.h
|
@ -315,5 +315,6 @@ extern int db_result_update(RESULT& p);
|
|||
extern int db_result_lookup_name(RESULT& p);
|
||||
extern int db_result_enum_to_send(RESULT&, int);
|
||||
extern int db_result_enum_wuid(RESULT&);
|
||||
extern int db_result_count_state(int state, int&);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -637,3 +637,10 @@ int db_result_enum_wuid(RESULT& p) {
|
|||
if (!e.active) sprintf(buf, "where workunitid=%d", p.workunitid);
|
||||
return db_enum(e, &p, TYPE_RESULT, buf);
|
||||
}
|
||||
|
||||
int db_result_count_state(int state, int& n) {
|
||||
char buf[256];
|
||||
|
||||
sprintf(buf, " where state=%d", state);
|
||||
return db_count(&n, "*", TYPE_RESULT, buf);
|
||||
}
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Operational Interface</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href=project.php>Project Information</a>
|
||||
<title>BOINC Project Management Interface</title>
|
||||
<h2>BOINC Project Management Interface</h2>
|
||||
<a href=db.php?show=project>Project Information</a>
|
||||
<p>
|
||||
<a href=platform.php>Platform Information</a>
|
||||
<a href=db.php?show=platform>Platform Information</a>
|
||||
<p>
|
||||
<a href=app.php>Application Information</a>
|
||||
<a href=db.php?show=app>Application Information</a>
|
||||
<p>
|
||||
<a href=app_version.php>Application Version Information</a>
|
||||
<a href=db.php?show=app_version>Application Version Information</a>
|
||||
<p>
|
||||
<a href=user.php>User Information</a>
|
||||
<a href=db.php?show=user>User Information</a>
|
||||
<p>
|
||||
<a href=team.php>Team Information</a>
|
||||
<a href=db.php?show=team>Team Information</a>
|
||||
<p>
|
||||
<a href=host.php>Host Information</a>
|
||||
<a href=db.php?show=host>Host Information</a>
|
||||
<p>
|
||||
<a href=workunit.php>Workunit Information</a>
|
||||
<a href=db.php?show=workunit>Workunit Information</a>
|
||||
<p>
|
||||
<a href=result.php>Result Information</a>
|
||||
</body>
|
||||
</html>
|
||||
<a href=db.php?show=result>Result Information</a>
|
||||
|
|
|
@ -16,7 +16,7 @@ CC = g++ $(CFLAGS)
|
|||
|
||||
CLIBS = @LIBS@
|
||||
|
||||
PROGS = cgi feeder show_shmem file_upload_handler validate_test
|
||||
PROGS = cgi feeder show_shmem file_upload_handler validate_test make_work
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
|
@ -66,6 +66,13 @@ VALIDATE_OBJS = \
|
|||
../db/mysql_util.o \
|
||||
../lib/parse.o
|
||||
|
||||
MAKE_WORK_OBJS = \
|
||||
make_work.o \
|
||||
config.o \
|
||||
../db/db_mysql.o \
|
||||
../db/mysql_util.o \
|
||||
../lib/parse.o
|
||||
|
||||
FCGI_OBJS = \
|
||||
handle_request.fcgi.o \
|
||||
main.fcgi.o \
|
||||
|
@ -116,6 +123,9 @@ file_upload_handler: $(FILE_UPLOAD_OBJS)
|
|||
validate_test: $(VALIDATE_OBJS)
|
||||
$(CC) $(VALIDATE_OBJS) $(MYSQL_LIBS) $(CLIBS) -o validate_test
|
||||
|
||||
make_work: $(MAKE_WORK_OBJS)
|
||||
$(CC) $(MAKE_WORK_OBJS) $(MYSQL_LIBS) $(CLIBS) -o make_work
|
||||
|
||||
fcgi: $(FCGI_OBJS)
|
||||
$(CC) $(FCGI_OBJS) $(MYSQL_LIBS) $(CLIBS) $(FCGI_LIBS) \
|
||||
-o fcgi
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "sched_shmem.h"
|
||||
|
||||
#define RESULTS_PER_ENUM 100
|
||||
#define TRIGGER_FILENAME "feeder_trigger"
|
||||
#define TRIGGER_FILENAME "stop_server"
|
||||
|
||||
CONFIG config;
|
||||
|
||||
|
@ -70,7 +70,6 @@ int check_trigger(SCHED_SHMEM* ssp) {
|
|||
if (!strcmp(buf, "<quit/>\n")) {
|
||||
detach_shmem((void*)ssp);
|
||||
destroy_shmem(config.shmem_key);
|
||||
unlink(TRIGGER_FILENAME);
|
||||
exit(0);
|
||||
} else if (!strcmp(buf, "<reread_db/>\n")) {
|
||||
ssp->init();
|
||||
|
@ -79,7 +78,6 @@ int check_trigger(SCHED_SHMEM* ssp) {
|
|||
fprintf(stderr, "feeder: unknown command in trigger file: %s\n", buf);
|
||||
exit(0);
|
||||
}
|
||||
unlink(TRIGGER_FILENAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -129,6 +127,7 @@ void feeder_loop(SCHED_SHMEM* ssp) {
|
|||
retval = db_result_enum_to_send(result, RESULTS_PER_ENUM);
|
||||
printf("feeder: restarting enumeration: %d\n", retval);
|
||||
if (retval) {
|
||||
printf("feeder: enumeration returned nothing\n");
|
||||
no_wus = true;
|
||||
break;
|
||||
}
|
||||
|
@ -144,9 +143,12 @@ void feeder_loop(SCHED_SHMEM* ssp) {
|
|||
}
|
||||
}
|
||||
if (!collision) {
|
||||
printf("feeder: adding result %d\n", result.id);
|
||||
printf("feeder: adding result %d in slot %d\n", result.id, i);
|
||||
retval = db_workunit(result.workunitid, wu);
|
||||
if (retval) continue;
|
||||
if (retval) {
|
||||
printf("feeder: can't read workunit %d\n", result.workunitid);
|
||||
continue;
|
||||
}
|
||||
ssp->wu_results[i].result = result;
|
||||
ssp->wu_results[i].workunit = wu;
|
||||
ssp->wu_results[i].present = true;
|
||||
|
@ -155,6 +157,7 @@ void feeder_loop(SCHED_SHMEM* ssp) {
|
|||
}
|
||||
}
|
||||
if (nadditions == 0) {
|
||||
printf("feeder: no results added\n");
|
||||
sleep(1);
|
||||
} else {
|
||||
printf("feeder: added %d results to array\n", nadditions);
|
||||
|
@ -167,6 +170,7 @@ void feeder_loop(SCHED_SHMEM* ssp) {
|
|||
printf("feeder: some results already in array - sleeping\n");
|
||||
sleep(5);
|
||||
}
|
||||
fflush(stdout);
|
||||
check_trigger(ssp);
|
||||
ssp->ready = true;
|
||||
}
|
||||
|
@ -178,6 +182,8 @@ int main(int argc, char** argv) {
|
|||
bool asynch = false;
|
||||
void* p;
|
||||
|
||||
unlink(TRIGGER_FILENAME);
|
||||
|
||||
retval = config.parse_file();
|
||||
if (retval) {
|
||||
fprintf(stderr, "feeder: can't parse config file\n");
|
||||
|
|
|
@ -133,11 +133,16 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) {
|
|||
return retval;
|
||||
}
|
||||
bytes_left = nbytes - offset;
|
||||
if (bytes_left == 0) {
|
||||
fprintf(stderr, "file_upload_handler: offset == nbytes!! %f\n", nbytes);
|
||||
return 0;
|
||||
}
|
||||
while (1) {
|
||||
m = BLOCK_SIZE;
|
||||
if (m > bytes_left) m = (int)bytes_left;
|
||||
n = fread(buf, 1, m, in);
|
||||
if (n <= 0) {
|
||||
fprintf(stderr, "file_upload_handler: fread: asked for %d, return %d\n", m, n);
|
||||
print_status(-1, "can't fread socket");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -46,31 +46,47 @@ bool wu_is_feasible(WORKUNIT& wu, HOST& host) {
|
|||
}
|
||||
|
||||
// estimate the time that a WU will take on a host
|
||||
// TODO: improve this. take memory bandwidth into account
|
||||
//
|
||||
double estimate_duration(WORKUNIT& wu, HOST& host) {
|
||||
if (host.p_fpops <= 0) host.p_fpops = 1;
|
||||
if (host.p_iops <= 0) host.p_iops = 1;
|
||||
if (wu.rsc_fpops <= 0) wu.rsc_fpops = 1;
|
||||
if (wu.rsc_iops <= 0) wu.rsc_iops = 1;
|
||||
if (host.p_fpops <= 0) host.p_fpops = 1e9;
|
||||
if (host.p_iops <= 0) host.p_iops = 1e9;
|
||||
if (wu.rsc_fpops <= 0) wu.rsc_fpops = 1e12;
|
||||
if (wu.rsc_iops <= 0) wu.rsc_iops = 1e12;
|
||||
return wu.rsc_fpops/host.p_fpops + wu.rsc_iops/host.p_iops;
|
||||
}
|
||||
|
||||
// insert an element in xml_doc with an estimation of how many seconds
|
||||
// a workunit will take to complete
|
||||
// insert "text" right after "after" in the given buffer
|
||||
//
|
||||
int insert_time_tag(WORKUNIT& wu, double seconds) {
|
||||
char *location;
|
||||
int insert_after(char* buffer, char* after, char* text) {
|
||||
char* p;
|
||||
char temp[MAX_BLOB_SIZE];
|
||||
|
||||
location = strstr(wu.xml_doc, "</workunit>");
|
||||
if ((location - wu.xml_doc) > (MAX_BLOB_SIZE - 64)) {
|
||||
return -1; //not enough space to include time info
|
||||
}
|
||||
sprintf(location,
|
||||
" <seconds_to_complete>%f</seconds_to_complete>\n"
|
||||
"</workunit>\n",
|
||||
if (strlen(buffer) + strlen(text) > MAX_BLOB_SIZE-1) return -1;
|
||||
p = strstr(buffer, after);
|
||||
if (!p) return -1;
|
||||
p += strlen(after);
|
||||
strcpy(temp, p);
|
||||
strcpy(p, text);
|
||||
strcat(p, temp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// add elements in xml_doc:
|
||||
// WU name, and estimation of how many seconds it will take
|
||||
//
|
||||
int insert_wu_tags(WORKUNIT& wu, double seconds) {
|
||||
char buf[256];
|
||||
int retval;
|
||||
|
||||
sprintf(buf,
|
||||
" <seconds_to_complete>%f</seconds_to_complete>\n",
|
||||
seconds
|
||||
);
|
||||
return 0;
|
||||
retval = insert_after(wu.xml_doc, "<workunit>\n", buf);
|
||||
if (retval) return retval;
|
||||
sprintf(buf, " <name>%s</name>\n", wu.name);
|
||||
return insert_after(wu.xml_doc, "<workunit>\n", buf);
|
||||
}
|
||||
|
||||
// add the given workunit to a reply.
|
||||
|
@ -84,6 +100,7 @@ int add_wu_to_reply(
|
|||
APP* app;
|
||||
APP_VERSION* app_version;
|
||||
int retval;
|
||||
WORKUNIT wu2;
|
||||
|
||||
app = ss.lookup_app(wu.appid);
|
||||
if (!app) return -1;
|
||||
|
@ -98,9 +115,10 @@ int add_wu_to_reply(
|
|||
|
||||
// add time estimate to reply
|
||||
//
|
||||
retval = insert_time_tag(wu, seconds_to_complete);
|
||||
wu2 = wu; // make copy since we're going to modify its XML field
|
||||
retval = insert_wu_tags(wu2, seconds_to_complete);
|
||||
if (retval) return retval;
|
||||
reply.insert_workunit_unique(wu);
|
||||
reply.insert_workunit_unique(wu2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -278,6 +296,11 @@ int handle_results(
|
|||
|
||||
for (i=0; i<sreq.results.size(); i++) {
|
||||
rp = &sreq.results[i];
|
||||
// acknowledge the result even if we couldn't find it --
|
||||
// don't want it to keep coming back
|
||||
//
|
||||
reply.result_acks.push_back(*rp);
|
||||
|
||||
strncpy(result.name, rp->name, sizeof(result.name));
|
||||
retval = db_result_lookup_name(result);
|
||||
if (retval) {
|
||||
|
@ -325,15 +348,23 @@ int handle_results(
|
|||
retval = db_workunit_update(wu);
|
||||
}
|
||||
}
|
||||
|
||||
// acknowledge the result even if we couldn't find it --
|
||||
// don't want it to keep coming back
|
||||
//
|
||||
reply.result_acks.push_back(*rp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int insert_name_tags(RESULT& result, WORKUNIT& wu) {
|
||||
char buf[256];
|
||||
int retval;
|
||||
|
||||
sprintf(buf, "<name>%s</name>\n", result.name);
|
||||
retval = insert_after(result.xml_doc_in, "<result>\n", buf);
|
||||
if (retval) return retval;
|
||||
sprintf(buf, "<wu_name>%s</wu_name>\n", wu.name);
|
||||
retval = insert_after(result.xml_doc_in, "<result>\n", buf);
|
||||
if (retval) return retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int send_work(
|
||||
SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform,
|
||||
SCHED_SHMEM& ss
|
||||
|
@ -363,14 +394,22 @@ int send_work(
|
|||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
wu = ss.wu_results[i].workunit;
|
||||
result = ss.wu_results[i].result;
|
||||
ss.wu_results[i].present = false;
|
||||
|
||||
|
||||
retval = add_wu_to_reply(wu, reply, platform, ss,
|
||||
estimate_duration(wu, reply.host)
|
||||
);
|
||||
if (retval) continue;
|
||||
|
||||
fprintf(stderr, "sending result name %s, id %d\n", result.name, result.id);
|
||||
|
||||
retval = insert_name_tags(result, wu);
|
||||
if (retval) {
|
||||
fprintf(stderr, "send_work: can't insert name tags\n");
|
||||
}
|
||||
reply.insert_result(result);
|
||||
seconds_to_fill -= (int)estimate_duration(wu, reply.host);
|
||||
|
||||
|
|
|
@ -35,13 +35,8 @@ using namespace std;
|
|||
#include "handle_request.h"
|
||||
#include "main.h"
|
||||
|
||||
#if 1
|
||||
#define REQ_FILE_PREFIX "/tmp/boinc_req_"
|
||||
#define REPLY_FILE_PREFIX "/tmp/boinc_reply_"
|
||||
#else
|
||||
#define REQ_FILE_PREFIX "/disks/milkyway/a/users/anderson/boinc_cvs/boinc/sched/boinc_req_"
|
||||
#define REPLY_FILE_PREFIX "/disks/milkyway/a/users/anderson/boinc_cvs/boinc/sched/boinc_reply_"
|
||||
#endif
|
||||
#define REQ_FILE_PREFIX "boinc_req_"
|
||||
#define REPLY_FILE_PREFIX "boinc_reply_"
|
||||
|
||||
PROJECT gproject;
|
||||
CONFIG config;
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
// make_work.C
|
||||
//
|
||||
// Create result records as needed to maintain a pool to send
|
||||
//
|
||||
// This reads a result record from the DB, then makes clones of it.
|
||||
// Assumes the result has a single output file,
|
||||
// so overwrites the first <name> element with a new name
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "config.h"
|
||||
|
||||
#define TRIGGER_FILENAME "stop_server"
|
||||
|
||||
void check_trigger() {
|
||||
FILE* f = fopen(TRIGGER_FILENAME, "r");
|
||||
if (!f) return;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void replace_element(char* buf, char* start, char* end, char* replacement) {
|
||||
char temp[MAX_BLOB_SIZE], *p, *q;
|
||||
|
||||
p = strstr(buf, start);
|
||||
p += strlen(start);
|
||||
q = strstr(p, end);
|
||||
strcpy(temp, q);
|
||||
strcpy(p, replacement);
|
||||
strcat(p, temp);
|
||||
}
|
||||
|
||||
void make_work() {
|
||||
CONFIG config;
|
||||
RESULT result;
|
||||
int retval, i=time(0), n;
|
||||
char buf[256];
|
||||
|
||||
retval = config.parse_file();
|
||||
if (retval) {
|
||||
fprintf(stderr, "make_work: can't read config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
retval = db_open(config.db_name, config.db_passwd);
|
||||
if (retval) {
|
||||
fprintf(stderr, "make_work: can't open db\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
retval = db_result(1, result);
|
||||
if (retval) {
|
||||
fprintf(stderr, "make_work: can't read result\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
fflush(stdout);
|
||||
retval = db_result_count_state(RESULT_STATE_UNSENT, n);
|
||||
if (retval) {
|
||||
fprintf(stderr, "make_work: can't counts results\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("make_work: %d results\n", n);
|
||||
if (n > 10) {
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
result.id = 0;
|
||||
result.create_time = time(0);
|
||||
sprintf(result.name, "result_%d", i++);
|
||||
result.state = RESULT_STATE_UNSENT;
|
||||
result.validate_state = VALIDATE_STATE_INITIAL;
|
||||
replace_element(result.xml_doc_in, "<name>", "</name>", result.name);
|
||||
replace_element(result.xml_doc_in, "<file_name>", "</file_name>", result.name);
|
||||
retval = db_result_new(result);
|
||||
if (retval) {
|
||||
fprintf(stderr, "make_work: can't create result\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("make_work: added a result\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
bool asynch = false;
|
||||
int i;
|
||||
|
||||
unlink(TRIGGER_FILENAME);
|
||||
for (i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-asynch")) {
|
||||
asynch = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (asynch) {
|
||||
if (!fork()) {
|
||||
make_work();
|
||||
}
|
||||
} else {
|
||||
make_work();
|
||||
}
|
||||
}
|
|
@ -6,8 +6,6 @@
|
|||
<max_nbytes>100000</max_nbytes>
|
||||
</file_info>
|
||||
<result>
|
||||
<name><RESULT_NAME/></name>
|
||||
<wu_name><WU_NAME/></wu_name>
|
||||
<file_ref>
|
||||
<file_name><OUTFILE_0/></file_name>
|
||||
<open_name>out</open_name>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<workunit>
|
||||
<name><WU_NAME/></name>
|
||||
<app_name>1sec</app_name>
|
||||
</workunit>
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<max_nbytes>120000</max_nbytes>
|
||||
</file_info>
|
||||
<result>
|
||||
<name><RESULT_NAME/></name>
|
||||
<wu_name><WU_NAME/></wu_name>
|
||||
<file_ref>
|
||||
<file_name><OUTFILE_0/></file_name>
|
||||
<open_name>out</open_name>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<md5_cksum><MD5_1/></md5_cksum>
|
||||
</file_info>
|
||||
<workunit>
|
||||
<name><WU_NAME/></name>
|
||||
<app_name>concat</app_name>
|
||||
<file_ref>
|
||||
<file_name><INFILE_0/></file_name>
|
||||
|
|
|
@ -13,5 +13,5 @@
|
|||
$project->add_app($app);
|
||||
$project->add_app_version($app_version);
|
||||
$project->install();
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
?>
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<max_nbytes>100000</max_nbytes>
|
||||
</file_info>
|
||||
<result>
|
||||
<name><RESULT_NAME/></name>
|
||||
<wu_name><WU_NAME/></wu_name>
|
||||
<output_file>
|
||||
<file_name><OUTFILE_0/></file_name>
|
||||
<open_name>outfile.sah</open_name>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<md5_cksum><MD5_0/></md5_cksum>
|
||||
</file_info>
|
||||
<workunit>
|
||||
<name><WU_NAME/></name>
|
||||
<app_name>setiathome-3.06</app_name>
|
||||
<input_file>
|
||||
<file_name><INFILE_0/></file_name>
|
||||
|
|
|
@ -128,7 +128,8 @@ class Project {
|
|||
$this->master_url = get_env_var("BOINC_HTML_URL")."/".$this->name."/html_user/index.html";
|
||||
PassThru("rm -rf $this->project_dir");
|
||||
PassThru("mkdir $this->project_dir");
|
||||
PassThru("mkdir $this->project_dir/cgi");
|
||||
// make the CGI writeable in case scheduler writes req/reply files
|
||||
PassThru("mkdir $this->project_dir/cgi; chmod uog+w $this->project_dir/cgi");
|
||||
PassThru("mkdir $this->project_dir/upload; chmod uog+w $this->project_dir/upload");
|
||||
PassThru("mkdir $this->project_dir/download");
|
||||
PassThru("mkdir $this->project_dir/keys");
|
||||
|
@ -174,11 +175,12 @@ class Project {
|
|||
run_tool("add app_version -db_name $this->db_name -app_name $app->name -platform_name $platform -version $app_version->version -download_dir $this->project_dir/download -download_url $this->download_url -code_sign_keyfile $this->key_dir/code_sign_private -exec_dir $source_dir/apps -exec_files $app_version->exec_name");
|
||||
}
|
||||
|
||||
// copy the CGI programs and feeder to the project dir,
|
||||
// copy the server programs to the project /cgi dir,
|
||||
// and make a config file there
|
||||
//
|
||||
PassThru("cp $source_dir/sched/cgi $this->project_dir/cgi/");
|
||||
PassThru("cp $source_dir/sched/file_upload_handler $this->project_dir/cgi/");
|
||||
PassThru("cp $source_dir/sched/make_work $this->project_dir/cgi/");
|
||||
PassThru("cp $source_dir/sched/feeder $this->project_dir/cgi/");
|
||||
$f = fopen("$this->project_dir/cgi/config.xml", "w");
|
||||
fputs($f, "<config>\n");
|
||||
|
@ -227,16 +229,20 @@ class Project {
|
|||
// show the URLs for user and admin sites
|
||||
//
|
||||
echo "The master URL for project $this->name is $this->master_url\n";
|
||||
$admin_url = $html_url.$this->name."/html_ops/index.html";
|
||||
$admin_url = $html_url."/".$this->name."/html_ops/index.html";
|
||||
echo "The admin URL for project $this->name is $admin_url\n";
|
||||
}
|
||||
|
||||
function start(){
|
||||
function start_feeder(){
|
||||
PassThru("cd $this->project_dir/cgi; feeder -asynch > feeder_out");
|
||||
}
|
||||
|
||||
function start_make_work(){
|
||||
PassThru("cd $this->project_dir/cgi; make_work -asynch > make_work_out");
|
||||
}
|
||||
|
||||
function stop() {
|
||||
$f = fopen($this->project_dir."/cgi/feeder_trigger", "w");
|
||||
$f = fopen($this->project_dir."/cgi/stop_server", "w");
|
||||
fputs($f, "<quit/>\n");
|
||||
fclose($f);
|
||||
}
|
||||
|
@ -358,7 +364,7 @@ class Host {
|
|||
echo "Running core client\n";
|
||||
$source_dir = get_env_var("BOINC_SRC_DIR");
|
||||
$platform = get_env_var("BOINC_PLATFORM");
|
||||
PassThru("cd $this->host_dir; $source_dir/client/boinc_1_$platform $args");
|
||||
PassThru("cd $this->host_dir; $source_dir/client/boinc_1_$platform $args> client.out");
|
||||
}
|
||||
|
||||
// read a CPU time file written by the client.
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
$work->install($project1);
|
||||
$work->install($project2);
|
||||
|
||||
$project1->start();
|
||||
$project2->start();
|
||||
$project1->start_feeder();
|
||||
$project2->start_feeder();
|
||||
$host->run("-exit_when_idle");
|
||||
$project1->stop();
|
||||
$project2->stop();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
array_push($work->input_files, "input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
#! /usr/local/bin/php
|
||||
<?php
|
||||
// This tests whether the most basic mechanisms are working
|
||||
// Also whether stderr output is reported correctly
|
||||
|
||||
include_once("test.inc");
|
||||
|
||||
$project = new Project;
|
||||
$user = new User();
|
||||
$host = new Host($user);
|
||||
$app = new App("upper_case");
|
||||
$app_version = new App_Version($app);
|
||||
|
||||
$project->add_user($user);
|
||||
$project->add_app($app);
|
||||
$project->add_app_version($app_version);
|
||||
$project->install(); // must install projects before adding to hosts
|
||||
|
||||
$host->log_flags = "log_flags.xml";
|
||||
$host->add_project($project);
|
||||
$host->install();
|
||||
|
||||
echo "adding work\n";
|
||||
|
||||
$work = new Work($app);
|
||||
$work->wu_template = "uc_wu";
|
||||
$work->result_template = "uc_result";
|
||||
$work->nresults = 2;
|
||||
array_push($work->input_files, "input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start_feeder();
|
||||
$project->start_make_work();
|
||||
$host->run("");
|
||||
//$project->stop();
|
||||
|
||||
//$result->state = RESULT_STATE_DONE;
|
||||
//$result->stderr_out = "APP: upper_case: starting, argc 1";
|
||||
//$result->exit_status = 0;
|
||||
//$project->check_results(2, $result);
|
||||
//$project->compare_file("uc_wu_0_0", "uc_correct_output");
|
||||
//$project->compare_file("uc_wu_1_0", "uc_correct_output");
|
||||
?>
|
|
@ -29,7 +29,7 @@
|
|||
array_push($work->input_files, "small_input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
|
||||
echo "Now run the client manually; start and stop it a few times.\n";
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
array_push($work->input_files, "input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
array_push($work->input_files, "input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
array_push($work->input_files, "small_input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
$app_time = 0;
|
||||
$host->run("-exit_after 400");
|
||||
$app_time += $host->read_cpu_time_file("app.time");
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
array_push($work->input_files, "input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
array_push($work->input_files, "small_input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
echo "Now run the client manually; start and stop it a few times\n";
|
||||
//compare_file("ucs_wu_0_0", "uc_small_correct_output");
|
||||
?>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
array_push($work->input_files, "input");
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$project->start_feeder();
|
||||
|
||||
echo "go run the client\n";
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<url><UPLOAD_URL/></url>
|
||||
</file_info>
|
||||
<result>
|
||||
<name><RESULT_NAME/></name>
|
||||
<wu_name><WU_NAME/></wu_name>
|
||||
<file_ref>
|
||||
<file_name><OUTFILE_0/></file_name>
|
||||
<open_name>out</open_name>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<md5_cksum><MD5_0/></md5_cksum>
|
||||
</file_info>
|
||||
<workunit>
|
||||
<name><WU_NAME/></name>
|
||||
<app_name>upper_case</app_name>
|
||||
<file_ref>
|
||||
<file_name><INFILE_0/></file_name>
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
<max_nbytes>100000</max_nbytes>
|
||||
</file_info>
|
||||
<result>
|
||||
<name><RESULT_NAME/></name>
|
||||
<wu_name><WU_NAME/></wu_name>
|
||||
<file_ref>
|
||||
<file_name><OUTFILE_0/></file_name>
|
||||
<open_name>out</open_name>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<md5_cksum><MD5_0/></md5_cksum>
|
||||
</file_info>
|
||||
<workunit>
|
||||
<name><WU_NAME/></name>
|
||||
<app_name>upper_case</app_name>
|
||||
<file_ref>
|
||||
<file_name><INFILE_0/></file_name>
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#define INFILE_MACRO "<INFILE_"
|
||||
#define MD5_MACRO "<MD5_"
|
||||
#define WU_NAME_MACRO "<WU_NAME/>"
|
||||
#define RESULT_NAME_MACRO "<RESULT_NAME/>"
|
||||
#define OUTFILE_MACRO "<OUTFILE_"
|
||||
#define UPLOAD_URL_MACRO "<UPLOAD_URL/>"
|
||||
#define DOWNLOAD_URL_MACRO "<DOWNLOAD_URL/>"
|
||||
|
@ -57,7 +55,6 @@ int read_filename(char* path, char* buf) {
|
|||
|
||||
// replace INFILE_x with filename from array,
|
||||
// MD5_x with checksum of file,
|
||||
// WU_NAME with WU name
|
||||
//
|
||||
static int process_wu_template(
|
||||
char* wu_name, char* tmplate, char* out,
|
||||
|
@ -122,13 +119,6 @@ static int process_wu_template(
|
|||
strcpy(p, md5);
|
||||
strcat(p, buf);
|
||||
}
|
||||
p = strstr(out, WU_NAME_MACRO);
|
||||
if (p) {
|
||||
found = true;
|
||||
strcpy(buf, p+strlen(WU_NAME_MACRO));
|
||||
strcpy(p, wu_name);
|
||||
strcat(p, buf);
|
||||
}
|
||||
if (!found) break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -161,7 +151,7 @@ int create_result(
|
|||
result_template_file,
|
||||
tempfile,
|
||||
key,
|
||||
base_outfile_name, wu.name, r.name,
|
||||
base_outfile_name,
|
||||
upload_url, download_url
|
||||
);
|
||||
rewind(tempfile);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
extern int process_result_template(
|
||||
FILE* in, FILE* out,
|
||||
R_RSA_PRIVATE_KEY& key,
|
||||
char* base_filename, char* wu_name, char* result_name,
|
||||
char* base_filename,
|
||||
char* upload_url, char* download_url
|
||||
);
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#include "parse.h"
|
||||
#include "crypt.h"
|
||||
|
||||
#define WU_NAME_MACRO "<WU_NAME/>"
|
||||
#define RESULT_NAME_MACRO "<RESULT_NAME/>"
|
||||
#define OUTFILE_MACRO "<OUTFILE_"
|
||||
#define UPLOAD_URL_MACRO "<UPLOAD_URL/>"
|
||||
#define DOWNLOAD_URL_MACRO "<DOWNLOAD_URL/>"
|
||||
|
@ -41,7 +39,7 @@
|
|||
int process_result_template(
|
||||
FILE* in, FILE* out,
|
||||
R_RSA_PRIVATE_KEY& key,
|
||||
char* base_filename, char* wu_name, char* result_name,
|
||||
char* base_filename,
|
||||
char* upload_url, char* download_url
|
||||
) {
|
||||
char* p,*q, *signed_xml=strdup("");
|
||||
|
@ -55,8 +53,6 @@ int process_result_template(
|
|||
assert(in!=NULL);
|
||||
assert(out!=NULL);
|
||||
assert(base_filename!=NULL);
|
||||
assert(wu_name!=NULL);
|
||||
assert(result_name!=NULL);
|
||||
while (fgets(buf, 256, in)) {
|
||||
|
||||
// when we reach the end of a <file_info> element,
|
||||
|
@ -113,20 +109,6 @@ int process_result_template(
|
|||
strcpy(p, download_url);
|
||||
strcat(p, temp);
|
||||
}
|
||||
p = strstr(buf, WU_NAME_MACRO);
|
||||
if (p) {
|
||||
found = true;
|
||||
strcpy(temp, p+strlen(WU_NAME_MACRO));
|
||||
strcpy(p, wu_name);
|
||||
strcat(p, temp);
|
||||
}
|
||||
p = strstr(buf, RESULT_NAME_MACRO);
|
||||
if (p) {
|
||||
found = true;
|
||||
strcpy(temp, p+strlen(RESULT_NAME_MACRO));
|
||||
strcpy(p, result_name);
|
||||
strcat(p, temp);
|
||||
}
|
||||
if (!found) break;
|
||||
}
|
||||
strcatdup(signed_xml, buf);
|
||||
|
|
Loading…
Reference in New Issue