Index: /trunk/Monitoring/Watch/repo-state
===================================================================
--- /trunk/Monitoring/Watch/repo-state	(revision 874)
+++ /trunk/Monitoring/Watch/repo-state	(revision 875)
@@ -1,270 +1,3 @@
 #!/usr/bin/env python
-
-# --- ncurses sample 1
-
-#import curses
-#from curses import panel
-#
-#class Menu(object):
-#
-#	def __init__(self, items, stdscreen):
-#		self.window = stdscreen.subwin(0,0)
-#		self.window.keypad(1)
-#		self.panel = panel.new_panel(self.window)
-#		self.panel.hide()
-#		panel.update_panels()
-#
-#		self.position = 0
-#		self.items = items
-#		self.items.append(('exit','exit'))
-#
-#	def navigate(self, n):
-#		self.position += n
-#		if self.position < 0:
-#			self.position = 0
-#		elif self.position >= len(self.items):
-#			self.position = len(self.items)-1
-#
-#	def display(self):
-#		self.panel.top()
-#		self.panel.show()
-#		self.window.clear()
-#
-#
-#		while True:
-#			self.window.refresh()
-#			curses.doupdate()
-#			for index, item in enumerate(self.items):
-#				if index == self.position:
-#					mode = curses.A_REVERSE
-#				else:
-#					mode = curses.A_NORMAL
-#
-#				msg = '%d. %s' % (index, item[0])
-#				self.window.addstr(1+index, 1, msg, mode)
-#
-#			key = self.window.getch()
-#
-#			if key in [curses.KEY_ENTER, ord('\n')]:
-#				if self.position == len(self.items)-1:
-#					break
-#				else:
-#					self.items[self.position][1]()
-#
-#			elif key == curses.KEY_UP:
-#				self.navigate(-1)
-#
-#			elif key == curses.KEY_DOWN:
-#				self.navigate(1)
-#
-#		self.window.clear()
-#		self.panel.hide()
-#		panel.update_panels()
-#		curses.doupdate()
-#
-#
-#class MyApp(object):
-#
-#	def __init__(self, stdscreen):
-#		self.screen = stdscreen
-#		curses.curs_set(0)
-#
-#		submenu_items = [
-#				('beep', curses.beep),
-#				('flash', curses.flash)
-#				]
-#		submenu = Menu(submenu_items, self.screen)
-#
-#		main_menu_items = [
-#				('beep', curses.beep),
-#				('flash', curses.flash),
-#				('submenu', submenu.display)
-#				]
-#		main_menu = Menu(main_menu_items, self.screen)
-#		main_menu.display()
-
-#if __name__ == '__main__':
-#	curses.wrapper(MyApp)
-
-
-
-
-
-# --- ncurses sample 2
-
-# Author: Nikolai Tschacher
-# Date: 02.06.2013
-#
-#class BoxSelector:
-#    """ Originally designed for accman.py.
-#        Display options build from a list of strings in a (unix) terminal.
-#        The user can browser though the textboxes and select one with enter.
-#    """
-#    
-#    def __init__(self, L):
-#        """ Create a BoxSelector object. 
-#            L is a list of strings. Each string is used to build 
-#            a textbox.
-#        """
-#        self.L = L
-#        # Element parameters. Change them here.
-#        self.TEXTBOX_WIDTH = 50
-#        self.TEXTBOX_HEIGHT = 6
-#
-#        self.PAD_WIDTH = 400
-#        self.PAD_HEIGHT = 10000
-#        
-#    def pick(self):
-#        """ Just run this when you want to spawn the selction process. """
-#        self._init_curses()
-#        self._create_pad()
-#        
-#        windows = self._make_textboxes()
-#        picked = self._select_textbox(windows)
-#        
-#        self._end_curses()
-#        
-#        return picked
-#        
-#    def _init_curses(self):
-#        """ Inits the curses appliation """
-#        # initscr() returns a window object representing the entire screen.
-#        self.stdscr = curses.initscr()
-#        # turn off automatic echoing of keys to the screen
-#        curses.noecho()
-#        # Enable non-blocking mode. Keys are read directly, without hitting enter.
-#        curses.cbreak()
-#        # Disable the mouse cursor.
-#        curses.curs_set(0)
-#        self.stdscr.keypad(1)
-#        # Enable colorous output.
-#        curses.start_color()
-#        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)
-#        curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
-#        self.stdscr.bkgd(curses.color_pair(2))
-#        self.stdscr.refresh()
-#
-#    def _end_curses(self):
-#        """ Terminates the curses application. """
-#        curses.nocbreak()
-#        self.stdscr.keypad(0)
-#        curses.echo()
-#        curses.endwin()
-#        
-#    def _create_pad(self):
-#        """ Creates a big self.pad to place the textboxes in. """
-#        self.pad = curses.newpad(self.PAD_HEIGHT, self.PAD_WIDTH)
-#        self.pad.box()
-#        
-#    def _make_textboxes(self):
-#        """ Build the textboxes in the pad center and put them in the 
-#            horizontal middle of the pad. """
-#        # Get the actual screensize.
-#        maxy, maxx = self.stdscr.getmaxyx()
-#        
-#        windows = []
-#        i = 1
-#        for s in self.L:
-#            windows.append(self.pad.derwin(self.TEXTBOX_HEIGHT,
-#                    self.TEXTBOX_WIDTH, i, self.PAD_WIDTH//2-self.TEXTBOX_WIDTH//2))
-#            i += self.TEXTBOX_HEIGHT
-#            
-#        for k in range(len(windows)):
-#            windows[k].box()
-#            windows[k].addstr(4, 4, '0x{0:X} - {1}'.format(k, self.L[k]))
-#            
-#        return windows
-#
-#    def _center_view(self, window):
-#        """ Centers and aligns the view according to the window argument given. 
-#            Returns the (y, x) coordinates of the centered window. """
-#        # The refresh() and noutrefresh() methods of a self.pad require 6 arguments
-#        # to specify the part of the self.pad to be displayed and the location on
-#        # the screen to be used for the display. The arguments are pminrow,
-#        # pmincol, sminrow, smincol, smaxrow, smaxcol; the p arguments refer
-#        # to the upper left corner of the self.pad region to be displayed and the
-#        # s arguments define a clipping box on the screen within which the
-#        # self.pad region is to be displayed.
-#        cy, cx = window.getbegyx()
-#        maxy, maxx = self.stdscr.getmaxyx()
-#        self.pad.refresh(cy, cx, 1, maxx//2 - self.TEXTBOX_WIDTH//2, maxy-1, maxx-1)
-#        return (cy, cx)
-#        
-#    def _select_textbox(self, windows):
-#        # See at the root textbox.
-#        topy, topx = self._center_view(windows[0])
-#        
-#        current_selected = 0
-#        last = 1
-#        top_textbox = windows[0]
-#        
-#        while True:
-#            # Highligth the selected one, the last selected textbox should
-#            # become normal again.
-#            windows[current_selected].bkgd(curses.color_pair(1))
-#            windows[last].bkgd(curses.color_pair(2))
-#            
-#            # While the textbox can be displayed on the page with the current 
-#            # top_textbox, don't alter the view. When this becomes impossible, 
-#            # center the view to last displayable textbox on the previous view.
-#            maxy, maxx = self.stdscr.getmaxyx()
-#            cy, cx = windows[current_selected].getbegyx()
-#            
-#            # The current window is to far down. Switch the top textbox.
-#            if ((topy + maxy - self.TEXTBOX_HEIGHT) <= cy):
-#                top_textbox = windows[current_selected]
-#            
-#            # The current window is to far up. There is a better way though...
-#            if topy >= cy + self.TEXTBOX_HEIGHT:
-#                top_textbox = windows[current_selected]
-#            
-#            if last != current_selected:
-#                last = current_selected
-#                
-#            topy, topx = self._center_view(top_textbox)
-#            
-#            c = self.stdscr.getch()
-#            
-#            # Vim like KEY_UP/KEY_DOWN with j(DOWN) and k(UP).
-#            if c == ord('j'):
-#                if current_selected >= len(windows)-1:
-#                    current_selected = 0 # wrap around.
-#                else:
-#                    current_selected += 1
-#            elif c == ord('k'):
-#                if current_selected <= 0:
-#                    current_selected = len(windows)-1 # wrap around.
-#                else:
-#                    current_selected -= 1
-#            elif c == ord('q'): # Quit without selecting.
-#                break
-#            # At hitting enter, return the index of the selected list element.
-#            elif c == curses.KEY_ENTER or c == 10:
-#                return int(current_selected)
-#
-#
-#if __name__ == '__main__':
-#    # As simple as that.
-#    L = [
-#         'I wish I was a wizard',
-#         'Sometimes it all just makes sense',
-#         'This string is here because I need it',
-#         'Being or not being!',
-#         'Python is worse then PHP ;)',
-#         'a -> b <=> if a then b'
-#        ]
-#        
-#    choice = BoxSelector(L).pick()
-#    print('[+] Your choice was "{0}"'.format(L[choice]))
-
-
-
-
-
-
-
-# --- ncurses sample 3
-
-
 
 import sys
