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

Method waited

src/launcher/default_executor.cpp:798–1039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

796 }
797
798 void waited(
799 const id::UUID& _connectionId,
800 const TaskID& taskId,
801 const Future<Response>& response)
802 {
803 // It is possible that this callback executed after the agent process
804 // failed in the interim. We can resume waiting on the child containers
805 // once we subscribe again with the agent.
806 if (connectionId != _connectionId) {
807 VLOG(1) << "Ignoring the waited callback from a stale connection";
808 return;
809 }
810
811 CHECK_EQ(SUBSCRIBED, state);
812 CHECK(containers.contains(taskId));
813
814 Container* container = containers.at(taskId).get();
815
816 CHECK_SOME(container->waiting);
817
818 auto retry_ = [this, container]() mutable {
819 container->waiting->disconnect();
820 container->waiting = None();
821 retry(connectionId.get(), container->taskInfo.task_id());
822 };
823
824 // It is possible that the response failed due to a network blip
825 // rather than the agent process failing. In that case, reestablish
826 // the connection.
827 if (!response.isReady()) {
828 LOG(ERROR)
829 << "Connection for waiting on child container "
830 << container->containerId << " of task '" << taskId << "' interrupted: "
831 << (response.isFailed() ? response.failure() : "discarded");
832 retry_();
833 return;
834 }
835
836 // It is possible that the agent was still recovering when we
837 // subscribed again after an agent process failure and started to
838 // wait for the child container. In that case, reestablish
839 // the connection.
840 if (response->code == process::http::Status::SERVICE_UNAVAILABLE) {
841 LOG(WARNING) << "Received '" << response->status << "' ("
842 << response->body << ") waiting on child container "
843 << container->containerId << " of task '" << taskId << "'";
844 retry_();
845 return;
846 }
847
848 // Shutdown the executor if the agent responded to the
849 // `WAIT_NESTED_CONTAINER` call with an error. Note that several race
850 // conditions can cause a 404 NOT FOUND response, which shouldn't be
851 // treated as an error.
852 if (response->code != process::http::Status::NOT_FOUND &&
853 response->code != process::http::Status::OK) {
854 LOG(ERROR) << "Received '" << response->status << "' ("
855 << response->body << ") waiting on child container "

Callers

nothing calls this directly

Calls 15

NoneClass · 0.85
WSUCCEEDEDFunction · 0.85
WSTRINGIFYFunction · 0.85
createTaskStatusFunction · 0.85
atMethod · 0.80
isReadyMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
stringifyFunction · 0.50
containsMethod · 0.45
getMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected