Changeset 488

Show
Ignore:
Timestamp:
05/27/08 09:39:52 (8 months ago)
Author:
mgoldman
Message:

Added agent log pushing.

Subtracted server log pulling.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/trunk-pmd-intproto/agent/agent.py

    r487 r488  
    107107                log file we have come.  Don't send all messages at every startup. 
    108108                ''' 
    109                 print "Unimplemented" 
    110                 return None 
     109                msgs = self.log.newmsgs() 
     110                if msgs == []: 
     111                        return None 
     112                return protocol.Message("log", "update", msgs) 
    111113 
    112114        def updated_modules(self): 
  • branches/trunk-pmd-intproto/server/master.py

    r486 r488  
    363363                return [self.service_manager(m) for m in self.manager.accept_and_wait(timeout)] 
    364364 
    365         def updatelogs(self): 
    366                 ''' Updates server side logs for all known clients. ''' 
    367                 msg = protocol.Message() 
    368                 msg.msg = "log" 
    369                 msg.type = "query" 
    370                 msg.body = "UPDATE" 
    371                 # Call the comm function to send the messages and collect the results 
    372                 # first function just returns the message, pass in the message and 
    373                 # None for the manager and info since we aren't going to use it. 
    374                 res = self.comm(lambda *x: msg, msg, (None, None)) 
    375                 s = storage.Layer(storage_root) 
    376                 [s.append_log_messages(id, lst) for ((clientsock,lst), id) in res] 
    377                 s.update() 
    378  
    379365        def query(self, ip, item, queryl): 
    380366                if queryl == []: 
     
    401387if __name__ == "__main__": 
    402388        m = Master() 
    403         cntr = 0 
    404389        while True: 
    405390                print "sheep" 
    406391                m.run2(5) 
    407                 if(cntr % 12 == 0): 
    408                         m.updatelogs() 
    409                 cntr += 1