Ejemplo n.º 1
0
 def __init__(self, scheduler, offerOrder = None):
     TaskChunkScheduler.__init__(self, scheduler)
     if offerOrder is None:
         offerOrder = TaskStealingScheduler.TASK_STEALING_FIRST
     self.offerOrder = offerOrder
     self.stolenTaskIds = set()
     self.counter = itertools.count()
Ejemplo n.º 2
0
    def statusUpdate(self, driver, update):
        """
        Updates internal state before passing on to the underlying framework.
        """
        if update.task_id in driver.pendingTasks:
            if chunk_utils.isTerminalUpdate(update):
                del driver.pendingTasks[update.task_id]
            else:
                driver.pendingTasks.setActive(update.task_id)

        TaskChunkScheduler.statusUpdate(self, driver, update)
Ejemplo n.º 3
0
 def frameworkMessage(self, driver, executor_id, slave_id, data):
     """
     Receives a framework message. Squelches stolen task updates and
     updates the table on subtask updates.
     """
     message = SubTaskMessage.fromString(data)
     if message.isValid() and message.getType() == SubTaskMessage.SUBTASK_UPDATE:
         parentTaskId, update = message.getPayload()
         if (parentTaskId.value, update.task_id.value) in self.stolenTaskIds:
             # Potentially log this and remove from stolenTasks.
             if update.state == mesos_pb2.TASK_KILLED:
                 print "\tSquelched ack of killed/stolen sub task '{0}' from task chunk '{1}'".format(
                         update.task_id.value, parentTaskId.value)
             else:
                 print "\tSquelched update from stolen task '{0}' in task chunk '{1}'".format(
                         update.task_id.value, parentTaskId.value)
         else:
             TaskChunkScheduler.frameworkMessage(self, driver, executor_id,
                     slave_id, data)
     else:
         TaskChunkScheduler.frameworkMessage(self, driver, executor_id,
                 slave_id, data)