Index: /trunk/Monitoring/Analyze/analyze
===================================================================
--- /trunk/Monitoring/Analyze/analyze	(revision 875)
+++ /trunk/Monitoring/Analyze/analyze	(revision 876)
@@ -21,18 +21,12 @@
 from datetime import datetime
 
-from smon import repo_io
+
+# line below is to include "smon" package in the search path
+sys.path.append("/home/jripsl/snapshot/Monitoring")
+
+import smon.repo_io as repo_io
+import smon.types as types
 
 
-
-"""
-Code list reminder
-
-0000 (la simulation dÃ©marre)
-1000 (le job d'une simulation dÃ©marre)
-2000 (PushStack)
-3000 (PopStack OK)
-9000 (PopStack NOK)
-9999 (FATAL)
-"""
 
 class CheckList():
@@ -52,4 +46,6 @@
 		diff=current_time-msg_time
 
+		# debug
+		print "diff=%s"%diff
 
 		if diff>cls.max_time_between_msg:
@@ -68,11 +64,29 @@
 		  changing the simulation status 
 		"""
-		running_simulations=repo_io.get_running_simulations()
-		for simulation in running_simulations:
-			message=repo_io.retrieve_last_messages(simulation)
+
+
+		for simulation in repo_io.get_running_simulations():
+
+			print "checking heartbeat for '%s'"%simulation.name
+
+			try:
+
+				message=repo_io.retrieve_last_message(simulation)
+			except types.MessageNotFoundException, e:
+
+				continue
+
 
 			if msg_timeout(message):
 
-				repo_io.update_simulation_status(simulation) #from "running" to "killed"
+				simulation.status="error"
+
+				repo_io.update_simulation_status(simulation)
+
+				print "heartbeat NOK (simulation status set to 'error')"%simulation.name
+
+
+			else:
+				print "heartbeat OK"%simulation.name
 
 class Analyzer():
@@ -80,9 +94,11 @@
 	@classmethod
 	def start(cls):
-		pass
+		repo_io.init() # open DB connection
+
+		Analyzer.main()
 
 	@classmethod
 	def stop(cls):
-		pass
+		repo_io.free() # close DB connection
 
 	@classmethod
@@ -104,8 +120,12 @@
 		print ' [*] Analyzer running. To exit press CTRL+C'
 
-		CheckList.C0001()
+		while True:
+
+			print "checking simulations heartbeats"
+
+			CheckList.C0001()
 
 
-		sleep(10)
+			time.sleep(1)
 
 		"""
@@ -115,4 +135,7 @@
 def signal_handler(signal, frame):
 		print 'You pressed Ctrl+C!'
+
+		Analyzer.stop()
+
 		sys.exit(0)
 
@@ -122,5 +145,5 @@
 
 	try:
-		Analyzer.main()
+		Analyzer.start()
 
 		sys.exit(0)
Index: /trunk/Monitoring/Watch/watch
===================================================================
--- /trunk/Monitoring/Watch/watch	(revision 875)
+++ /trunk/Monitoring/Watch/watch	(revision 876)
@@ -100,12 +100,12 @@
 
 		if message.file is not None:
-			print "%s %s %s\n"%(message.code,message.jobid,message.file)
+			print "%s %s %s %s %s\n"%(message.code,message.jobid,message.command,message.timestamp,message.file)
 		else:
-			print "%s %s\n"%(message.code,message.jobid)
+			print "%s %s %s %s\n"%(message.code,message.jobid,message.command,message.timestamp)
 
 	@classmethod
 	def log(cls,message):
 		with open("/home/jripsl/supervisor/log/supervisor.log", "a") as log_file:
-			log_file.write("%s %s %s\n"%(datetime.now().strftime('%Y%m%d_%H%M%S'), message.code,message.jobid))
+			log_file.write("%s %s %s %s %s\n"%(datetime.now().strftime('%Y%m%d_%H%M%S'), message.code,message.jobid,message.timestamp,message.command))
 
 	@classmethod
@@ -127,13 +127,13 @@
 
 	# debug
-	mapping = { "0000":["log", "print_stdout", "crea_sim"],
-				"0100":["log", "print_stdout", "set_sim_status_to_complete"],
-				"1000":["log", "print_stdout"],
-				"1100":["log", "print_stdout"],
-				"2000":["log", "print_stdout"],
-				"3000":["log", "print_stdout"],
+	mapping = { "0000":["log", "store_msg", "print_stdout", "crea_sim"],
+				"0100":["log", "store_msg", "print_stdout", "set_sim_status_to_complete"],
+				"1000":["log", "store_msg", "print_stdout"],
+				"1100":["log", "store_msg", "print_stdout"],
+				"2000":["log", "store_msg", "print_stdout"],
+				"3000":["log", "store_msg", "print_stdout"],
 				"8888":["cleanup"],
-				"9000":["log", "print_stdout"],
-				"9999":["log", "print_stdout", "set_sim_status_to_error"] }
+				"9000":["log", "store_msg", "print_stdout"],
+				"9999":["log", "store_msg", "print_stdout", "set_sim_status_to_error"] }
 
 	# prod
Index: /trunk/Monitoring/libIGCM_mock/libIGCM_mock.sh
===================================================================
--- /trunk/Monitoring/libIGCM_mock/libIGCM_mock.sh	(revision 875)
+++ /trunk/Monitoring/libIGCM_mock/libIGCM_mock.sh	(revision 876)
@@ -230,4 +230,5 @@
 			read -p "<<< $l__JSON_msg_buf >>>> sent. Press enter for next message" bla
 		else
