| 951 | typename TOffer, |
| 952 | typename TScalar> |
| 953 | inline TTaskInfo createTask( |
| 954 | const TSlaveID& slaveId, |
| 955 | const TResources& resourceRequests, |
| 956 | const TCommandInfo& command, |
| 957 | const Option<TExecutorID>& executorId = None(), |
| 958 | const std::string& name = "test-task", |
| 959 | const std::string& id = id::UUID::random().toString(), |
| 960 | const google::protobuf::Map<std::string, TScalar>& resourceLimits = {}) |
| 961 | { |
| 962 | TTaskInfo task; |
| 963 | task.set_name(name); |
| 964 | task.mutable_task_id()->set_value(id); |
| 965 | setAgentID(&task, slaveId); |
| 966 | task.mutable_resources()->CopyFrom(resourceRequests); |
| 967 | if (!resourceLimits.empty()) { |
| 968 | *task.mutable_limits() = resourceLimits; |
| 969 | } |
| 970 | if (executorId.isSome()) { |
| 971 | TExecutorInfo executor; |
| 972 | executor.mutable_executor_id()->CopyFrom(executorId.get()); |
| 973 | executor.mutable_command()->CopyFrom(command); |
| 974 | task.mutable_executor()->CopyFrom(executor); |
| 975 | } else { |
| 976 | task.mutable_command()->CopyFrom(command); |
| 977 | } |
| 978 | |
| 979 | return task; |
| 980 | } |
| 981 | |
| 982 | |
| 983 | template < |
no test coverage detected