@@ -279,4 +12,17 @@
 
 
+# init
+
+# set pad height/width
+padhlines = 4
+padwcols = 30
+
+# add margin
+padhlines += 2
+padwcols += 2
+
+
+
+
 repo_io.init() # open DB connection
 
@@ -285,58 +31,91 @@
 simulations=repo_io.retrieve_simulations()
 
-mylines = ["Line {0} ".format(id)*3 for id in range(1,11)]
 
 
+def display_simulation_list(mydata):
+
+	hlines = begin_y = begin_x = 5
+
+	# stuff
+	mypad.scrollok(1)
+	mypad.idlok(1)
+
+	mypad.border(0) # clear border
+  
+	y=padhlines-1
+
+  	# write strings
+	for line in mydata:
+		mypad.addstr(y,1, line)
+		mypad.scroll(1)
+  
+
+	mypad.border(0) # clear border
+
+
+
+	# refresh the pads
+	mypad.refresh(0,0, begin_y,begin_x, begin_y+hlines, begin_x+padwcols)
+
+	
+	mypad.touchwin()  # pretend the all stuff has been changed
+
+
+# better way
+
 def main(stdscr):
-  hlines = begin_y = begin_x = 5 ; wcols = 10
-  # calculate total content size
-  padhlines = len(mylines)
-  padwcols = 0
-  for line in mylines:
-    if len(line) > padwcols: padwcols = len(line)
-  padhlines += 2 ; padwcols += 2 # allow border
-  #stdscr.addstr("padhlines "+str(padhlines)+" padwcols "+str(padwcols)+"; ")
-  # both newpad and subpad are <class '_curses.curses window'>:
-  mypadn = curses.newpad(padhlines, padwcols)
-  mypads = stdscr.subpad(padhlines, padwcols, begin_y, begin_x+padwcols+4)
-  #stdscr.addstr(str(type(mypadn))+" "+str(type(mypads)) + "\n")
-  mypadn.scrollok(1)
-  mypadn.idlok(1)
-  mypads.scrollok(1)
-  mypads.idlok(1)
 
