mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=5244
This commit is contained in:
parent
642462250e
commit
09d0878732
|
@ -23447,3 +23447,34 @@ Rom 29 Jan 2005
|
|||
|
||||
lib/
|
||||
gui_rpc_client.C
|
||||
|
||||
David 29 Jan 2005
|
||||
- make_work: fixed a basic design problem.
|
||||
Its main loop creates workunits until the number of
|
||||
sendable results reaches the "cushion" level.
|
||||
This worked OK in the old days when creating a workunit
|
||||
created its results; but these days the transitioner does that.
|
||||
So make_work would end up creating way more workunits
|
||||
than it's supposed to.
|
||||
|
||||
The fix: estimate how many WUs to create
|
||||
(based on wu.target_nresults).
|
||||
Make that many, then sleep for 10 seconds
|
||||
(give the transitioner a chance to create the results).
|
||||
|
||||
- Another problem: the "master WU" used by make_work could
|
||||
get deleted by file_deleter and db_purge.
|
||||
Kludgy but effective solution:
|
||||
change file_deleter and db_purge to ignore WUs whose
|
||||
name includes "nodelete".
|
||||
Call your master WU "wu_nodelete".
|
||||
|
||||
- change dir_hier_path so that it just prints the pathname of the file,
|
||||
so you can use it in scripts
|
||||
|
||||
sched/
|
||||
db_purge.C
|
||||
file_deleter.C
|
||||
make_work.C
|
||||
tools/
|
||||
dir_hier_path.C
|
||||
|
|
|
@ -470,6 +470,7 @@ bool do_pass() {
|
|||
|
||||
int n=0;
|
||||
while (!wu.enumerate(buf)) {
|
||||
if (strstr(wu.name, "nodelete")) continue;
|
||||
did_something = true;
|
||||
|
||||
// if archives have not already been opened, then open them.
|
||||
|
|
|
@ -68,6 +68,8 @@ int wu_delete_files(WORKUNIT& wu) {
|
|||
bool no_delete=false;
|
||||
int count_deleted = 0, retval;
|
||||
|
||||
if (strstr(wu.name, "nodelete")) return 0;
|
||||
|
||||
safe_strcpy(buf, wu.xml_doc);
|
||||
|
||||
p = strtok(buf, "\n");
|
||||
|
|
|
@ -111,14 +111,84 @@ int count_workunits(const char* query="") {
|
|||
return n;
|
||||
}
|
||||
|
||||
void make_work() {
|
||||
SCHED_CONFIG config;
|
||||
char * p;
|
||||
int retval, start_time=time(0);
|
||||
char keypath[256];
|
||||
void make_new_wu(
|
||||
DB_WORKUNIT& wu, char* starting_xml, int start_time, int& seqno,
|
||||
SCHED_CONFIG& config
|
||||
) {
|
||||
char file_name[256], buf[LARGE_BLOB_SIZE], pathname[256];
|
||||
char new_file_name[256], new_pathname[256], command[256];
|
||||
char starting_xml[LARGE_BLOB_SIZE], new_buf[LARGE_BLOB_SIZE];
|
||||
char new_buf[LARGE_BLOB_SIZE];
|
||||
char * p;
|
||||
int retval;
|
||||
|
||||
strcpy(buf, starting_xml);
|
||||
p = strtok(buf, "\n");
|
||||
strcpy(file_name, "");
|
||||
|
||||
// make new hard links to the WU's input files
|
||||
// (don't actually copy files)
|
||||
//
|
||||
while (p) {
|
||||
if (parse_str(p, "<name>", file_name, sizeof(file_name))) {
|
||||
sprintf(
|
||||
new_file_name, "%s__%d_%d", file_name, start_time, seqno++
|
||||
);
|
||||
dir_hier_path(
|
||||
file_name, config.download_dir, config.uldl_dir_fanout, true,
|
||||
pathname
|
||||
);
|
||||
dir_hier_path(
|
||||
new_file_name, config.download_dir, config.uldl_dir_fanout, true,
|
||||
new_pathname, true
|
||||
);
|
||||
sprintf(command,"ln %s %s", pathname, new_pathname);
|
||||
log_messages.printf(SCHED_MSG_LOG::DEBUG, "executing command: %s\n", command);
|
||||
retval = system(command);
|
||||
if (retval) {
|
||||
log_messages.printf(
|
||||
SCHED_MSG_LOG::CRITICAL, "system() error %d\n", retval
|
||||
);
|
||||
perror(command);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(new_buf, starting_xml);
|
||||
replace_file_name(
|
||||
new_buf, file_name, new_file_name, config.download_url
|
||||
);
|
||||
strcpy(wu.xml_doc, new_buf);
|
||||
}
|
||||
p = strtok(0, "\n");
|
||||
}
|
||||
|
||||
// set various fields for new WU (all others are copied)
|
||||
//
|
||||
wu.id = 0;
|
||||
wu.create_time = time(0);
|
||||
sprintf(wu.name, "wu_%d_%d", start_time, seqno++);
|
||||
wu.need_validate = false;
|
||||
wu.canonical_resultid = 0;
|
||||
wu.canonical_credit = 0;
|
||||
wu.transition_time = time(0);
|
||||
wu.error_mask = 0;
|
||||
wu.file_delete_state = FILE_DELETE_INIT;
|
||||
wu.assimilate_state = ASSIMILATE_INIT;
|
||||
retval = wu.insert();
|
||||
if (retval) {
|
||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
|
||||
"Failed to created WU, error %d; exiting\n", retval
|
||||
);
|
||||
exit(retval);
|
||||
}
|
||||
wu.id = boinc_db.insert_id();
|
||||
log_messages.printf(SCHED_MSG_LOG::DEBUG, "[%s] Created new WU\n", wu.name);
|
||||
}
|
||||
|
||||
void make_work() {
|
||||
SCHED_CONFIG config;
|
||||
int retval, start_time=time(0);
|
||||
char keypath[256];
|
||||
char buf[LARGE_BLOB_SIZE];
|
||||
char starting_xml[LARGE_BLOB_SIZE];
|
||||
R_RSA_PRIVATE_KEY key;
|
||||
DB_WORKUNIT wu;
|
||||
int seqno = 0;
|
||||
|
@ -169,70 +239,17 @@ void make_work() {
|
|||
unsent_results, cushion
|
||||
);
|
||||
if (unsent_results > cushion) {
|
||||
sleep(1);
|
||||
sleep(10);
|
||||
continue;
|
||||
}
|
||||
|
||||
strcpy(buf, starting_xml);
|
||||
p = strtok(buf, "\n");
|
||||
strcpy(file_name, "");
|
||||
|
||||
// make new hard links to the WU's input files
|
||||
// (don't actually copy files)
|
||||
//
|
||||
while (p) {
|
||||
if (parse_str(p, "<name>", file_name, sizeof(file_name))) {
|
||||
sprintf(
|
||||
new_file_name, "%s__%d_%d", file_name, start_time, seqno++
|
||||
);
|
||||
dir_hier_path(
|
||||
file_name, config.download_dir, config.uldl_dir_fanout, true,
|
||||
pathname
|
||||
);
|
||||
dir_hier_path(
|
||||
new_file_name, config.download_dir, config.uldl_dir_fanout, true,
|
||||
new_pathname, true
|
||||
);
|
||||
sprintf(command,"ln %s %s", pathname, new_pathname);
|
||||
log_messages.printf(SCHED_MSG_LOG::DEBUG, "executing command: %s\n", command);
|
||||
retval = system(command);
|
||||
if (retval) {
|
||||
log_messages.printf(
|
||||
SCHED_MSG_LOG::CRITICAL, "system() error %d\n", retval
|
||||
);
|
||||
perror(command);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(new_buf, starting_xml);
|
||||
replace_file_name(
|
||||
new_buf, file_name, new_file_name, config.download_url
|
||||
);
|
||||
strcpy(wu.xml_doc, new_buf);
|
||||
}
|
||||
p = strtok(0, "\n");
|
||||
int nwus = (cushion-unsent_results)/wu.target_nresults+1;
|
||||
for (int i=0; i<nwus; i++) {
|
||||
make_new_wu(wu, starting_xml, start_time, seqno, config);
|
||||
}
|
||||
|
||||
// set various fields for new WU (all others are copied)
|
||||
//
|
||||
wu.id = 0;
|
||||
wu.create_time = time(0);
|
||||
sprintf(wu.name, "wu_%d_%d", start_time, seqno++);
|
||||
wu.need_validate = false;
|
||||
wu.canonical_resultid = 0;
|
||||
wu.canonical_credit = 0;
|
||||
wu.transition_time = time(0);
|
||||
wu.error_mask = 0;
|
||||
wu.file_delete_state = FILE_DELETE_INIT;
|
||||
wu.assimilate_state = ASSIMILATE_INIT;
|
||||
retval = wu.insert();
|
||||
if (retval) {
|
||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
|
||||
"Failed to created WU, error %d; exiting\n", retval
|
||||
);
|
||||
exit(retval);
|
||||
}
|
||||
wu.id = boinc_db.insert_id();
|
||||
log_messages.printf(SCHED_MSG_LOG::DEBUG, "[%s] Created new WU\n", wu.name);
|
||||
// now wait a while for the transitioner to make results
|
||||
sleep(60);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
// or write to the Free Software Foundation, Inc.,
|
||||
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
// dir_hier_path filename
|
||||
//
|
||||
// Run this in a project's root directory.
|
||||
// Prints the absolute path of the file in the download hierarchy
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "util.h"
|
||||
|
@ -35,7 +40,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
dir_hier_path(argv[1], "", config.uldl_dir_fanout, true, path);
|
||||
printf("path: %s%s\n", config.download_dir, path);
|
||||
printf("%s%s\n", config.download_dir, path);
|
||||
}
|
||||
|
||||
const char *BOINC_RCSID_c683969ea8 = "$Id$";
|
||||
|
|
Loading…
Reference in New Issue