mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3258
This commit is contained in:
parent
d6a1db1b01
commit
4639df4318
|
@ -11556,3 +11556,31 @@ David April 13 2004
|
|||
|
||||
sched/
|
||||
make_work.C
|
||||
|
||||
David April 13 2004
|
||||
- Changes in the parsing of WU template files:
|
||||
- Any unrecognized elements in a <file_info>
|
||||
are now just copied to the output.
|
||||
So you can include attributes like <sticky/>
|
||||
and they'll get propagated correctly.
|
||||
- The following items can now be included in a WU template:
|
||||
rsc_fpops_est
|
||||
rsc_fpops_bound
|
||||
rsc_memory_bound
|
||||
rsc_disk_bound
|
||||
delay_bound
|
||||
min_quorum
|
||||
target_nresults
|
||||
max_error_results
|
||||
max_total_results
|
||||
|
||||
These are not copied to the output,
|
||||
but are used to populate the WORKUNIT
|
||||
(which is now passed in as an arg)
|
||||
|
||||
The latter means that 'create_work' (the cmdline program) is simplified;
|
||||
it can now take as few as 4 args
|
||||
|
||||
tools
|
||||
backend_lib.C
|
||||
create_work.C
|
||||
|
|
|
@ -207,7 +207,7 @@ int DB_BASE::sum(double& x, char* field, char* clause) {
|
|||
|
||||
// convert a string into a form that allows it to be used
|
||||
// in SQL queries delimited by single quotes:
|
||||
// replace ' with \', \ with \\
|
||||
// replace ' with \', \ with \\
|
||||
//
|
||||
void escape_string(char* field, int len) {
|
||||
char buf[MAX_QUERY_LEN];
|
||||
|
|
|
@ -20,9 +20,9 @@ for registering the workunits in the database.
|
|||
<p>
|
||||
During testing, you can create a single workunit using
|
||||
<a href=tools_work.php#cmdline>create_work</a>,
|
||||
then use
|
||||
then use the daemon program
|
||||
<a href=tools_work.php#make_work>make_work</a>
|
||||
to make copies as needed to maintain a supply of work.
|
||||
to copy this workunit as needed to maintain a given supply of work.
|
||||
|
||||
<h3>Transitioning</h3>
|
||||
<p>
|
||||
|
|
|
@ -27,7 +27,8 @@ Required on the <b>database</b> server:
|
|||
</ul>
|
||||
After installing and running the server,
|
||||
grant permissions for your own account and for
|
||||
the account under which Apache runs:
|
||||
the account under which Apache runs
|
||||
('nobody' in the following; may be different on your machine):
|
||||
<pre>
|
||||
mysql -u root
|
||||
grant all on *.* to yourname@localhost;
|
||||
|
|
|
@ -14,17 +14,26 @@ A WU template file has the form
|
|||
<pre>",htmlspecialchars("
|
||||
<file_info>
|
||||
<number>0</number>
|
||||
[ ... ]
|
||||
[ <sticky/>, other attributes]
|
||||
</file_info>
|
||||
[ ... ]
|
||||
<workunit>
|
||||
<file_ref>
|
||||
<number>0</number>
|
||||
<file_number>0</file_number>
|
||||
<open_name>NAME</open_name>
|
||||
</file_ref>
|
||||
[ ... ]
|
||||
[ <command_line>-flags xyz</command_line> ]
|
||||
[ <env_vars>name=val&name=val</env_vars> ]
|
||||
[ <rsc_fpops_est>x</rsc_fpops_est> ]
|
||||
[ <rsc_fpops_bound>x</rsc_fpops_bound> ]
|
||||
[ <rsc_memory_bound>x</rsc_memory_bounds> ]
|
||||
[ <rsc_disk_bound>x</rsc_disk_bounds> ]
|
||||
[ <delay_bound>x</delay_bound> ]
|
||||
[ <min_quorum>x</min_quorum> ]
|
||||
[ <target_nresults>x</target_nresults> ]
|
||||
[ <max_error_results>x</max_error_results> ]
|
||||
[ <max_total_results>x</max_total_results> ]
|
||||
</workunit>
|
||||
"), "
|
||||
</pre>
|
||||
|
@ -32,12 +41,15 @@ The components are:
|
|||
";
|
||||
list_start();
|
||||
list_item(htmlspecialchars("<file_info>, <file_ref>"),
|
||||
"Each pair describes an input file");
|
||||
"Each pair describes an <a href=files.php>input file</a>");
|
||||
list_item(htmlspecialchars("<command_line>"),
|
||||
"The command-line arguments to be passed to the main program.");
|
||||
list_item(htmlspecialchars("<env_vars>"),
|
||||
"A list of environment variables in the form
|
||||
name=value&name=value&name=value.");
|
||||
list_item("Other elements",
|
||||
"<a href=work.php>Work unit attributes</a>"
|
||||
);
|
||||
list_end();
|
||||
echo"
|
||||
When a workunit is created, the template file is processed as follows:
|
||||
|
@ -49,7 +61,8 @@ It is replaced with elements giving
|
|||
the filename, download URL, MD5 checksum, and size.
|
||||
<li>
|
||||
Within a <file_ref> element,
|
||||
<file_number>x</file_number> is replaced with the filename.
|
||||
<file_number>x</file_number> is replaced with an element
|
||||
giving the filename.
|
||||
</ul>
|
||||
<h3>Result template files</h3>
|
||||
<p>
|
||||
|
@ -90,6 +103,8 @@ create_work
|
|||
-wu_name name // workunit name
|
||||
-wu_template filename // WU template filename
|
||||
-result_template filename // result template filename
|
||||
|
||||
// The following are normally supplied in config.xml:
|
||||
[ -db_name x ] // database name
|
||||
[ -db_passwd x ] // database password
|
||||
[ -db_host x ] // database host
|
||||
|
@ -97,17 +112,20 @@ create_work
|
|||
[ -upload_url x ] // URL for output file upload
|
||||
[ -download_url x ] // base URL for input file download
|
||||
[ -download_dir x ] // where to move input files
|
||||
[ -keyfile x ] // path of upload private key
|
||||
|
||||
// The following are normally supplied in the WU template:
|
||||
[ -rsc_fpops_est x ]
|
||||
[ -rsc_fpops_bound x ]
|
||||
[ -rsc_memory_bound x ]
|
||||
[ -rsc_disk_bound x ]
|
||||
[ -keyfile x ] // path of upload private key
|
||||
[ -delay_bound x ]
|
||||
[ -min_quorum x ]
|
||||
[ -target_nresults x ]
|
||||
[ -max_error_results x ]
|
||||
[ -max_total_results x ]
|
||||
[ -max_success_results x ]
|
||||
|
||||
infile_1 ... infile_m // input files
|
||||
</pre>
|
||||
The workunit parameters are documented <a href=work.php>here</a>.
|
||||
|
@ -155,10 +173,11 @@ delay_bound
|
|||
</pre>
|
||||
All other fields should be zeroed.
|
||||
|
||||
<hr>
|
||||
<a name=make_work>
|
||||
<h3>Make_work</h3>
|
||||
<p>
|
||||
The program
|
||||
The daemon program
|
||||
<pre>
|
||||
make_work -wu_name name -cushion N
|
||||
</pre>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
require_once('../inc/forum.inc');
|
||||
require_once('../inc/util.inc');
|
||||
|
||||
$logged_in_user = get_logged_in_user();
|
||||
if ($_POST['submit']) {
|
||||
|
||||
if (empty($_GET['id'])) {
|
||||
|
@ -13,13 +14,21 @@ if ($_POST['submit']) {
|
|||
|
||||
$post = getPost($_GET['id']);
|
||||
$thread = getThread($post->thread);
|
||||
|
||||
if ($logged_in_user->id != $post->user) {
|
||||
// Can't edit other's posts.
|
||||
echo "You are not authorized to edit this post.";
|
||||
exit();
|
||||
}
|
||||
|
||||
updatePost($post->id, $_POST['content']);
|
||||
if ($post->parent_post==0){
|
||||
updateThread($thread->id, $_POST['title']);
|
||||
}
|
||||
|
||||
header('Location: thread.php?id='.$thread->id);
|
||||
}
|
||||
|
||||
$logged_in_user = get_logged_in_user();
|
||||
|
||||
page_head('Forum', $logged_in_user, NULL, 'forum.css');
|
||||
|
||||
|
@ -45,6 +54,14 @@ show_forum_title($forum, $thread, $category->is_helpdesk);
|
|||
echo "<form action=\"edit.php?id=", $post->id, "\" method=\"POST\">";
|
||||
|
||||
start_forum_table(array("Edit Your Post"), array(NULL), 2);
|
||||
if ($post->parent_post==0) {
|
||||
//If this is the first post enable the user to change title
|
||||
echo "<tr>
|
||||
<td style=\"vertical-align:top\"><b>Thread title</b></td>
|
||||
<td><input type=\"text\" name=\"title\" value=\"".stripslashes($thread->title)."\"></td>
|
||||
</tr>"
|
||||
;
|
||||
};
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
|
||||
#include "boinc_db.h"
|
||||
#include "crypt.h"
|
||||
#include "error_numbers.h"
|
||||
#include "md5_file.h"
|
||||
#include "parse.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "backend_lib.h"
|
||||
|
||||
|
@ -53,12 +55,13 @@ int read_filename(const char* path, char* buf) {
|
|||
// process WU template
|
||||
//
|
||||
static int process_wu_template(
|
||||
const char* wu_name, char* tmplate, char* out,
|
||||
WORKUNIT& wu, char* tmplate,
|
||||
const char* dirpath, const char** infiles, int n,
|
||||
const char* upload_url, const char* download_url
|
||||
) {
|
||||
char* p;
|
||||
char buf[MEDIUM_BLOB_SIZE], md5[33], path[256];
|
||||
char out[LARGE_BLOB_SIZE];
|
||||
int retval, file_number;
|
||||
double nbytes;
|
||||
char open_name[256];
|
||||
|
@ -68,45 +71,89 @@ static int process_wu_template(
|
|||
p = strtok(tmplate, "\n");
|
||||
while (p) {
|
||||
if (match_tag(p, "<file_info>")) {
|
||||
} else if (parse_int(p, "<number>", file_number)) {
|
||||
} else if (match_tag(p, "</file_info>")) {
|
||||
sprintf(path, "%s/%s", dirpath, infiles[file_number]);
|
||||
retval = md5_file(path, md5, nbytes);
|
||||
if (retval) {
|
||||
fprintf(stderr, "process_wu_template: md5_file %d\n", retval);
|
||||
return 1;
|
||||
file_number = -1;
|
||||
strcat(out, "<file_info>\n");
|
||||
while (1) {
|
||||
p = strtok(0, "\n");
|
||||
if (!p) break;
|
||||
if (parse_int(p, "<number>", file_number)) {
|
||||
continue;
|
||||
} else if (match_tag(p, "</file_info>")) {
|
||||
if (file_number < 0) {
|
||||
fprintf(stderr, "No file number found\n");
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
sprintf(path, "%s/%s", dirpath, infiles[file_number]);
|
||||
retval = md5_file(path, md5, nbytes);
|
||||
if (retval) {
|
||||
fprintf(stderr, "process_wu_template: md5_file %d\n", retval);
|
||||
return retval;
|
||||
}
|
||||
sprintf(buf,
|
||||
" <name>%s</name>\n"
|
||||
" <url>%s/%s</url>\n"
|
||||
" <md5_cksum>%s</md5_cksum>\n"
|
||||
" <nbytes>%.0f</nbytes>\n"
|
||||
"</file_info>\n",
|
||||
infiles[file_number],
|
||||
download_url, infiles[file_number],
|
||||
md5,
|
||||
nbytes
|
||||
);
|
||||
strcat(out, buf);
|
||||
break;
|
||||
} else {
|
||||
strcat(out, p);
|
||||
strcat(out, "\n");
|
||||
}
|
||||
}
|
||||
sprintf(buf,
|
||||
"<file_info>\n"
|
||||
" <name>%s</name>\n"
|
||||
" <url>%s/%s</url>\n"
|
||||
" <md5_cksum>%s</md5_cksum>\n"
|
||||
" <nbytes>%.0f</nbytes>\n"
|
||||
"</file_info>\n",
|
||||
infiles[file_number],
|
||||
download_url, infiles[file_number],
|
||||
md5,
|
||||
nbytes
|
||||
);
|
||||
strcat(out, buf);
|
||||
} else if (match_tag(p, "<workunit>")) {
|
||||
found = true;
|
||||
strcat(out, "<workunit>\n");
|
||||
} else if (match_tag(p, "</workunit>")) {
|
||||
strcat(out, "</workunit>\n");
|
||||
} else if (match_tag(p, "<file_ref>")) {
|
||||
} else if (parse_int(p, "<file_number>", file_number)) {
|
||||
} else if (parse_str(p, "<open_name>", open_name, sizeof(open_name))) {
|
||||
} else if (match_tag(p, "</file_ref>")) {
|
||||
sprintf(buf,
|
||||
"<file_ref>\n"
|
||||
" <file_name>%s</file_name>\n"
|
||||
" <open_name>%s</open_name>\n"
|
||||
"</file_ref>\n",
|
||||
infiles[file_number],
|
||||
open_name
|
||||
);
|
||||
strcat(out, buf);
|
||||
file_number = -1;
|
||||
while (1) {
|
||||
p = strtok(0, "\n");
|
||||
if (!p) break;
|
||||
if (parse_int(p, "<file_number>", file_number)) {
|
||||
continue;
|
||||
} else if (parse_str(p, "<open_name>", open_name, sizeof(open_name))) {
|
||||
continue;
|
||||
} else if (match_tag(p, "</file_ref>")) {
|
||||
sprintf(buf,
|
||||
"<file_ref>\n"
|
||||
" <file_name>%s</file_name>\n"
|
||||
" <open_name>%s</open_name>\n"
|
||||
"</file_ref>\n",
|
||||
infiles[file_number],
|
||||
open_name
|
||||
);
|
||||
strcat(out, buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (parse_double(p, "<rsc_fpops_est>", wu.rsc_fpops_est)) {
|
||||
continue;
|
||||
} else if (parse_double(p, "<rsc_fpops_bound>", wu.rsc_fpops_bound)) {
|
||||
continue;
|
||||
} else if (parse_double(p, "<rsc_memory_bound>", wu.rsc_memory_bound)) {
|
||||
continue;
|
||||
} else if (parse_double(p, "<rsc_disk_bound>", wu.rsc_disk_bound)) {
|
||||
continue;
|
||||
} else if (parse_int(p, "<delay_bound>", wu.delay_bound)) {
|
||||
continue;
|
||||
} else if (parse_int(p, "<min_quorum>", wu.min_quorum)) {
|
||||
continue;
|
||||
} else if (parse_int(p, "<target_nresults>", wu.target_nresults)) {
|
||||
continue;
|
||||
} else if (parse_int(p, "<max_error_results>", wu.max_error_results)) {
|
||||
continue;
|
||||
} else if (parse_int(p, "<max_total_results>", wu.max_total_results)) {
|
||||
continue;
|
||||
} else if (parse_int(p, "<max_success_results>", wu.max_success_results)) {
|
||||
continue;
|
||||
} else {
|
||||
strcat(out, p);
|
||||
strcat(out, "\n");
|
||||
|
@ -117,6 +164,7 @@ static int process_wu_template(
|
|||
fprintf(stderr, "create_work: bad WU template - no <workunit>\n");
|
||||
return -1;
|
||||
}
|
||||
safe_strncpy(wu.xml_doc, out, sizeof(wu.xml_doc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -146,6 +194,7 @@ void initialize_result(DB_RESULT& result, DB_WORKUNIT& wu) {
|
|||
}
|
||||
|
||||
// Create a new result for the given WU.
|
||||
// This is called ONLY from the transitioner
|
||||
//
|
||||
int create_result(
|
||||
DB_WORKUNIT& wu, char* result_template,
|
||||
|
@ -224,7 +273,7 @@ int create_work(
|
|||
strcpy(wu_template, _wu_template);
|
||||
wu.create_time = time(0);
|
||||
retval = process_wu_template(
|
||||
wu.name, wu_template, wu.xml_doc, infile_dir, infiles, ninfiles,
|
||||
wu, wu_template, infile_dir, infiles, ninfiles,
|
||||
upload_url, download_url
|
||||
);
|
||||
if (retval) {
|
||||
|
|
|
@ -109,6 +109,9 @@ int remove_signatures(char* xml) {
|
|||
// - replace OUTFILE_x with base_filename_x, etc.
|
||||
// - add signatures for file uploads
|
||||
//
|
||||
// This is called only from the transitioner,
|
||||
// to create a new result for a WU
|
||||
//
|
||||
int process_result_template(
|
||||
char* result_template,
|
||||
R_RSA_PRIVATE_KEY& key,
|
||||
|
@ -145,6 +148,7 @@ int process_result_template(
|
|||
}
|
||||
|
||||
// macro-substitute a result template only for UPLOAD_URL_MACRO
|
||||
// This is called (from create_work()) when a WU is being created
|
||||
//
|
||||
int process_result_template_upload_url_only(
|
||||
char* result_template,
|
||||
|
|
Loading…
Reference in New Issue