-  mypadn.border(0) # first ...
-  mypads.border(0) # ... border
+	"""
+	window test
 
-  for line in mylines:
-    mypadn.addstr(padhlines-1,1, line)
-    mypadn.scroll(1)
-    mypads.addstr(padhlines-1,1, line)
-    mypads.scroll(1)
+	begin_x = 20 ; begin_y = 7
+	height = 5 ; width = 40
+	win = curses.newwin(height, width, begin_y, begin_x)
+	"""
 
-  mypadn.border(0) # second ...
-  mypads.border(0) # ... border
+	# create pad
+	global mypad
+	mypad=curses.newpad(padhlines, padwcols)
 
-  # refresh parent first, to render the texts on top
-  #~ stdscr.refresh()
-
-  # refresh the pads next
-  mypadn.refresh(0,0, begin_y,begin_x, begin_y+hlines, begin_x+padwcols)
-  mypads.refresh()
-  mypads.touchwin()
-  mypadn.touchwin()
-  stdscr.touchwin() # no real effect here
-  #stdscr.refresh() # not here! overwrites newpad!
-  mypadn.getch()
-  # even THIS command erases newpad!
-  # (unless stdscr.refresh() previously):
-  stdscr.getch()
-
-curses.wrapper(main)
+	# what to display
+	data = [s.name+" "+s.status for s in simulations]
+  
+  
+	display_simulation_list(data)
 
 
 
 
-repo_io.free() # close DB connection
+
+
+	while True:
+		c = mypad.getch() # even THIS command erases newpad!
+		#stdscr.getch()
+
+		if c in (curses.KEY_ENTER,):
+			# => doesn't work...
+
+			break
+		elif c in (ord('q'),ord('Q')):
+			# => works...
+
+			break
+
+		elif c in (ord('r'),ord('R')):
+
+			# debug
+			#stdscr.addstr()
+
+			mypad.erase()
+
+			display_simulation_list(data)
+
+			# pretend the all stuff has been changed
+			# no real effect here
+			#stdscr.touchwin()
+
+			stdscr.refresh() # refresh parent first, to render the texts on top
+
+			
 
 
@@ -348,26 +127,6 @@
 
 
-# --- urwid sample 1
 
