[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    icecream
From:       Mirko Boehm <mirko () kde ! org>
Date:       2007-05-08 19:09:41
Message-ID: 1178651381.648957.2040.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 662630 by mirko:

- make it work again on non-Linux platforms: Jobs still reported their
  environment platform as i386 etc, even if they came from Darwin or
  BSD (thus the scheduler never finds a matching compile server, or
  wrongly directs a non-Linux client to use a Linux compile server)



 M  +4 -15     daemon/main.cpp  
 M  +2 -2      services/Makefile.am  
 M  +0 -1      services/comm.cpp  
 M  +2 -7      services/job.cpp  
 A             services/platform.cpp   [License: GPL (v2+) (wrong address)]
 A             services/platform.h   [License: GPL (v2+) (wrong address)]
 M  +9 -9      services/scheduler.cpp  


--- trunk/icecream/daemon/main.cpp #662629:662630
@@ -94,6 +94,7 @@
 #include <comm.h>
 #include "load.h"
 #include "environment.h"
+#include "platform.h"
 
 const int PORT = 10245;
 static std::string pidFilePath;
@@ -122,7 +123,7 @@
      * CLIENTWORK: Client is busy working and we reserve the spot (job_id is set if \
                it's a scheduler job)
      * WAITFORCHILD: Client is waiting for the compile job to finish.
      */
-    enum Status { UNKNOWN, GOTNATIVE, PENDING_USE_CS, JOBDONE, LINKJOB, TOINSTALL, \
TOCOMPILE,  +    enum Status { UNKNOWN, GOTNATIVE, PENDING_USE_CS, JOBDONE, LINKJOB, \
                TOINSTALL, TOCOMPILE,
                   WAITFORCS, WAITCOMPILE, CLIENTWORK, WAITFORCHILD, \
LASTSTATE=WAITFORCHILD } status;  Client()
     {
@@ -177,7 +178,7 @@
         job = 0;
 	if (pipe_to_child >= 0)
 	    close (pipe_to_child);
- 
+
     }
     uint32_t job_id;
     string outfile; // only useful for LINKJOB or TOINSTALL
@@ -512,19 +513,7 @@
     if (!custom_nodename)
         nodename = uname_buf.nodename;
 
-    string os = uname_buf.sysname;
-    if ( os != "Linux" )
-        machine_name = os + '_' + uname_buf.machine;
-    else // Linux
-        machine_name = uname_buf.machine;
-   
-    while (true)
-    {
-        string::size_type pos = machine_name.find(" ");
-        if (pos == string::npos)
-           break;
-        machine_name.erase(pos, 1);
-    }
+    machine_name = determine_platform();
 }
 
 string Daemon::determine_nodename()
--- trunk/icecream/services/Makefile.am #662629:662630
@@ -2,13 +2,13 @@
 
 lib_LTLIBRARIES = libicecc.la
 
-libicecc_la_SOURCES = job.cpp comm.cpp getifaddrs.cpp logging.cpp tempfile.c
+libicecc_la_SOURCES = job.cpp comm.cpp getifaddrs.cpp logging.cpp tempfile.c \
platform.cpp  libicecc_la_LIBADD = ../minilzo/libminilzo.la
 libicecc_la_CFLAGS = -fPIC -DPIC
 libicecc_la_CXXFLAGS = -fPIC -DPIC
 
 ice_HEADERS = job.h comm.h
-noinst_HEADERS = bench.h exitcode.h getifaddrs.h logging.h tempfile.h
+noinst_HEADERS = bench.h exitcode.h getifaddrs.h logging.h tempfile.h platform.h
 icedir = $(includedir)/icecc
 
 sbin_PROGRAMS = scheduler
--- trunk/icecream/services/comm.cpp #662629:662630
@@ -43,7 +43,6 @@
 #include <assert.h>
 #include <minilzo.h>
 #include <stdio.h>
-#include <sys/utsname.h>
 
 #include "logging.h"
 #include "job.h"
--- trunk/icecream/services/job.cpp #662629:662630
@@ -21,7 +21,7 @@
 #include "job.h"
 #include "logging.h"
 #include "exitcode.h"
-#include <sys/utsname.h>
+#include "platform.h"
 #include <stdio.h>
 
 using namespace std;
@@ -62,12 +62,7 @@
 
 void CompileJob::__setTargetPlatform()
 {
-    struct utsname buf;
-    if ( uname(&buf) ) {
-        log_perror( "uname failed" );
-        return;
-    } else
-        m_target_platform = buf.machine;
+    m_target_platform = determine_platform();
 }
 
 unsigned int CompileJob::argumentFlags() const
--- trunk/icecream/services/scheduler.cpp #662629:662630
@@ -834,7 +834,7 @@
              the job.  (XXX currently this is equivalent to the fastest one)  */
           else
             if (best->last_compiled_jobs.size() != 0
-                && server_speed (best, job) < server_speed (cs, job)) 
+                && server_speed (best, job) < server_speed (cs, job))
               {
                 if (int( cs->joblist.size() ) < cs->max_jobs)
                   best = cs;
@@ -917,10 +917,10 @@
             {
               trace() << "send ping " << ( *it )->nodename << endl;
               ( *it )->max_jobs *= -1; // better not give it away
-              if(( *it )->send_msg( PingMsg() )) 
+              if(( *it )->send_msg( PingMsg() ))
 		{
                   // give it MAX_SCHEDULER_PONG to answer a ping
-                  ( *it )->last_talk = time( 0 ) - MAX_SCHEDULER_PING 
+                  ( *it )->last_talk = time( 0 ) - MAX_SCHEDULER_PING
 		                       + 2 * MAX_SCHEDULER_PONG;
                   min_time = min (min_time, (time_t) 2 * MAX_SCHEDULER_PONG);
 		  ++it;
@@ -934,7 +934,7 @@
 	  handle_end (old, 0);
 	  continue;
         }
-      else 
+      else
         min_time = min (min_time, MAX_SCHEDULER_PING - now + ( *it )->last_talk);
 #if DEBUG_SCHEDULER > 1
       if ((random() % 400) < 0)
@@ -1049,7 +1049,7 @@
       gotit = false;
       host_platform = can_install (cs, job);
     }
-  
+
   UseCSMsg m2(host_platform, cs->name, cs->remote_port, job->id,
 	      gotit, job->local_client_id );
 
@@ -1245,7 +1245,7 @@
       for (mit = jobs.begin(); mit != jobs.end(); mit++)
         {
           Job *job = mit->second;
-          trace() << "looking for waitcs " << job->server << " " << job->submitter  \
<< " " << c << " "  +          trace() << "looking for waitcs " << job->server << " " \
                << job->submitter  << " " << c << " "
 		  << job->state << " " << job->local_client_id << " " << m->job_id << endl;
           if (job->server == 0 && job->submitter == c && job->state == Job::PENDING
               && job->local_client_id == m->job_id )
@@ -1264,7 +1264,7 @@
 		    list<Job*>::iterator jit;
 		    for (jit = l->l.begin(); jit != l->l.end(); ++jit)
 		      {
-			if (*jit == j) 
+			if (*jit == j)
 			  {
 			    l->l.erase(jit);
 			    break;
@@ -1345,7 +1345,7 @@
     trace() << "END " << m->job_id
 	    << " status=" << m->exitcode << endl;
 
-  if (j->server) 
+  if (j->server)
     {
       j->server->joblist.remove (j);
       j->server->busy_installing = 0;
@@ -1517,7 +1517,7 @@
         {
           Msg *msg = NULL;
 
-	  if (!l.empty()) 
+	  if (!l.empty())
 	    {
 	      list<string>::const_iterator si;
 	      for (si = l.begin(); si != l.end(); ++si) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic