From 042bfde576f825200f14f41868551358dfb5140a Mon Sep 17 00:00:00 2001 From: Bruce Allen Date: Mon, 27 Jun 2005 16:31:49 +0000 Subject: [PATCH] when using locality scheduler, have transitioner or backend lib advertise data file when new result is created. code organization: create new lib function boinc_touch_file() from code that was in locality scheduler module. svn path=/trunk/boinc/; revision=6456 --- checkin_notes | 15 +++++++++++++++ lib/filesys.C | 16 ++++++++++++++++ lib/filesys.h | 1 + sched/sched_locality.C | 22 ++-------------------- tools/backend_lib.C | 13 +++++++++++++ 5 files changed, 47 insertions(+), 20 deletions(-) diff --git a/checkin_notes b/checkin_notes index 3af875b2f2..c096fdad23 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8568,3 +8568,18 @@ David 26 June 2005 file_names.C html/ops cancel_wu_action.php + +Bruce 27 June 2005 + - when using locality scheduler, have transitioner or backend + lib advertise data file when new result is created. + - code organization: create new lib function boinc_touch_file() + from code that was in locality scheduler module. + + lib/ + filesys.C + filesys.h + tools/ + backend_lib.C + sched/ + transitioner.C + sched_locality.C diff --git a/lib/filesys.C b/lib/filesys.C index 1ae27a5cbe..6fc9c0c1df 100755 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -392,6 +392,22 @@ bool boinc_file_exists(const char* path) { return true; } +// returns zero on success, nonzero if didn't touch file +// +int boinc_touch_file(const char *path) { + FILE *fp; + + if (boinc_file_exists(path)) { + return 0; + } + + if ((fp=fopen(path, "w"))) { + fclose(fp); + return 0; + } + + return -1; +} int boinc_copy(const char* orig, const char* newf) { #ifdef _WIN32 diff --git a/lib/filesys.h b/lib/filesys.h index e9b399f777..44e2ac50bd 100755 --- a/lib/filesys.h +++ b/lib/filesys.h @@ -60,6 +60,7 @@ typedef DIR *DIRREF; extern "C" { #endif extern int boinc_delete_file(const char*); + extern int boinc_touch_file(const char *path); extern int clean_out_dir(const char*); extern FILE* boinc_fopen(const char* path, const char* mode); extern int boinc_copy(const char* orig, const char* newf); diff --git a/sched/sched_locality.C b/sched/sched_locality.C index 4ddfc43457..bc5516f6a9 100644 --- a/sched/sched_locality.C +++ b/sched/sched_locality.C @@ -324,24 +324,6 @@ static bool work_generation_over(char *filename) { return boinc_file_exists(fullpath); } -// returns zero on success, nonzero if didn't touch file -// -int touch_file(char *path) { - FILE *fp; - - if (boinc_file_exists(path)) { - return 0; - } - - if ((fp=fopen(path, "w"))) { - fclose(fp); - return 0; - } - - return -1; -} - - // Ask the WU generator to make more WUs for this file. // Returns nonzero if can't make more work. // Returns zero if it *might* have made more work @@ -365,7 +347,7 @@ int make_more_work_for_file(char* filename) { // If this operation fails, don't worry or tarry! // sprintf(fullpath, "../locality_scheduling/need_work/%s", filename); - if (touch_file(fullpath)) { + if (boinc_touch_file(fullpath)) { log_messages.printf( SCHED_MSG_LOG::CRITICAL, "unable to touch %s\n", fullpath @@ -431,7 +413,7 @@ error_exit: static void flag_for_possible_removal(char* filename) { char path[256]; sprintf(path, "../locality_scheduling/working_set_removal/%s", filename); - touch_file(path); + boinc_touch_file(path); return; } diff --git a/tools/backend_lib.C b/tools/backend_lib.C index c73ba1c082..fc13b3a22e 100644 --- a/tools/backend_lib.C +++ b/tools/backend_lib.C @@ -391,6 +391,19 @@ int create_result( return retval; } } + + // if using locality scheduling, advertise data file + // associated with this newly-created result + // + if (config.locality_scheduling) { + char datafilename[512]; + char *last=strstr(result.name, "__"); + if (result.name