-#import urwid
-#
-#txt = urwid.Text(u"Hello World")
-#fill = urwid.Filler(txt, 'top')
-#loop = urwid.MainLoop(fill)
-#loop.run()
+curses.wrapper(main)
 
-
-# --- urwid sample 2
-
-#import urwid
-#
-#def show_or_exit(key):
-#    if key in ('q', 'Q'):
-#        raise urwid.ExitMainLoop()
-#    txt.set_text(repr(key))
-#
-#txt = urwid.Text(u"Hello World")
-#fill = urwid.Filler(txt, 'top')
-#loop = urwid.MainLoop(fill, unhandled_input=show_or_exit)
-#loop.run()
-
+repo_io.free() # close DB connection
Index: /trunk/Monitoring/Watch/watch
===================================================================
--- /trunk/Monitoring/Watch/watch	(revision 874)
+++ /trunk/Monitoring/Watch/watch	(revision 875)
@@ -29,4 +29,5 @@
 import smon.types
 
+
 class Mail():
 
@@ -59,6 +60,24 @@
 
 	@classmethod
+	def cleanup(cls,message):
+		repo_io.cleanup() # truncate/delete everything
+
+	@classmethod
 	def set_sim_status_to_error(cls,message):
-		repo_io.update_simulation_status()
+
+		s=repo_io.retrieve_simulation(message.simuid)
+
+		s.status="error"
+
+		repo_io.update_simulation_status(s)
+
+	@classmethod
+	def set_sim_status_to_complete(cls,message):
+
+		s=repo_io.retrieve_simulation(message.simuid)
+
+		s.status="complete"
+
+		repo_io.update_simulation_status(s)
 
 	@classmethod
@@ -68,5 +87,5 @@
 		#repo_io.delete_simulation(name)
 
-		simulation=smon.types.Simulation(name=message.simuid)
+		simulation=smon.types.Simulation(name=message.simuid,status="running")
 
 		repo_io.create_simulation(simulation)
@@ -80,5 +99,5 @@
 		# used for debug
 
-		if "file" in message:
+		if message.file is not None:
 			print "%s %s %s\n"%(message.code,message.jobid,message.file)
 		else:
@@ -107,10 +126,27 @@
 class MessageActionsMapping():
 
+	# 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"],
+				"8888":["cleanup"],
+				"9000":["log", "print_stdout"],
+				"9999":["log", "print_stdout", "set_sim_status_to_error"] }
+
+	# prod
+	"""
 	mapping = { "0000":["log", "store_msg", "crea_sim"],
+				"0100":["log", "store_msg", "set_sim_status_to_complete"],
 				"1000":["log", "store_msg"],
+				"1100":["log", "store_msg"],
 				"2000":["log", "store_msg"],
 				"3000":["log", "store_msg"],
+				"8888":["cleanup"],
 				"9000":["log", "store_msg", "mail"],
 				"9999":["log", "store_msg", "set_sim_status_to_error", "mail"] }
+	"""
 
 class Watcher():
@@ -198,6 +234,6 @@
 				print "ERR009 - exception occurs (exception=%s,msg=%s)"%(str(e),base64_decoded_msg)
 
-				#traceback.print_exc()
-				#raise
+				traceback.print_exc()
+				raise
 
 
@@ -218,6 +254,6 @@
 			try:
 				# message code based action
-				#Actions.execActions(message)
-				pass
+				Actions.execActions(message)
+
 			except Exception,e:
 				print "ERR019 - exception occurs (exception=%s,msg=%s)"%(str(e),base64_decoded_msg)
@@ -227,4 +263,7 @@
 				raise
 
+
+			# slow down consumer
+			#time.sleep(0.5)
 
 
@@ -241,4 +280,5 @@
 		print 'You pressed Ctrl+C!'
 		Watcher.channel.stop_consuming()
+		Watcher.stop()
 		sys.exit(0)
 
@@ -248,11 +288,16 @@
 
 	try:
+
+		Watcher.start()
+
 		Watcher.main()
 
+		Watcher.stop()
+
 		sys.exit(0)
 
 	except Exception, e:
 
-		#traceback.print_exc()
+		traceback.print_exc()
 
 		sys.exit(1)
Index: /trunk/Monitoring/libIGCM_mock/libIGCM_mock.sh
===================================================================
--- /trunk/Monitoring/libIGCM_mock/libIGCM_mock.sh	(revision 874)
+++ /trunk/Monitoring/libIGCM_mock/libIGCM_mock.sh	(revision 875)
@@ -49,9 +49,10 @@
 
 OPTIONS:
+   -c              ask for confirmation
    -h              this help
    -f              set stack file
    -l              print scenarios list 
    -m              set MODE
-                   MODE may be "scenario", "stackfile" or "purge"
+                   MODE may be "scenario", "stackfile" or "cleanup"
                    default mode is "scenario"
    -s              set scenario file
@@ -84,4 +85,9 @@
 }
 
+send_cleanup_msg()
+{
+	$send_msg_cmd -h localhost -p 5672 -b "$( echo {\"code\":\"8888\"} | base64 -w 0 )"
+}
+
 # check
 
@@ -130,5 +136,5 @@
 	# check
 	if [ ! -f "$g__scenariofile" ]; then
-		msg "LIBIGCM-MOCK-ERR003" "scenario file not found"
+		msg "LIBIGCM-MOCK-ERR003" "scenario file not found ($g__scenariofile)"
 		exit 1
 	fi
@@ -222,5 +228,5 @@
 
 		if [ "$g__confirm" = "1" ]; then
-			read -p "Press enter for next message" bla
+			read -p "<<< $l__JSON_msg_buf >>>> sent. Press enter for next message" bla
 		else
 			sleep $g__delay
@@ -234,7 +240,7 @@
 	done 3<$g__scenariofile
 
