def run(self):
model = self.model<EOL>configfile = self.configfile<EOL>interval = self.interval<EOL>sockets = self.sockets<EOL>model.initialize(configfile)<EOL>if model.state == '<STR_LIT>':<EOL><INDENT>logger.info(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>else:<EOL><INDENT>logger.info("<STR_LIT>")<EOL><DEDENT>if self.tracker:<EOL><INDENT>self.register()<EOL>atexit.register(self.unregister)<EOL><DEDENT>self.process_incoming()<EOL>counter = itertools.count()<EOL>logger.info("<STR_LIT>")<EOL>for i in counter:<EOL><INDENT>while model.state == "<STR_LIT>":<EOL><INDENT>self.process_incoming()<EOL><DEDENT>else:<EOL><INDENT>self.process_incoming()<EOL><DEDENT>if model.state == "<STR_LIT>":<EOL><INDENT>break<EOL><DEDENT>dt = model.get_time_step() or -<NUM_LIT:1><EOL>model.update(dt)<EOL>if i % interval:<EOL><INDENT>continue<EOL><DEDENT>for key in self.output_vars:<EOL><INDENT>value = model.get_var(key)<EOL>metadata = {'<STR_LIT:name>': key, '<STR_LIT>': i}<EOL>logger.debug("<STR_LIT>".format(metadata))<EOL>if '<STR_LIT>' in sockets:<EOL><INDENT>send_array(sockets['<STR_LIT>'], value, metadata=metadata)<EOL><DEDENT><DEDENT><DEDENT>logger.info("<STR_LIT>")<EOL>model.finalize()<EOL>
run the model