I am developing a Mesos framework, it is working perfectly fine, my only issue is that I am unable to read task stdout or stderr from inside the the Scheduler class.
I am providing a code sample below, I would like to read the stdout and stderr of a finished task, preferably in the statusUpdate function but anywhere would be useful. How can I reach that info? I tried getting executorInfo or executorId from TaskInfo or TaskStatus objects without any luck.
If someone can provide a code sample it would be greatly appreciated. I know that I can read the stderr and stdout from the master UI at url:master:5050 and also from the file system on the slaves, but I REALLY need to read it inside the framework, in the Java class as it will influence future scheduling decisions made in the resourceOffers function. As a last resort I was thinking of making a web call to the master by constructing the required URL, but that would be way too inconvenient. The mesos API must be providing a way to do it from inside the Scheduler class.
public class TfScheduler implements Scheduler {
public TfScheduler(String volumes, String container) {
}
@Override
public void registered(SchedulerDriver driver,
Protos.FrameworkID frameworkId,
Protos.MasterInfo masterInfo) {
System.out.println("Registered! ID = " + frameworkId.getValue());
}
@Override
public void reregistered(SchedulerDriver driver, Protos.MasterInfo masterInfo) {
}
@Override
public void disconnected(SchedulerDriver driver) {
}
@Override
public void resourceOffers(SchedulerDriver driver, List<Protos.Offer> offers) {
}
@Override
public void offerRescinded(SchedulerDriver driver, Protos.OfferID offerId
) {
}
@Override
public void statusUpdate(SchedulerDriver driver, Protos.TaskStatus status
) {
System.out.println("Status update: task " + status.getTaskId().getValue()
+ " is in state " + status.getState().getValueDescriptor().getName());
if (status.getState() == Protos.TaskState.TASK_FINISHED) {
/* !!!!! */
//Can I read the task stdout here?
/* !!!!! */
}
}
@Override
public void frameworkMessage(SchedulerDriver driver,
Protos.ExecutorID executorId,
Protos.SlaveID slaveId,
byte[] data
) {
}
@Override
public void slaveLost(SchedulerDriver driver, Protos.SlaveID slaveId
) {
}
@Override
public void executorLost(SchedulerDriver driver,
Protos.ExecutorID executorId,
Protos.SlaveID slaveId,
int status
) {
}
public void error(SchedulerDriver driver, String message) {
System.out.println("Error: " + message);
}
}
Thanks!