run the model

def run(self):
        """run the model"""

        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()

        # Keep on counting indefinitely
        counter = itertools.count()
        logger.info("Entering timeloop...")
        for i in counter:
            while model.state == "pause":
                # keep waiting for messages when paused
                # process_incoming should set model.state to play
                self.process_incoming()
            else:
                # otherwise process messages once and continue
                self.process_incoming()
            if model.state == "quit":
                break

            # lookup dt or use -1 (default)
            dt = model.get_time_step() or -1
            model.update(dt)

            # check counter, if not a multiple of interval, skip this step
            if i % interval:
                continue

            for key in self.output_vars:
                value = model.get_var(key)
                metadata = {'name': key, 'iteration': i}
                # 4ms for 1M doubles
                logger.debug("sending {}".format(metadata))
                if 'pub' in sockets:
                    send_array(sockets['pub'], value, metadata=metadata)

        logger.info("Finalizing...")
        model.finalize()