def main(): with timers.timewith("main: parse_args"): args = parse_args() # print(args) service = Service(**args.config[args.document]) service.mainloop()
def __init__(self, *args, **kwargs): self.__dict__.update(kwargs) self.context = zmq.Context() self.socket = self.context.socket(zmq.REP) self.socket.bind(self.uri) self.serialized_data = {} try: with timers.timewith("Service:__init__:serialize"): for key in self.data: self.serialized_data[key] = self.serialize_func(self.data[key]) except AttributeError: self.data = {} print("Service:__init__: init with no data") try: info = self.get_info() with open(self.dump_path, 'w') as json_fp: json.dump(info, json_fp) print("Service:info: dump to {file}".format(file=self.dump_path)) except: pass
def __init__(self, *args, **kwargs): self.__dict__.update(kwargs) self.context = zmq.Context() self.socket = self.context.socket(zmq.REP) self.socket.bind(self.uri) self.serialized_data = {} try: with timers.timewith("Service:__init__:serialize"): for key in self.data: self.serialized_data[key] = self.serialize_func( self.data[key]) except AttributeError: self.data = {} print("Service:__init__: init with no data") try: info = self.get_info() with open(self.dump_path, 'w') as json_fp: json.dump(info, json_fp) print("Service:info: dump to {file}".format(file=self.dump_path)) except: pass