MCPcopy Create free account
hub / github.com/apache/mesos / applyOperation

Method applyOperation

src/slave/slave.cpp:4821–4908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4819
4820
4821void Slave::applyOperation(const ApplyOperationMessage& message)
4822{
4823 // The operation might be from an operator API call, thus the framework ID
4824 // here is optional.
4825 Option<FrameworkID> frameworkId = message.has_framework_id()
4826 ? message.framework_id()
4827 : Option<FrameworkID>::none();
4828
4829 Option<OperationID> operationId = message.operation_info().has_id()
4830 ? message.operation_info().id()
4831 : Option<OperationID>::none();
4832
4833 Result<ResourceProviderID> resourceProviderId =
4834 getResourceProviderId(message.operation_info());
4835
4836 const UUID& uuid = message.operation_uuid();
4837
4838 if (resourceProviderId.isError()) {
4839 LOG(ERROR) << "Failed to get the resource provider ID of operation "
4840 << "'" << message.operation_info().id() << "' "
4841 << "(uuid: " << uuid << ") from "
4842 << (frameworkId.isSome()
4843 ? "framework " + stringify(frameworkId.get())
4844 : "an operator API call")
4845 << ": " << resourceProviderId.error();
4846 return;
4847 }
4848
4849 Operation* operation = new Operation(protobuf::createOperation(
4850 message.operation_info(),
4851 protobuf::createOperationStatus(
4852 OPERATION_PENDING,
4853 operationId,
4854 None(),
4855 None(),
4856 None(),
4857 info.id(),
4858 resourceProviderId.isSome()
4859 ? resourceProviderId.get() : Option<ResourceProviderID>::none()),
4860 frameworkId,
4861 info.id(),
4862 uuid));
4863
4864 addOperation(operation);
4865
4866 // TODO(jieyu): We should drop the operation if the resource version
4867 // uuid in the operation does not match that of the agent. This is
4868 // currently not possible because if any speculative operation for
4869 // agent default resources fails, the agent will crash. We might
4870 // want to change that behavior in the future. Revisit this once we
4871 // change that behavior.
4872 checkpointResourceState(
4873 totalResources.filter(mesos::needCheckpointing), false);
4874
4875 if (protobuf::isSpeculativeOperation(message.operation_info())) {
4876 apply(operation);
4877 }
4878

Callers

nothing calls this directly

Calls 15

getResourceProviderIdFunction · 0.85
createOperationFunction · 0.85
createOperationStatusFunction · 0.85
NoneClass · 0.85
isSpeculativeOperationFunction · 0.85
randomFunction · 0.85
errorMethod · 0.65
stringifyFunction · 0.50
idMethod · 0.45
isErrorMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected