Changeset 876 for trunk/Monitoring/smon


Ignore:
Timestamp:
06/12/13 11:14:57 (11 years ago)
Author:
jripsl
Message:

Timeout test impl.
Add timestamp.

Location:
trunk/Monitoring/smon
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Monitoring/smon/local_repo.py

    r875 r876  
    5959        _conn.execute("create unique index if not exists idx_simulation_1 on simulation (name)") 
    6060 
    61         _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 
     61        _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 
    6262 
    6363def cleanup(): 
     
    8484        rs=c.fetchone() 
    8585        while rs is not None: 
    86                 li.append(types.Simulation(name=rs[0],id=rs[1],status=rs[2])) 
     86 
     87                s=types.Simulation(name=rs[0],id=rs[1],status=rs[2]) 
     88 
     89                li.append(s) 
     90 
     91 
    8792                rs=c.fetchone() 
    8893 
     
    136141 
    137142def create_message(message): 
    138         _conn.execute("insert into message (simulation_id) values (?)",(message.simuid,)) 
     143         
     144        _conn.execute("insert into message (simulation_id,crea_date) values (?,?)",(message.simuid, message.timestamp)) 
    139145 
    140146        _conn.commit() 
     
    143149        c=_conn.cursor() 
    144150 
    145         _conn.execute("select id, content from message where simulation_id=? order by id desc limit 1",(simulation.id,)) 
     151        _conn.execute("select id, simulation_id, body, crea_date from message where simulation_id=? order by crea_date desc limit 1",(simulation.id,)) 
    146152 
    147153        rs=c.fetchone() 
    148154 
    149155        if rs is None: 
    150                 raise Exception() 
     156                raise types.MessageNotFoundException() 
    151157 
    152         return types.Message(id=rs[0]) 
     158        return types.Message(id=rs[0],simulation_id=rs[1],body=rs[2],timestamp=rs[3]) 
  • trunk/Monitoring/smon/repo_io.py

    r875 r876  
    300300        running_simulation=[] 
    301301 
    302         for s in retrieve_simulation(): 
     302        for s in retrieve_simulations(): 
    303303                if s.status=="running": 
    304304                        running_simulation.append(s) 
  • trunk/Monitoring/smon/types.py

    r875 r876  
    2828                return ",".join(['%s=%s'%(k,str(v)) for (k,v) in self.__dict__.iteritems()]) 
    2929 
     30class MessageNotFoundException(SMONException): 
     31        pass 
     32 
    3033class Tree(): 
    3134 
     
    4346                self.status=kw.get("status") 
    4447                self.name=kw.get("name") 
     48                self.id=kw.get("id") 
    4549 
    4650        def __str__(self): 
     
    4953class Message(): 
    5054        file=None 
     55        simuid=None 
     56        jobid=None 
     57        timestamp=None 
     58        command=None 
    5159 
    5260        def __init__(self,JSON_KW): 
Note: See TracChangeset for help on using the changeset viewer.