def killTask(self, driver, tid): if (tid != self.tid): print "Expecting different task id ... killing anyway!" if self.nested_driver != -1: self.nested_driver.stop() self.nested_driver.join() driver.sendStatusUpdate(mesos.TaskStatus(tid, mesos.TASK_FINISHED, ""))
def launchTask(self, driver, task): print "Running task %d" % task.taskId time.sleep(1) print "Sending the update..." update = mesos.TaskStatus(task.taskId, mesos.TASK_FINISHED, "") driver.sendStatusUpdate(update) print "Sent the update"
def launchTask(self, driver, task): print "in launchTask" self.tid = task.taskId print "task id is " + str(task.taskId) + ", task.args is " + task.arg self.args = task.arg.split("\t") print "running: " + "java -cp " + self.args[0] + " " + self.args[1] + " " + self.args[2] print Popen("/usr/lib/jvm/java-6-sun/bin/java -cp " + self.args[0] + " " + self.args[1] + " " + self.args[2], shell=True, stdout=PIPE).stdout.readline() update = mesos.TaskStatus(task.taskId, mesos.TASK_FINISHED, "") driver.sendStatusUpdate(update)
def launchTask(self, driver, task): self.tid = task.taskId duration = pickle.loads(task.arg) print "(%s:%d) Sleeping for %s seconds." % (self.fid, self.tid, duration) # TODO(benh): Don't sleep, this blocks the event loop! time.sleep(duration) status = mesos.TaskStatus(self.tid, mesos.TASK_FINISHED, "") driver.sendStatusUpdate(status) time.sleep(1)
def killTask(self, driver, tid): if (self.tid != tid): print "Expecting different task id ... killing anyway!" status = mesos.TaskStatus(tid, mesos.TASK_FINISHED, "") driver.sendStatusUpdate(status)