| 3881 | |
| 3882 | |
| 3883 | void Master::addTask( |
| 3884 | const TaskInfo& task, |
| 3885 | Framework* framework, |
| 3886 | Slave* slave) |
| 3887 | { |
| 3888 | CHECK_NOTNULL(framework); |
| 3889 | CHECK_NOTNULL(slave); |
| 3890 | CHECK(slave->connected) << "Adding task " << task.task_id() |
| 3891 | << " to disconnected agent " << *slave; |
| 3892 | |
| 3893 | // Note that we explicitly convert from protobuf to `Resources` here |
| 3894 | // and then use the result below to avoid performance penalty for multiple |
| 3895 | // conversions and validations implied by conversion. |
| 3896 | // Conversion is safe, as resources have already passed validation. |
| 3897 | const Resources resources = task.resources(); |
| 3898 | |
| 3899 | LOG(INFO) << "Adding task " << task.task_id() |
| 3900 | << " with resources " << resources |
| 3901 | << " of framework " << *framework |
| 3902 | << " on agent " << *slave; |
| 3903 | |
| 3904 | // Add the task to the framework and slave. |
| 3905 | Task* t = new Task(protobuf::createTask(task, TASK_STAGING, framework->id())); |
| 3906 | |
| 3907 | slave->addTask(t); |
| 3908 | framework->addTask(t); |
| 3909 | } |
| 3910 | |
| 3911 | |
| 3912 |
no test coverage detected