Commit 01267a57 authored by Jean-Paul Smets's avatar Jean-Paul Smets

bugfixes for newMessage and non has path


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@717 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 81e80209
...@@ -47,12 +47,12 @@ class RAMDict(Queue): ...@@ -47,12 +47,12 @@ class RAMDict(Queue):
def finishQueueMessage(self, activity_tool, m): def finishQueueMessage(self, activity_tool, m):
if m.is_registered: if m.is_registered:
self.dict[(m.object_path, m.method_id)] = m self.dict[(tuple(m.object_path), m.method_id)] = m
def finishDeleteMessage(self, activity_tool, message): def finishDeleteMessage(self, activity_tool, message):
for key, m in self.dict.items(): for key, m in self.dict.items():
if m.object_path == message.object_path and m.method_id == message.method_id: if m.object_path == message.object_path and m.method_id == message.method_id:
del self.dict[(m.object_path, m.method_id)] del self.dict[(tuple(m.object_path), m.method_id)]
def registerActivityBuffer(self, activity_buffer): def registerActivityBuffer(self, activity_buffer):
class_name = self.__class__.__name__ class_name = self.__class__.__name__
...@@ -61,12 +61,12 @@ class RAMDict(Queue): ...@@ -61,12 +61,12 @@ class RAMDict(Queue):
def isMessageRegistered(self, activity_buffer, activity_tool, m): def isMessageRegistered(self, activity_buffer, activity_tool, m):
class_name = self.__class__.__name__ class_name = self.__class__.__name__
return getattr(activity_buffer, '_%s_uid_dict' % class_name).has_key((m.object_path, m.method_id)) return getattr(activity_buffer, '_%s_uid_dict' % class_name).has_key((tuple(m.object_path), m.method_id))
def registerMessage(self, activity_buffer, activity_tool, m): def registerMessage(self, activity_buffer, activity_tool, m):
class_name = self.__class__.__name__ class_name = self.__class__.__name__
getattr(activity_buffer, '_%s_message_list' % class_name).append(m) getattr(activity_buffer, '_%s_message_list' % class_name).append(m)
getattr(activity_buffer, '_%s_uid_dict' % class_name)[(m.object_path, m.method_id)] = 1 getattr(activity_buffer, '_%s_uid_dict' % class_name)[(tuple(m.object_path), m.method_id)] = 1
m.is_registered = 1 m.is_registered = 1
def dequeueMessage(self, activity_tool, processing_node): def dequeueMessage(self, activity_tool, processing_node):
......
...@@ -74,17 +74,17 @@ class SQLDict(RAMDict): ...@@ -74,17 +74,17 @@ class SQLDict(RAMDict):
activity_buffer._sqldict_message_list = [] activity_buffer._sqldict_message_list = []
def isMessageRegistered(self, activity_buffer, activity_tool, m): def isMessageRegistered(self, activity_buffer, activity_tool, m):
return activity_buffer._sqldict_uid_dict.has_key((m.object_path, m.method_id)) return activity_buffer._sqldict_uid_dict.has_key((tuple(m.object_path), m.method_id))
def registerMessage(self, activity_buffer, activity_tool, m): def registerMessage(self, activity_buffer, activity_tool, m):
m.is_registered = 1 m.is_registered = 1
activity_buffer._sqldict_uid_dict[(m.object_path, m.method_id)] = 1 activity_buffer._sqldict_uid_dict[(tuple(m.object_path), m.method_id)] = 1
activity_buffer._sqldict_message_list.append(m) activity_buffer._sqldict_message_list.append(m)
def unregisterMessage(self, activity_buffer, activity_tool, m): def unregisterMessage(self, activity_buffer, activity_tool, m):
m.is_registered = 0 # This prevents from inserting deleted messages into the queue m.is_registered = 0 # This prevents from inserting deleted messages into the queue
if activity_buffer._sqldict_uid_dict.has_key((m.object_path, m.method_id)): if activity_buffer._sqldict_uid_dict.has_key((tuple(m.object_path), m.method_id)):
del activity_buffer._sqldict_uid_dict[(m.object_path, m.method_id)] del activity_buffer._sqldict_uid_dict[(tuple(m.object_path), m.method_id)]
def getRegisteredMessageList(self, activity_buffer, activity_tool): def getRegisteredMessageList(self, activity_buffer, activity_tool):
if hasattr(activity_buffer,'_sqldict_message_list'): if hasattr(activity_buffer,'_sqldict_message_list'):
......
...@@ -359,6 +359,7 @@ class ActivityTool (Folder, UniqueObject): ...@@ -359,6 +359,7 @@ class ActivityTool (Folder, UniqueObject):
# Some Security Cheking should be made here XXX # Some Security Cheking should be made here XXX
global is_initialized global is_initialized
if not is_initialized: self.initialize() if not is_initialized: self.initialize()
if not hasattr(self, '_v_activity_buffer'): self._v_activity_buffer = ActivityBuffer()
activity_dict[activity].queueMessage(self, Message(path, active_process, activity_kw, method_id, args, kw)) activity_dict[activity].queueMessage(self, Message(path, active_process, activity_kw, method_id, args, kw))
def manageInvoke(self, object_path, method_id, REQUEST=None): def manageInvoke(self, object_path, method_id, REQUEST=None):
......
#!/bin/bash #!/bin/bash
while true; do while true; do
wget -O /tmp/zope_distribute.out http://jp:jp@192.1.2.151:9473/coramy/portal_activities/distribute?node_count:int=1 & #wget -O /tmp/zope_distribute.out http://jp:jp@192.1.2.151:9473/coramy/portal_activities/distribute?node_count:int=1 &
#wget -O /tmp/zope_distribute.out http://jp:jp@localhost:9573/coramy/portal_activities/distribute?node_count:int=1 & wget -O /tmp/zope_distribute.out http://jp:jp@192.1.2.151:9473/coramy/portal_activities/distribute?node_count:int=5 &
#wget -O /tmp/zope_distribute.out http://jp:jp@localhost:9573/coramy/portal_activities/distribute?node_count:int=3 & wget -O /tmp/zope_tic1.out http://jp:jp@192.1.2.151:9473/coramy/portal_activities/tic?processing_node:int=1 &
#wget -O /tmp/zope_distribute.out http://jp:jp@192.1.2.150:9573/coramy/portal_activities/distribute?node_count:int=1 & wget -O /tmp/zope_tic2.out http://jp:jp@192.1.2.150:9473/coramy/portal_activities/tic?processing_node:int=2 &
#wget -O /tmp/zope_distribute.out http://jp:jp@192.1.2.150:9573/coramy/portal_activities/distribute?node_count:int=4 & wget -O /tmp/zope_tic3.out http://jp:jp@192.1.2.150:9573/coramy/portal_activities/tic?processing_node:int=3 &
#wget -O /tmp/zope_tic1.out http://jp:jp@localhost:9573/coramy/portal_activities/tic?processing_node:int=1 & wget -O /tmp/zope_tic4.out http://jp:jp@192.1.2.152:9473/coramy/portal_activities/tic?processing_node:int=4 &
wget -O /tmp/zope_tic2.out http://jp:jp@192.1.2.151:9473/coramy/portal_activities/tic?processing_node:int=1 wget -O /tmp/zope_tic4.out http://jp:jp@192.1.2.153:9473/coramy/portal_activities/tic?processing_node:int=5 &
#wget -O /tmp/zope_tic2.out http://jp:jp@192.1.2.150:9473/coramy/portal_activities/tic?processing_node:int=1 & sleep 15
#wget -O /tmp/zope_tic3.out http://jp:jp@192.1.2.150:9573/coramy/portal_activities/tic?processing_node:int=2 &
#wget -O /tmp/zope_tic2.out http://jp:jp@192.1.2.151:9473/coramy/portal_activities/tic?processing_node:int=3 &
#wget -O /tmp/zope_tic2.out http://jp:jp@192.1.2.152:9473/coramy/portal_activities/tic?processing_node:int=4 &
sleep 5
done done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment