def run(self):
        model = self.model
        configfile = self.configfile
        interval = self.interval
        sockets = self.sockets
        model.initialize(configfile)
        if model.state == 'pause':
            logger.info(
                "model initialized and started in pause mode, waiting for requests"
            )
        else:
            logger.info("model started and initialized, running")
        if self.tracker:
            self.register()
            atexit.register(self.unregister)
        self.process_incoming()
        counter = itertools.count()
        logger.info("Entering timeloop...")
        for i in counter:
            while model.state == "pause":
                self.process_incoming()
            else:
                self.process_incoming()
            if model.state == "quit":
                break
            dt = model.get_time_step() or -1
            model.update(dt)
            if i % interval:
                continue
            for key in self.output_vars:
                value = model.get_var(key)
                metadata = {'name': key, 'iteration': i}
                logger.debug("sending {}".format(metadata))
                if 'pub' in sockets:
                    send_array(sockets['pub'], value, metadata=metadata)
        logger.info("Finalizing...")
        model.finalize()