-elif [ "$g__mode" = "purge" ]; then
-
-	:
+elif [ "$g__mode" = "cleanup" ]; then
+
+	send_cleanup_msg
 
 elif [ "$g__mode" = "stackfile" ]; then
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__fatal_error__stop_simu
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__fatal_error__stop_simu	(revision 874)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__fatal_error__stop_simu	(revision 875)
@@ -1,6 +1,6 @@
-simuid=simu-001 jobid=job-001 code=0000 file=config.card.base64
-simuid=simu-001 jobid=job-001 code=1000
-simuid=simu-001 jobid=job-001 code=2000
-simuid=simu-001 jobid=job-001 code=3000
-simuid=simu-001 jobid=job-001 code=1100
-simuid=simu-001 jobid=job-001 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=9000 
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9999
+
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__nonfatal_errors__stop_simu
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__nonfatal_errors__stop_simu	(revision 874)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__nonfatal_errors__stop_simu	(revision 875)
@@ -1,6 +1,6 @@
-simuid=simu-001 jobid=job-001 code=0000 file=config.card.base64
-simuid=simu-001 jobid=job-001 code=1000
-simuid=simu-001 jobid=job-001 code=2000
-simuid=simu-001 jobid=job-001 code=3000
-simuid=simu-001 jobid=job-001 code=1100
-simuid=simu-001 jobid=job-001 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 
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_killed
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_killed	(revision 874)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_killed	(revision 875)
@@ -1,6 +1,4 @@
-simuid=simu-001 jobid=job-001 code=0000 file=config.card.base64
-simuid=simu-001 jobid=job-001 code=1000
-simuid=simu-001 jobid=job-001 code=2000
-simuid=simu-001 jobid=job-001 code=3000
-simuid=simu-001 jobid=job-001 code=1100
-simuid=simu-001 jobid=job-001 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 
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_segfault
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_segfault	(revision 874)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__simu_segfault	(revision 875)
@@ -1,6 +1,6 @@
-simuid=simu-001 jobid=job-001 code=0000 file=config.card.base64
-simuid=simu-001 jobid=job-001 code=1000
-simuid=simu-001 jobid=job-001 code=2000
-simuid=simu-001 jobid=job-001 code=3000
-simuid=simu-001 jobid=job-001 code=1100
-simuid=simu-001 jobid=job-001 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=9000 
+simuid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE jobid=BIGBRO.clim.TEST.LMDZOR.p86denv.TGCC.CURIE.1 code=9999
+
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 874)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__start_second_simu_with_same_name	(revision 875)
@@ -1,6 +1,12 @@
-simuid=simu-001 jobid=job-001 code=0000 file=config.card.base64
-simuid=simu-001 jobid=job-001 code=1000
-simuid=simu-001 jobid=job-001 code=2000
-simuid=simu-001 jobid=job-001 code=3000
-simuid=simu-001 jobid=job-001 code=1100
-simuid=simu-001 jobid=job-001 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 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
Index: /trunk/Monitoring/libIGCM_mock/scenario/start_simu__stop_simu
===================================================================
--- /trunk/Monitoring/libIGCM_mock/scenario/start_simu__stop_simu	(revision 874)
+++ /trunk/Monitoring/libIGCM_mock/scenario/start_simu__stop_simu	(revision 875)
@@ -1,6 +1,6 @@
-simuid=simu-001 jobid=job-001 code=0000 file=config.card.base64
-simuid=simu-001 jobid=job-001 code=1000
-simuid=simu-001 jobid=job-001 code=2000
-simuid=simu-001 jobid=job-001 code=3000
-simuid=simu-001 jobid=job-001 code=1100
-simuid=simu-001 jobid=job-001 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 
Index: /trunk/Monitoring/smon/local_repo.py
===================================================================
--- /trunk/Monitoring/smon/local_repo.py	(revision 874)
+++ /trunk/Monitoring/smon/local_repo.py	(revision 875)
@@ -26,5 +26,8 @@
 		raise Exception()
 
-	_conn=sqlite3.connect(":memory:",timeout)
+	db_file="/home/jripsl/supervisor/local_db/local_repo.db"
+	#db_file=":memory:"
+
+	_conn=sqlite3.connect(db_file,timeout)
 
 	create_tables()
@@ -40,17 +43,36 @@
 	_conn=None
 
+def commit():
+	"""
+	public method
+
+	not used for now
+	"""
+	_conn.commit()
+	
+def rollback():
+	_conn.rollback()
+
 def create_tables():
 
