*** empty log message ***

svn path=/trunk/boinc/; revision=10344
This commit is contained in:
David Anderson 2006-06-14 18:04:12 +00:00
parent 517ab42a14
commit d8385571b9
4 changed files with 48 additions and 22 deletions

View File

@ -5969,3 +5969,14 @@ Rom 14 June 2006
lib/
diagnostics.C
David 14 June 2006
- core client: implement <copy_file/> property for output files
(previously it was implemented for input files only).
If present, move the file from slot directory
to project directory when the result is done.
client/
app.h
app_control.C
app_start.C

View File

@ -199,6 +199,7 @@ public:
int move_trickle_file();
int handle_upload_files();
void upload_notify_app(const FILE_INFO*, const FILE_REF*);
int copy_output_files();
int write(MIOFILE&);
int parse(MIOFILE&);

View File

@ -178,12 +178,17 @@ static void limbo_message(ACTIVE_TASK& at) {
//
#ifdef _WIN32
void ACTIVE_TASK::handle_exited_app(unsigned long exit_code) {
#else
void ACTIVE_TASK::handle_exited_app(int stat) {
#endif
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK);
get_app_status_msg();
get_trickle_up_msg();
result->final_cpu_time = current_cpu_time;
if (task_state == PROCESS_ABORT_PENDING) {
task_state = PROCESS_ABORTED;
} else {
#ifdef _WIN32
task_state = PROCESS_EXITED;
if (exit_code) {
@ -210,28 +215,7 @@ void ACTIVE_TASK::handle_exited_app(unsigned long exit_code) {
}
}
result->exit_status = exit_code;
}
if (app_client_shm.shm) {
detach_shmem(shm_handle, app_client_shm.shm);
app_client_shm.shm = NULL;
}
read_stderr_file();
clean_out_dir(slot_dir);
done:
gstate.request_schedule_cpus("application exited");
}
#else
void ACTIVE_TASK::handle_exited_app(int stat) {
SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_TASK);
get_app_status_msg();
get_trickle_up_msg();
result->final_cpu_time = current_cpu_time;
if (task_state == PROCESS_ABORT_PENDING) {
task_state = PROCESS_ABORTED;
} else {
if (WIFEXITED(stat)) {
task_state = PROCESS_EXITED;
result->exit_status = WEXITSTATUS(stat);
@ -304,14 +288,24 @@ void ACTIVE_TASK::handle_exited_app(int stat) {
task_state = PROCESS_EXIT_UNKNOWN;
result->state = PROCESS_EXIT_UNKNOWN;
}
#endif
}
#ifdef _WIN32
if (app_client_shm.shm) {
detach_shmem(shm_handle, app_client_shm.shm);
app_client_shm.shm = NULL;
}
#endif
// here when task is finished for good
//
copy_output_files();
read_stderr_file();
clean_out_dir(slot_dir);
done:
gstate.request_schedule_cpus("application exited");
}
#endif
bool ACTIVE_TASK::finish_file_present() {
char path[256];

View File

@ -272,6 +272,25 @@ static int setup_file(
return 0;
}
int ACTIVE_TASK::copy_output_files() {
char slotfile[256], projfile[256];
unsigned int i;
for (i=0; i<result->output_files.size(); i++) {
FILE_REF& fref = result->output_files[i];
if (!fref.copy_file) continue;
FILE_INFO* fip = fref.file_info;
sprintf(slotfile, "%s/%s", slot_dir, fref.open_name);
get_pathname(fip, projfile);
int retval = boinc_rename(slotfile, projfile);
if (retval) {
msg_printf(wup->project, MSG_ERROR,
"Can't rename output file %s", fip->name
);
}
}
return 0;
}
// Start a task in a slot directory.
// This includes setting up soft links,
// passing preferences, and starting the process
@ -363,6 +382,7 @@ int ACTIVE_TASK::start(bool first_time) {
}
for (i=0; i<result->output_files.size(); i++) {
fref = result->output_files[i];
if (fref.copy_file) continue;
fip = fref.file_info;
get_pathname(fref.file_info, file_path);
retval = setup_file(wup, fip, fref, file_path, slot_dir);