mirror of https://github.com/BOINC/boinc.git
- server: add stage_file to project setup; add error checking to stage_file
This commit is contained in:
parent
d3fbcaf8d5
commit
5cbccf7126
|
@ -6323,3 +6323,12 @@ Rom 23 Oct 2012
|
|||
|
||||
clientscr/
|
||||
screensaver_x11.cpp
|
||||
|
||||
David 23 Oct 2012
|
||||
- server: add stage_file to project setup; add error checking to stage_file
|
||||
|
||||
py/Boinc/
|
||||
setup_project.py
|
||||
tools/
|
||||
create_work_example
|
||||
stage_file
|
||||
|
|
|
@ -344,10 +344,21 @@ def install_boinc_files(dest_dir, install_web_files, install_server_files):
|
|||
force_symlink(dir('bin', 'start'), dir('bin', 'stop'))
|
||||
force_symlink(dir('bin', 'start'), dir('bin', 'status'))
|
||||
map(lambda (s): install(srcdir('py/Boinc',s), dir('py/Boinc',s)),
|
||||
[ '__init__.py', 'add_util.py', 'boinc_db.py', 'boinc_project_path.py',
|
||||
'boincxml.py', 'configxml.py', 'database.py',
|
||||
'db_base.py', 'db_mid.py', 'projectxml.py',
|
||||
'sched_messages.py', 'tools.py', 'util.py' ])
|
||||
[
|
||||
'__init__.py',
|
||||
'add_util.py',
|
||||
'boinc_db.py',
|
||||
'boinc_project_path.py',
|
||||
'boincxml.py',
|
||||
'configxml.py',
|
||||
'database.py',
|
||||
'db_base.py',
|
||||
'db_mid.py',
|
||||
'projectxml.py',
|
||||
'sched_messages.py',
|
||||
'tools.py',
|
||||
'util.py'
|
||||
])
|
||||
print >>open(dir('bin', 'boinc_path_config.py'), 'w'), '''
|
||||
# Generated by make_project
|
||||
import sys, os
|
||||
|
@ -372,23 +383,54 @@ sys.path.insert(0, os.path.join('%s', 'py'))
|
|||
map(lambda (s): install(builddir('sched',s), dir('cgi-bin',s)),
|
||||
[ 'cgi', 'file_upload_handler'])
|
||||
map(lambda (s): install(builddir('sched',s), dir('bin',s)),
|
||||
[ 'make_work', 'feeder', 'transitioner', 'transitioner_catchup.php',
|
||||
'sample_bitwise_validator', 'sample_trivial_validator',
|
||||
'file_deleter', 'antique_file_deleter',
|
||||
'sample_dummy_assimilator',
|
||||
'sample_assimilator', 'sample_work_generator',
|
||||
'single_job_assimilator',
|
||||
'assimilator.py', 'pymw_assimilator.py',
|
||||
'update_stats', 'db_dump', 'db_purge', 'show_shmem', 'census',
|
||||
'delete_file', 'get_file', 'put_file' ])
|
||||
[
|
||||
'antique_file_deleter',
|
||||
'assimilator.py',
|
||||
'census',
|
||||
'db_dump',
|
||||
'db_purge',
|
||||
'delete_file',
|
||||
'feeder',
|
||||
'file_deleter',
|
||||
'get_file',
|
||||
'make_work',
|
||||
'put_file',
|
||||
'pymw_assimilator.py',
|
||||
'sample_assimilator',
|
||||
'sample_bitwise_validator',
|
||||
'sample_dummy_assimilator',
|
||||
'sample_trivial_validator',
|
||||
'sample_work_generator',
|
||||
'show_shmem',
|
||||
'single_job_assimilator',
|
||||
'transitioner',
|
||||
'transitioner_catchup.php',
|
||||
'update_stats'
|
||||
])
|
||||
map(lambda (s): install(builddir('vda',s), dir('bin',s)),
|
||||
[ 'vda', 'vdad' ])
|
||||
map(lambda (s): install(srcdir('tools',s), dir('bin',s)),
|
||||
[ 'appmgr', 'create_work', 'xadd', 'dbcheck_files_exist', 'run_in_ops',
|
||||
'update_versions', 'parse_config', 'grep_logs', 'db_query',
|
||||
'watch_tcp', 'sign_executable', 'dir_hier_move',
|
||||
'manage_privileges', 'cancel_jobs',
|
||||
'dir_hier_path', 'boinc_submit', 'demo_submit', 'demo_query' ])
|
||||
[
|
||||
'appmgr',
|
||||
'boinc_submit',
|
||||
'cancel_jobs',
|
||||
'create_work',
|
||||
'dbcheck_files_exist',
|
||||
'db_query',
|
||||
'demo_query',
|
||||
'demo_submit',
|
||||
'dir_hier_move',
|
||||
'dir_hier_path',
|
||||
'grep_logs',
|
||||
'manage_privileges',
|
||||
'parse_config',
|
||||
'run_in_ops',
|
||||
'sign_executable',
|
||||
'stage_file',
|
||||
'update_versions',
|
||||
'watch_tcp',
|
||||
'xadd'
|
||||
])
|
||||
map(lambda (s): install(srcdir('lib',s), dir('bin',s)),
|
||||
[ 'crypt_prog' ])
|
||||
map(lambda (s): install(srcdir('sched',s), dir('',s)),
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# example of how to create a workunit
|
||||
|
||||
# copy the input file from a known place into the download hierarchy
|
||||
# stage the input file
|
||||
#
|
||||
cp download/input `bin/dir_hier_path input`
|
||||
bin/stage_file --copy project.xml
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "stage_file failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run create_work to create the WU.
|
||||
# The WU name ("wu_nodelete") includes the string "nodelete".
|
||||
# This causes the file deleter to not delete its input files,
|
||||
# so that we can use make_work.
|
||||
#
|
||||
bin/create_work --appname example_app --wu_name wu_nodelete --wu_template templates/example_app_in --result_template templates/example_app_out input
|
||||
bin/create_work --appname example_app --wu_name wu_nodelete --wu_template templates/example_app_in --result_template templates/example_app_out project.xml
|
||||
|
|
|
@ -30,18 +30,24 @@
|
|||
// Use this if you specify <gzip> in the <file_info>
|
||||
// --copy Copy the file (default is to move it)
|
||||
|
||||
function error_exit($msg) {
|
||||
echo $msg;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!file_exists("html/inc/dir_hier.inc")
|
||||
|| !file_exists("config.xml")
|
||||
) {
|
||||
die("This script must be run in the project directory.\n");
|
||||
error_exit("This script must be run in the project directory.\n");
|
||||
}
|
||||
|
||||
require_once("html/inc/dir_hier.inc");
|
||||
require_once("html/inc/util_basic.inc");
|
||||
|
||||
function usage() {
|
||||
die("usage: stage_file [--gzip] [--copy] file
|
||||
--gzip make a gzipped version of file
|
||||
error_exit("usage: stage_file [--gzip] [--copy] file
|
||||
--gzip make a gzipped version of file for compressed download
|
||||
(use with <gzip/> in the input template)
|
||||
--copy copy the file (default is to move it)
|
||||
");
|
||||
}
|
||||
|
@ -65,13 +71,13 @@ for ($i=1; $i<$argc-1; $i++) {
|
|||
}
|
||||
|
||||
$path = $argv[$argc-1];
|
||||
if (!file_exists($path)) die("no such file: $path\n");
|
||||
if (!file_exists($path)) error_exit("no such file: $path\n");
|
||||
$file = basename($path);
|
||||
|
||||
$fanout = parse_config(get_config(), "<uldl_dir_fanout>");
|
||||
if (!$fanout) die("can't find <uldl_dir_fanout> in config.xml");
|
||||
if (!$fanout) error_exit("can't find <uldl_dir_fanout> in config.xml");
|
||||
$download_dir = parse_config(get_config(), "<download_dir>");
|
||||
if (!$download_dir) die("can't find <download_dir> in config.xml");
|
||||
if (!$download_dir) error_exit("can't find <download_dir> in config.xml");
|
||||
|
||||
$dl_path = dir_hier_path($file, $download_dir, $fanout);
|
||||
$dl_md5_path = "$dl_path.md5";
|
||||
|
@ -89,7 +95,7 @@ if (file_exists($dl_path)) {
|
|||
$dl_md5 = md5_file($dl_path);
|
||||
}
|
||||
if ($md5 != $dl_md5) {
|
||||
die("There is already a file in your project's download directory
|
||||
error_exit("There is already a file in your project's download directory
|
||||
with that name, but different contents.
|
||||
This is not allowed by BOINC, which requires that files are 'immutable'.
|
||||
Please use a different file name.
|
||||
|
@ -119,7 +125,7 @@ if ($gzip) {
|
|||
if (!file_exists($dl_gzip_path)) {
|
||||
$output = system("gzip -c $dl_path > $dl_gzip_path", $retval);
|
||||
if ($retval) {
|
||||
die("failed to gzip file: $output\n");
|
||||
error_exit("failed to gzip file: $output\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue