Ignore:
Timestamp:
06/13/13 07:08:13 (11 years ago)
Author:
jripsl
Message:

Fix heartbeat test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Monitoring/Watch/watch

    r877 r879  
    2121import smtplib 
    2222from email.mime.text import MIMEText 
    23 from datetime import datetime 
     23import datetime 
    2424 
    2525# line below is to include "smon" package in the search path 
     
    5858        def store_msg(cls,message): 
    5959 
    60                 # the simu exists when we are here (see TAG0001 tag) 
    61                 s=repo_io.retrieve_simulation(message.simuid) 
    62  
    63                 repo_io.create_message(message,s) 
     60                try: 
     61 
     62                        # the simu exists when we are here (see TAG0001 tag) 
     63                        s=repo_io.retrieve_simulation(message.simuid) 
     64 
     65                        repo_io.create_message(message,s) 
     66 
     67                        sys.exit() 
     68 
     69                except: 
     70                        traceback.print_exc() 
     71                        raise 
    6472 
    6573        @classmethod 
     
    7078        def set_sim_status_to_error(cls,message): 
    7179 
    72                 s=repo_io.retrieve_simulation(message.simuid) 
    73  
    74                 s.status="error" 
    75  
    76                 repo_io.update_simulation_status(s) 
     80                try: 
     81 
     82                        s=repo_io.retrieve_simulation(message.simuid) 
     83 
     84                        s.status="error" 
     85 
     86                        repo_io.update_simulation_status(s) 
     87 
     88                except: 
     89                        traceback.print_exc() 
     90                        raise 
    7791 
    7892        @classmethod 
     
    103117                # used for debug 
    104118 
     119                """ 
    105120                if message.file is not None: 
    106121                        print "%s %s %s %s %s\n"%(message.code,message.jobid,message.command,message.timestamp,message.file) 
    107122                else: 
    108123                        print "%s %s %s %s\n"%(message.code,message.jobid,message.command,message.timestamp) 
     124                """ 
     125 
     126                print "%s %s %s %s\n"%(message.code,message.jobid,message.command,message.timestamp) 
    109127 
    110128        @classmethod 
    111129        def log(cls,message): 
    112130                with open("/home/jripsl/supervisor/log/supervisor.log", "a") as log_file: 
    113                         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)) 
     131                        log_file.write("%s %s %s %s %s\n"%(datetime.datetime.now().strftime('%Y%m%d_%H%M%S'), message.code,message.jobid,message.timestamp,message.command)) 
    114132 
    115133        @classmethod 
     
    239257                                message=smon.types.Message(JSON_msg)      # all JSON object members will be available in smon.types.Message object 
    240258 
     259                                # non working 
     260                                #print message.type 
     261 
     262                                # working 
     263                                #print message.code 
     264 
    241265 
    242266 
     
    249273 
    250274 
    251                         # manage config-card file which is attached to the "0000" type message (this file is base64 encoded and need to be unencoded) 
     275                        # manage config-card file which is attached to the "0000" code message (this file is base64 encoded and need to be unencoded) 
    252276                        # 
    253277                        if "file" in l__tmp_dic: 
Note: See TracChangeset for help on using the changeset viewer.