r7296 - in dumbhippo/trunk: firehose/firehose/jobs server/src/com/dumbhippo/web/servlets super/firehose/files/conf super/jboss/files/deploy



Author: walters
Date: 2008-02-07 13:00:11 -0600 (Thu, 07 Feb 2008)
New Revision: 7296

Modified:
   dumbhippo/trunk/firehose/firehose/jobs/master.py
   dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/ExternalServiceServlet.java
   dumbhippo/trunk/super/firehose/files/conf/mugshot.cfg
   dumbhippo/trunk/super/jboss/files/deploy/properties-service.xml
Log:
Various bugfixes, whole system seems to go now.


Modified: dumbhippo/trunk/firehose/firehose/jobs/master.py
===================================================================
--- dumbhippo/trunk/firehose/firehose/jobs/master.py	2008-02-07 18:14:53 UTC (rev 7295)
+++ dumbhippo/trunk/firehose/firehose/jobs/master.py	2008-02-07 19:00:11 UTC (rev 7296)
@@ -148,6 +148,7 @@
                        (taskkey, None, None))
         finally:
             conn.close()
+        self.__requeue_poll()
         
     def __set_task_status(self, cursor, taskkey, hashcode, timestamp):
         _logger.debug("updating task %r values (%r %r)", taskkey, hashcode, timestamp)
@@ -156,6 +157,7 @@
     
     @log_except(_logger)
     def __push_changed(self):
+        _logger.debug("doing change push")
         extkey = config.get('firehose.externalServiceKey')
         try:
             self.__task_lock.acquire()
@@ -164,7 +166,8 @@
             self.__changed_buffer = []
         finally:
             self.__task_lock.release()
-        jsonstr = simplejson.dumps(changed)
+        update_obj = {'updated_keys': changed}
+        jsonstr = simplejson.dumps(update_obj)
         parsed = urlparse.urlparse(self.__client_url)
         conn = httplib.HTTPConnection(parsed.hostname, parsed.port)
         path = parsed.path or '/'
@@ -173,6 +176,8 @@
         conn.close()        
 
     def __append_changed(self, changed):
+        if len(changed) == 0:
+            return
         try:
             self.__task_lock.acquire()
             self.__changed_buffer.extend(changed)
@@ -196,7 +201,7 @@
                     _logger.exception("failed to find task key %r", taskkey)
                     continue
                 if curtask.task.prev_hash != hashcode:
-                    _logger.debug("task %r: new hash for %r differs from prev %r", 
+                    _logger.debug("task %r: new hash %r differs from prev %r", 
                                   taskkey, hashcode, curtask.task.prev_hash)
                     changed.append(taskkey)
         finally:

Modified: dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/ExternalServiceServlet.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/ExternalServiceServlet.java	2008-02-07 18:14:53 UTC (rev 7295)
+++ dumbhippo/trunk/server/src/com/dumbhippo/web/servlets/ExternalServiceServlet.java	2008-02-07 19:00:11 UTC (rev 7296)
@@ -48,10 +48,11 @@
 
         logRequest(request, "POST");
   
-        String key = request.getParameter("eak");
-        if (key == null || !key.equals(accessKey))
-        	throw new HttpException(HttpResponseCode.FORBIDDEN, "Invalid or unspecified access key");
-        
+        String key = request.getParameter("esk");
+        if (key == null || accessKey.equals(""))
+        	throw new HttpException(HttpResponseCode.FORBIDDEN, "Unspecified access key");
+        if (!key.equals(accessKey))
+        	throw new HttpException(HttpResponseCode.FORBIDDEN, "Invalid access key");        	
         if (request.getPathInfo().equals("/notify-polling-tasks")) {
 			MBeanServer server = MBeanServerLocator.locateJBoss();
 			SwarmPollingSystemMBean swarm;			
@@ -62,11 +63,12 @@
 			}
 			
         	String json = IOUtils.toString(request.getInputStream());
+        	logger.debug("got updated tasks: {}", json);
         	JSONObject obj;
         	JSONArray tasksProp;
         	try {
 				obj = new JSONObject(json);
-				tasksProp = obj.getJSONArray("tasks");
+				tasksProp = obj.getJSONArray("updated_keys");
 			} catch (JSONException e) {
 				throw new ServletException(e);
 			}
@@ -80,7 +82,9 @@
 				}
         	}
         	swarm.runExternalTasks(tasks);
-        }     
+        } else {
+        	throw new HttpException(HttpResponseCode.NOT_FOUND, "Unknown service");
+        }
         
 		response.setContentType("text/plain");
 		response.getOutputStream().write("".getBytes());

Modified: dumbhippo/trunk/super/firehose/files/conf/mugshot.cfg
===================================================================
--- dumbhippo/trunk/super/firehose/files/conf/mugshot.cfg	2008-02-07 18:14:53 UTC (rev 7295)
+++ dumbhippo/trunk/super/firehose/files/conf/mugshot.cfg	2008-02-07 19:00:11 UTC (rev 7296)
@@ -14,7 +14,7 @@
 firehose.taskdbpath="%(current_dir_uri)s/data/dev-tasks.sqlite"
 firehose.masterhost="@@firehoseMasterHost@@"
 firehose.localslaveport="@@firehoseLocalSlavePort@@"
-firehose.clienturl="http://@@serverHost@:@@tomcatHttpPort@@/extservice/notify-polling-tasks";
+firehose.clienturl="http://@@serverHost@@:@@tomcatHttpPort@@/extservice/notify-polling-tasks";
 firehose.externalServiceKey="@@externalServiceKey@@"
 
 # if you are using a database or table type without transactions

Modified: dumbhippo/trunk/super/jboss/files/deploy/properties-service.xml
===================================================================
--- dumbhippo/trunk/super/jboss/files/deploy/properties-service.xml	2008-02-07 18:14:53 UTC (rev 7295)
+++ dumbhippo/trunk/super/jboss/files/deploy/properties-service.xml	2008-02-07 19:00:11 UTC (rev 7296)
@@ -26,7 +26,7 @@
         dumbhippo.server.http.port=@@tomcatHttpPort:properties@@
 		dumbhippo.server.baseurl=@@baseurl:properties@@
 		dumbhippo.server.baseurlGnome=@@baseurlGnome:properties@@
-        dumbhippo.server.externalServiceKey=@@externalServiceKey::properties@@
+        dumbhippo.server.externalServiceKey=@@externalServiceKey:properties@@
         dumbhippo.server.firehoseMasterHost=@@firehoseMasterHost:properties@@
         dumbhippo.server.firehoseMasterPort=@@firehoseMasterPort:properties@@
 		dumbhippo.server.adminjid.mugshot=@@adminJid:properties@@



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]