+			echo "<<< $l__JSON_msg_buf .>>>>"
 			sleep $g__delay
 		fi
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__fatal_error__stop_simu
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__fatal_error__stop_simu	(revision 875)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__fatal_error__stop_simu	(revision 876)
@@ -1,6 +1,6 @@
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 file=config.card.base64
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9999
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 timestamp=2013-06-11-15:26:28 file=config.card.base64
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9999 timestamp=2013-06-11-15:26:28
 
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__nonfatal_errors__stop_simu
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__nonfatal_errors__stop_simu	(revision 875)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__nonfatal_errors__stop_simu	(revision 876)
@@ -1,6 +1,6 @@
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 file=config.card.base64
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100 
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 timestamp=2013-06-11-15:26:28 file=config.card.base64
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100 timestamp=2013-06-11-15:26:28
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_killed
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_killed	(revision 875)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_killed	(revision 876)
@@ -1,4 +1,4 @@
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 file=config.card.base64
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 timestamp=2013-06-11-15:26:28 file=config.card.base64
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 timestamp=2013-06-11-15:26:28
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_segfault
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_segfault	(revision 875)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_segfault	(revision 876)
@@ -1,6 +1,6 @@
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 file=config.card.base64
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9999
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 timestamp=2013-06-11-15:26:28 file=config.card.base64
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9999 timestamp=2013-06-11-15:26:28
 
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__start_second_simu_with_same_name
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__start_second_simu_with_same_name	(revision 875)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__start_second_simu_with_same_name	(revision 876)
@@ -1,12 +1,12 @@
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 file=config.card.base64
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 file=config.card.base64
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 timestamp=2013-06-11-15:26:28 file=config.card.base64
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 timestamp=2013-06-11-15:26:28 file=config.card.base64
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100 timestamp=2013-06-11-15:26:28
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__stop_simu
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__stop_simu	(revision 875)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__stop_simu	(revision 876)
@@ -1,6 +1,6 @@
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 file=config.card.base64
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100 
-simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100 
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0000 timestamp=2013-06-11-15:26:28 file=config.card.base64
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=2000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=3000 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=1100 timestamp=2013-06-11-15:26:28
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=0100 timestamp=2013-06-11-15:26:28
Index: /trunk/Monitoring/smon/local_repo.py
===================================================================
--- /trunk/Monitoring/smon/local_repo.py	(revision 875)
+++ /trunk/Monitoring/smon/local_repo.py	(revision 876)
@@ -59,5 +59,5 @@
 	_conn.execute("create unique index if not exists idx_simulation_1 on simulation (name)")
 
-	_conn.execute("create table if not exists message (id INTEGER PRIMARY KEY, simulation_id TEXT)") # TODO: check how to use INT datatype for simulation_id column
+	_conn.execute("create table if not exists message (id INTEGER PRIMARY KEY, simulation_id TEXT, body TEXT, crea_date TEXT)") # TODO: check how to use INT datatype for simulation_id column
 
 def cleanup():
@@ -84,5 +84,10 @@
 	rs=c.fetchone()
 	while rs is not None:
-		li.append(types.Simulation(name=rs[0],id=rs[1],status=rs[2]))
+
+		s=types.Simulation(name=rs[0],id=rs[1],status=rs[2])
+
+		li.append(s)
+
+
 		rs=c.fetchone()
 
@@ -136,5 +141,6 @@
 
 def create_message(message):
-	_conn.execute("insert into message (simulation_id) values (?)",(message.simuid,))
+	
+	_conn.execute("insert into message (simulation_id,crea_date) values (?,?)",(message.simuid, message.timestamp))
 
 	_conn.commit()
@@ -143,10 +149,10 @@
 	c=_conn.cursor()
 
-	_conn.execute("select id, content from message where simulation_id=? order by id desc limit 1",(simulation.id,))
+	_conn.execute("select id, simulation_id, body, crea_date from message where simulation_id=? order by crea_date desc limit 1",(simulation.id,))
 
 	rs=c.fetchone()
 
 	if rs is None:
-		raise Exception()
+		raise types.MessageNotFoundException()
 
-	return types.Message(id=rs[0])
+	return types.Message(id=rs[0],simulation_id=rs[1],body=rs[2],timestamp=rs[3])
Index: /trunk/Monitoring/smon/repo_io.py
===================================================================
--- /trunk/Monitoring/smon/repo_io.py	(revision 875)
+++ /trunk/Monitoring/smon/repo_io.py	(revision 876)
@@ -300,5 +300,5 @@
 	running_simulation=[]
 
-	for s in retrieve_simulation():
+	for s in retrieve_simulations():
 		if s.status=="running":
 			running_simulation.append(s)
Index: /trunk/Monitoring/smon/types.py
===================================================================
--- /trunk/Monitoring/smon/types.py	(revision 875)
+++ /trunk/Monitoring/smon/types.py	(revision 876)
@@ -28,4 +28,7 @@
 		return ",".join(['%s=%s'%(k,str(v)) for (k,v) in self.__dict__.iteritems()])
 
+class MessageNotFoundException(SMONException):
+	pass
+
 class Tree():
 
@@ -43,4 +46,5 @@
 		self.status=kw.get("status")
 		self.name=kw.get("name")
+		self.id=kw.get("id")
 
 	def __str__(self):
@@ -49,4 +53,8 @@
 class Message():
 	file=None
+	simuid=None
+	jobid=None
+	timestamp=None
+	command=None
 
 	def __init__(self,JSON_KW):
