David 19 Apr 2007

- Change things so that make_project installs a test application
        (uppercase) and the daemons to go along with it
        (sample_work_generator, sample_bitwise_validator, sample_assimilator).
        This is mostly working, not completely.

    apps
        upper_case.C
    html/ops/
        mass_email_script.php
    py/Boinc/
        setup_project.py
    sched/
        sched_config.C,h
        sample_work_generator.C
    tools/
        make_project
        project.xml
        Makefile.am

svn path=/trunk/boinc/; revision=12422
This commit is contained in:
David Anderson 2007-04-19 22:11:25 +00:00
parent ac6974b62b
commit 1880a50cc5
11 changed files with 115 additions and 52 deletions

View File

@ -28,7 +28,7 @@
// NOTE: this is NOT a sample BOINC application.
// Look in boinc_samples/uppercase for that.
// This is a bare-bones application (no graphics)
// that's used by the test_uc.py script.
// that's used for testing and as a placeholder.
#ifdef _WIN32
#include "boinc_win.h"

View File

@ -3770,3 +3770,22 @@ Rom 19 Apr 2007
cpp.h
cs_scheduler.C
David 19 Apr 2007
- Change things so that make_project installs a test application
(uppercase) and the daemons to go along with it
(sample_work_generator, sample_bitwise_validator, sample_assimilator).
This is mostly working, not completely.
apps
upper_case.C
html/ops/
mass_email_script.php
py/Boinc/
setup_project.py
sched/
sched_config.C,h
sample_work_generator.C
tools/
make_project
project.xml
Makefile.am

View File

@ -42,6 +42,10 @@ list_item(
return work really late after the deadline -- so late that
the corresponding WU has been deleted from the database."
);
list_item(
"-dont_delete_batches",
"If this boolean is set, the file deleter won't delete any files for which the corresponding workunit or result record has a positive value of the the 'batch' field. This lets you keep files on disk until you're done with them. Create workunits with a positive batch number, and zero out (or negate) the batch number when you're done looking at the files (you can do this with a SQL query). If you use this option, replace the indices on file_delete_state with indices on (file_delete_state, batch)."
);
list_end();
echo "

View File

@ -217,33 +217,28 @@ function main($email_files) {
$f = fopen($mass_email_log, 'a');
$n = 10;
if ($id_file == "") {
while (1) {
$new_startid = do_batch($email_files, $startid, $n, $f);
if ($new_startid == $startid) break;
$startid = $new_startid;
}
while (1) {
$new_startid = do_batch($email_files, $startid, $n, $f);
if ($new_startid == $startid) break;
$startid = $new_startid;
}
} else {
$fid = fopen($id_file, 'r');
if (!$fid) {
echo $id_file . ' not found - create id list and run again\n';
exit();
}
$thisid = 0;
while (fscanf($fid, '%d', &$thisid)) {
if ($thisid > $startid) {
do_one($email_files, $thisid, $f);
}
}
fclose($fid);
$fid = fopen($id_file, 'r');
if (!$fid) {
echo $id_file . ' not found - create id list and run again\n';
exit();
}
$thisid = 0;
while (fscanf($fid, '%d', &$thisid)) {
if ($thisid > $startid) {
do_one($email_files, $thisid, $f);
}
}
fclose($fid);
}
echo 'All done!' . "\n";
}
function test($email_files) {
}
if (!$USE_PHPMAILER) {
echo "You must use PHPMailer.\n";
exit();

View File

@ -343,6 +343,7 @@ def install_boinc_files(dest_dir):
[ 'make_work', 'feeder', 'transitioner',
'sample_bitwise_validator', 'sample_trivial_validator',
'file_deleter', 'sample_dummy_assimilator',
'sample_assimilator', 'sample_work_generator',
'update_stats', 'db_dump', 'db_purge' ])
map(lambda (s): install(srcdir('sched',s), dir('bin',s)),
[ 'start', 'show_shmem' ])

View File

