diff --git a/checkin_notes b/checkin_notes index f48e0e4376..b5f504172d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -9316,3 +9316,10 @@ Bruce 21 July 2005 user/ hosts_user.php +David 21 July 2005 + - Scheduler: if using locality scheduling, + don't attach to shared memory + (hence don't need to run feeder) + + sched/ + main.C diff --git a/doc/bashford_cookbook.txt b/doc/bashford_cookbook.txt index 4d47e0dc33..07897d656c 100644 --- a/doc/bashford_cookbook.txt +++ b/doc/bashford_cookbook.txt @@ -163,9 +163,9 @@ means: Clients will download this and run it. If you want, you can gzip it and leave the .gz extension on. -Now cd to PROJDIR/bin and run +Now cd to PROJDIR and run - ./update_versions + bin/update_versions This scans the app dir and creates AppVersions (info about which Apps have really-existing versions for which platforms), and puts them in diff --git a/sched/main.C b/sched/main.C index c770dbe394..370964df1d 100644 --- a/sched/main.C +++ b/sched/main.C @@ -75,6 +75,7 @@ GUI_URLS gui_urls; key_t sema_key; int g_pid; static bool db_opened=false; +bool project_stopped = false; void send_message(const char* msg, int delay, bool send_header) { if (send_header) { @@ -184,15 +185,52 @@ void set_core_dump_size_limit() { } #endif +SCHED_SHMEM* attach_to_feeder_shmem() { + char path[256]; + get_project_dir(path, sizeof(path)); + get_key(path, 'a', sema_key); + SCHED_SHMEM* ssp = 0; + int i, retval; + void* p; + + retval = attach_shmem(config.shmem_key, &p); + if (retval || p==0) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, + "Can't attach shmem (feeder not running?)\n" + ); + project_stopped = true; + } else { + ssp = (SCHED_SHMEM*)p; + retval = ssp->verify(); + if (retval) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, + "shmem has wrong struct sizes - recompile\n" + ); + send_message("Server has software problem", 3600, true); + exit(0); + } + + for (i=0; i<10; i++) { + if (ssp->ready) break; + log_messages.printf(SCHED_MSG_LOG::DEBUG, "waiting for ready flag\n"); + sleep(1); + } + if (!ssp->ready) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, "feeder doesn't seem to be running\n"); + send_message("Server has software problem", 3600, true); + exit(0); + } + } + return ssp; +} + int main(int argc, char** argv) { FILE* fin, *fout; int i, retval; char req_path[256], reply_path[256], path[256]; SCHED_SHMEM* ssp=0; - void* p; unsigned int counter=0; char* code_sign_key; - bool project_stopped = false; int length=-1; log_messages.pid = getpid(); bool batch = false; @@ -263,36 +301,8 @@ int main(int argc, char** argv) { exit(0); } - get_project_dir(path, sizeof(path)); - get_key(path, 'a', sema_key); - - retval = attach_shmem(config.shmem_key, &p); - if (retval || p==0) { - log_messages.printf(SCHED_MSG_LOG::CRITICAL, - "Can't attach shmem (feeder not running?)\n" - ); - project_stopped = true; - } else { - ssp = (SCHED_SHMEM*)p; - retval = ssp->verify(); - if (retval) { - log_messages.printf(SCHED_MSG_LOG::CRITICAL, - "shmem has wrong struct sizes - recompile\n" - ); - send_message("Server has software problem", 3600, true); - exit(0); - } - - for (i=0; i<10; i++) { - if (ssp->ready) break; - log_messages.printf(SCHED_MSG_LOG::DEBUG, "waiting for ready flag\n"); - sleep(1); - } - if (!ssp->ready) { - log_messages.printf(SCHED_MSG_LOG::CRITICAL, "feeder doesn't seem to be running\n"); - send_message("Server has software problem", 3600, true); - exit(0); - } + if (!config.locality_scheduling) { + ssp = attach_to_feeder_shmem(); } g_pid = getpid(); diff --git a/tools/update_versions b/tools/update_versions index 7545ffd709..b25e914a6c 100755 --- a/tools/update_versions +++ b/tools/update_versions @@ -3,13 +3,12 @@ # $Id$ """ -Scans apps dir for current core client and application versions +Scans apps dir for application versions and updates the database as appropriate. config.xml must contain an which specifies the directory to search. apps/APPLICATION_NAME/ contains application versions for each application. -apps/boinc/ contains core client versions (not used for most projects). Filenames must be of the form NAME_VERSION_PLATFORM[.ext]. The prefix name and extensions .gz, .exe, .sit are ignored. @@ -64,7 +63,7 @@ def add_files( signature_files={}, file_ref_infos = {} ): - ''' add files to app/core. + ''' add files to app. ''' assert(match) assert(exec_files[0]) @@ -106,23 +105,6 @@ def add_files( platform = platform, version_num = version_num, xml_doc = xml_doc) - else: - assert(not non_exec_files) # this wouldn't make sense for core clients - existing_versions = database.CoreVersions.find(platform=platform, version_num=version_num) - if existing_versions: - if verbose: - print " Skipping existing core version %s: %s" %(version_num, file_base) - return - - print " Found core version %3d for %s: %s" %(version_num, platform, file_base) - - xml_doc = tools.process_app_file(exec_files[0]) - - object = database.CoreVersion( - create_time = create_time, - platform = platform, - version_num = version_num, - xml_doc = xml_doc) objects_to_commit.append(object) @@ -133,10 +115,7 @@ def re_match_exec_filename(filepath): return re.match('[^.]+_([0-9]+)[.]([0-9]+)_([^.]+?(?:[0-9][0-9.]*[0-9])?)(?:[.]gz|[.]exe|[.]sit|[.]msi)?$', file) def find_versions(app, dir): - """Find application versions/core client versions in DIR. - - if app==None, then dir contains core clients; else contains application - versions. + """Find application versions in DIR. If directory contains sub-directories, those are scanned (non-recursively) for files. If an executable is found, the first one found @@ -189,7 +168,7 @@ def find_versions__process_single_file(app, match, filepath): # possibly with signature files included. def find_versions__process_bundle(app, match, dir): - '''add executable + bundle as app/core version''' + '''add executable + bundle as app version''' exec_files = [] non_exec_files = [] signature_files = {} @@ -244,11 +223,6 @@ def find_versions__process_bundle(app, match, dir): for appdir in xlistdir(config.app_dir): if not os.path.isdir(appdir): continue dirname = os.path.basename(appdir) - if dirname == 'boinc': - if verbose: - print "Looking for core versions in", appdir - find_versions(None, appdir) - continue appname = os.path.basename(appdir) apps = database.Apps.find(name=appname) if apps: