def resourceOffers (self, driver, offers):

        logging.debug("Mesos Scheduler: received %d resource offers", len(offers))

        for offer in offers:
            tasks = []
            logging.debug("Mesos Scheduler: received resource offer %s", offer.id.value)

            ## NB: currently we force 'offer.hostname' to be unique per Executor...
            ## could be changed, but we'd need to juggle the service port numbers

            if self.tasksLaunched < self._n_workers and offer.hostname not in self._executors:
                tid = self.tasksLaunched
                self.tasksLaunched += 1
                logging.debug("Mesos Scheduler: accepting offer on slave %s to start task %d", offer.hostname, tid)

                task = mesos_pb2.TaskInfo()
                task.task_id.value = str(tid)
                task.slave_id.value = offer.slave_id.value
                task.name = "task %d" % tid
                task.executor.MergeFrom(self.executor)

                cpus = task.resources.add()
                cpus.name = "cpus"
                cpus.type = mesos_pb2.Value.SCALAR
                cpus.scalar.value = self._cpu_alloc

                mem = task.resources.add()
                mem.name = "mem"
                mem.type = mesos_pb2.Value.SCALAR
                mem.scalar.value = self._mem_alloc

                tasks.append(task)
                self.taskData[task.task_id.value] = (offer.slave_id, task.executor.executor_id)

                # record and report the Mesos slave node's telemetry and state
                self._executors[offer.hostname] = WorkerInfo(offer, task)

                for exe in self._executors.values():
                    logging.debug(exe.report())

            # request the driver to launch the task
            driver.launchTasks(offer.id, tasks)
Invoked when resources have been offered to this framework. A
dataset/ETHPy150Open ceteri/exelixi/src/resource.py/MesosScheduler.resourceOffers