@ -56,6 +56,7 @@ int make_job() {
DB_WORKUNIT wu;
char name[256], path[256], buf[256];
const char* infiles[1];
int retval;
// make a unique name (for the job and its input file)
//
@ -64,7 +65,8 @@ int make_job() {
// Create the input file.
// Put it at the right place in the download dir hierarchy
//
config.download_path(name, path);
retval = config.download_path(name, path);
if (retval) return retval;
FILE* f = fopen(path, "w");
if (!f) return ERR_FOPEN;
fprintf(f, "This is the input file for job %s", name);
@ -76,15 +78,15 @@ int make_job() {
wu.appid = app.id;
strcpy(wu.name, name);
wu.target_nresults = REPLICATION_FACTOR;
infiles[0] = path;
infiles[0] = name;
// Register the job with BOINC
//
return create_work(
wu,
wu_template,
"result_uppercase.xml",
"../templates/results_uppercase.xml",
"uc_result",
"../templates/uc_result",
infiles,
1,
config
@ -101,9 +103,17 @@ void main_loop() {
if (n > CUSHION) {
sleep(60);
} else {
int njobs = n/REPLICATION_FACTOR;
int njobs = (CUSHION-n)/REPLICATION_FACTOR+1;
log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,
"Making %d jobs\n", njobs
);
for (int i=0; i<njobs; i++) {
retval = make_job();
if (retval) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,
"can't make job: %d\n", retval
);
}
}
}
}
@ -130,13 +140,15 @@ int main() {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "can't find app\n");
exit(1);
}
if (read_file_malloc("../templates/wu_uppercase.xml", wu_template)) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "can't read template\n");
if (read_file_malloc("../templates/uc_wu", wu_template)) {
log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "can't read WU template\n");
exit(1);
}
start_time = time(0);
seqno = 0;
log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "Starting\n");
main_loop();
}

View File

