Changeset 876 for trunk/Monitoring/smon
- Timestamp:
- 06/12/13 11:14:57 (11 years ago)
- Location:
- trunk/Monitoring/smon
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Monitoring/smon/local_repo.py
r875 r876 59 59 _conn.execute("create unique index if not exists idx_simulation_1 on simulation (name)") 60 60 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 column61 _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 62 62 63 63 def cleanup(): … … 84 84 rs=c.fetchone() 85 85 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 87 92 rs=c.fetchone() 88 93 … … 136 141 137 142 def 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)) 139 145 140 146 _conn.commit() … … 143 149 c=_conn.cursor() 144 150 145 _conn.execute("select id, content from message where simulation_id=? order by iddesc 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,)) 146 152 147 153 rs=c.fetchone() 148 154 149 155 if rs is None: 150 raise Exception()156 raise types.MessageNotFoundException() 151 157 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 300 300 running_simulation=[] 301 301 302 for s in retrieve_simulation ():302 for s in retrieve_simulations(): 303 303 if s.status=="running": 304 304 running_simulation.append(s) -
trunk/Monitoring/smon/types.py
r875 r876 28 28 return ",".join(['%s=%s'%(k,str(v)) for (k,v) in self.__dict__.iteritems()]) 29 29 30 class MessageNotFoundException(SMONException): 31 pass 32 30 33 class Tree(): 31 34 … … 43 46 self.status=kw.get("status") 44 47 self.name=kw.get("name") 48 self.id=kw.get("id") 45 49 46 50 def __str__(self): … … 49 53 class Message(): 50 54 file=None 55 simuid=None 56 jobid=None 57 timestamp=None 58 command=None 51 59 52 60 def __init__(self,JSON_KW):
Note: See TracChangeset
for help on using the changeset viewer.