-	_conn.execute("create table simulation (id INTEGER PRIMARY KEY, name TEXT)")
-	_conn.execute("create unique index idx_simulation on simulation (name)")
+	_conn.execute("create table if not exists simulation (id INTEGER PRIMARY KEY, name TEXT, status TEXT)")
+	_conn.execute("create unique index if not exists idx_simulation_1 on simulation (name)")
 
-	_conn.execute("create table 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)") # TODO: check how to use INT datatype for simulation_id column
+
+def cleanup():
+	_conn.execute("delete from simulation")
+	_conn.execute("delete from message")
+	_conn.commit()
 
 def populate_tables_with_sample():
 
-	rows = [('SIMU-001',),
-			('SIMU-002',),
-			('SIMU-003',),]
-	_conn.executemany('INSERT INTO simulation (name) VALUES (?)', rows)
+	rows = [('SIMU-001','running'),
+			('SIMU-002','running'),
+			('SIMU-003','running'),]
+
+	_conn.executemany('INSERT INTO simulation (name,status) VALUES (?,?)', rows)
+
+	_conn.commit()
 
 def retrieve_simulations():
@@ -58,9 +80,9 @@
 	c=_conn.cursor()
 
-	c.execute("select name,id from simulation")
+	c.execute("select name,id,status from simulation")
 
 	rs=c.fetchone()
 	while rs is not None:
-		li.append(types.Simulation(name=rs[0],id=rs[1]))
+		li.append(types.Simulation(name=rs[0],id=rs[1],status=rs[2]))
 		rs=c.fetchone()
 
@@ -70,5 +92,5 @@
 	c=_conn.cursor()
 
-	c.execute("select name,id from simulation where name = ?",(name,))
+	c.execute("select name,id,status from simulation where name = ?",(name,))
 
 	rs=c.fetchone()
@@ -77,14 +99,20 @@
 		raise Exception()
 
-	return types.Simulation(id=rs[1])
+	return types.Simulation(name=rs[0],id=rs[1],status=rs[2])
     
 def delete_simulation(simulation):
 	_conn.execute("delete from simulation where name = ?",(simulation.name,))
 
+	_conn.commit()
+
 def create_simulation(simulation):
-	_conn.execute("insert into simulation (name) values (?)",(simulation.name,))
+	_conn.execute("insert into simulation (name,status) values (?,?)",(simulation.name,simulation.status))
+
+	_conn.commit()
     
 def update_simulation_status(simulation):
 	_conn.execute("update simulation set status=? where name = ?",(simulation.status,simulation.name))
+
+	_conn.commit()
 
 def retrieve_messages(simulation):
@@ -105,6 +133,10 @@
 	_conn.execute("delete from message where simulation_id = ?",(simulation.id,))
 
+	_conn.commit()
+
 def create_message(message):
 	_conn.execute("insert into message (simulation_id) values (?)",(message.simuid,))
+
+	_conn.commit()
 
 def retrieve_last_message(simulation):
Index: /trunk/Monitoring/smon/repo_io.py
===================================================================
--- /trunk/Monitoring/smon/repo_io.py	(revision 874)
+++ /trunk/Monitoring/smon/repo_io.py	(revision 875)
@@ -87,4 +87,8 @@
 
 def test():
+	"""
+	not used
+	"""
+
 	repo.create_message("test2", 2, "bla2")
 	commit()
@@ -95,4 +99,14 @@
 	repo.create_message("test3", 3, "bla3")
 	rollback()
+
+def cleanup():
+	if mode==CSTE_MODE_LOCAL_REPO:
+		repo.cleanup()
+	elif mode==CSTE_MODE_REMOTE_REPO:
+		raise Exception("ERR707")
+	elif mode==CSTE_MODE_REMOTE_REPO_STUB:
+		pass
+	else:
+		raise Exception("ERR007 - incorrect mode")
 
 def commit():
Index: /trunk/Monitoring/smon/types.py
===================================================================
--- /trunk/Monitoring/smon/types.py	(revision 874)
+++ /trunk/Monitoring/smon/types.py	(revision 875)
@@ -48,4 +48,5 @@
 
 class Message():
+	file=None
 
 	def __init__(self,JSON_KW):