@ -163,12 +163,12 @@ int SCHED_CONFIG::parse_file(const char* dir) {
return retval;
}
void SCHED_CONFIG::upload_path(const char* filename, char* path) {
::dir_hier_path(filename, upload_dir, uldl_dir_fanout, path, true);
int SCHED_CONFIG::upload_path(const char* filename, char* path) {
return ::dir_hier_path(filename, upload_dir, uldl_dir_fanout, path, true);
}
void SCHED_CONFIG::download_path(const char* filename, char* path) {
::dir_hier_path(filename, download_dir, uldl_dir_fanout, path);
int SCHED_CONFIG::download_path(const char* filename, char* path) {
return ::dir_hier_path(filename, download_dir, uldl_dir_fanout, path, true);
}
void get_project_dir(char* p, int len) {

View File

@ -88,8 +88,8 @@ public:
int parse(FILE*);
int parse_file(const char* dir=".");
void upload_path(const char*, char*);
void download_path(const char*, char*);
int upload_path(const char*, char*);
int download_path(const char*, char*);
};
// get the project's home directory

View File

@ -21,12 +21,12 @@ sign_executable_LDADD = $(BOINC_LIB) $(RSA_LIBS) $(MYSQL_LIBS)
dir_hier_path_SOURCES = \
dir_hier_path.C
dir_hier_path_LDADD = $(SCHED_LIB) $(BOINC_LIB)
dir_hier_path_LDADD = $(SCHED_LIB) $(BOINC_LIB) $(MYSQL_LIBS)
dir_hier_move_SOURCES = \
dir_hier_move.C
dir_hier_move_LDADD = $(SCHED_LIB) $(BOINC_LIB)
dir_hier_move_LDADD = $(SCHED_LIB) $(BOINC_LIB) $(MYSQL_LIBS)
updater_SOURCES = updater.C

View File

@ -35,6 +35,7 @@ Misc options:
--user_name default: $USER (%(USER)s)
--delete_prev_inst delete project-root first (from prev installation)
--drop_db_first drop database first (from prev installation)
--no_test_app don't install test application
Dir-options:
--project_root default: HOME/projects/PROJECT
@ -52,10 +53,10 @@ Other:
--db_host default: None
Example command line:
./make_project --project_root $HOME/boinc/projects --url_base http://boink/ yah 'YETI @ Home'
./make_project --project_root $HOME/boinc/projects --url_base http://tah.org/ tah 'Test@home'
Then upload_dir = $HOME/boinc/projects/yah/upload
and cgi_url = http://boink/yah_cgi/
Then upload_dir = $HOME/boinc/projects/tah/upload
and cgi_url = http://tah.org/tah_cgi/
By default, directory options will be queried if they do not exist yet.
@ -74,6 +75,7 @@ try:
'help',
'verbose=',
'no_query',
'no_test_app',
'user_name=',
'drop_db_first',
'delete_prev_inst',
@ -95,6 +97,7 @@ except getopt.GetoptError, e:
options.url_base = None
options.no_query = False
options.no_test_app = False
options.delete_prev_inst = False
for o,a in opts:
@ -102,6 +105,7 @@ for o,a in opts:
elif o == '-v': options.echo_verbose = 2
elif o == '--verbose': options.echo_verbose = int(a)
elif o == '--no_query': options.no_query = True
elif o == '--no_test_app': options.no_test_app = True
elif o == '--user_name': options.user_name = a
elif o == '--drop_db_first': options.drop_db_first = True
elif o == '--delete_prev_inst': options.delete_prev_inst = True
@ -206,19 +210,36 @@ project = Project(
)
project.install_project()
proot = delete_slash(options.project_root)
# set up default daemons
project.sched_install('feeder')
project.sched_install('transitioner')
project.sched_install('file_deleter')
if not options.no_test_app:
project.config.daemons.make_node_and_append("daemon").cmd = 'sample_work_generator -d 3'
project.config.daemons.make_node_and_append("daemon").cmd = 'sample_bitwise_validator -d 3 -app uppercase'
project.config.daemons.make_node_and_append("daemon").cmd = 'sample_assimilator -d 3 -app uppercase'
project.config.write()
print '''Done installing default daemons.'''
# copy the test app if needed
if not options.no_test_app:
pname = 'i686-pc-linux-gnu'
dname = 'uppercase_1.1_'+pname
ucdir = proot+'/apps/uppercase/'
versdir = ucdir+dname
filepath = versdir+'/'+dname
os.mkdir(ucdir)
os.mkdir(versdir)
shutil.copy('../apps/upper_case', filepath)
httpd_conf_template_filename = os.path.join(
options.project_root,
project_shortname+'.httpd.conf'
)
proot = delete_slash(options.project_root)
html_user_url = options.html_user_url
html_ops_url = options.html_ops_url
@ -251,7 +272,7 @@ print '''Done installing files.
Steps to complete installation:
1. Change Apache configuration:
1. Change Apache configuration (as root):
cat %(httpd_conf_template_filename)s >> /etc/apache/httpd.conf && apachectl restart
@ -263,19 +284,26 @@ Steps to complete installation:
0,5,10,15,20,25,30,35,40,45,50,55 * * * * %(proot)s/bin/start --cron
To start, show status, stop BOINC daemons run:
3. The project is configured with a test application.
To install this application (recommended) run:
cd %(proot)s
bin/xadd
bin/update_versions
%(proot)s/bin/start
%(proot)s/bin/status
%(proot)s/bin/stop
To start, show status, and stop the project, run:
bin/start
bin/status
bin/stop
Master URL: %(html_user_url)s
Administration URL: %(html_ops_url)s
The project's URLs are:
Home page (and master URL): %(html_user_url)s
Administrative page: %(html_ops_url)s
3. Add Work Generator, Validator and Assimilator daemons for your applications
----------------------------
Further steps are necessary to add applications and work.
To use this project for your own computations, you'll need to
- Port your application(s) and add them
- Develop programs to submit and handle jobs
See the online documentation at http://boinc.berkeley.edu/
'''%locals()

View File

@ -3,6 +3,10 @@
<name>windows_intelx86</name>
<user_friendly_name>Microsoft Windows (98 or later) running on an Intel x86-compatible CPU</user_friendly_name>
</platform>
<platform>
<name>windows_x86_64</name>
<user_friendly_name>Microsoft Windows running on an AMD x86_64 or Intel EM64T CPU</user_friendly_name>
</platform>
<platform>
<name>i686-pc-linux-gnu</name>
<user_friendly_name>Linux running on an Intel x86-compatible CPU</user_friendly_name>