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

Method waitContainer

src/slave/container_daemon.cpp:167–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167void ContainerDaemonProcess::waitContainer()
168{
169 const ContainerID& containerId = waitCall.wait_container().container_id();
170
171 LOG(INFO) << "Waiting for container '" << containerId << "'";
172
173 http::post(
174 agentUrl,
175 getAuthHeader(authToken),
176 serialize(contentType, evolve(waitCall)),
177 stringify(contentType))
178 .then(defer(self(), [=](const http::Response& response) -> Future<Nothing> {
179 if (response.status != http::OK().status &&
180 response.status != http::NotFound().status) {
181 return Failure(
182 "Failed to wait for container '" +
183 stringify(waitCall.wait_container().container_id()) +
184 "': Unexpected response '" + response.status + "' (" +
185 response.body + ")");
186 }
187
188 if (postStopHook.isSome()) {
189 LOG(INFO)
190 << "Invoking post-stop hook for container '" << containerId << "'";
191
192 return postStopHook.get()();
193 }
194
195 return Nothing();
196 }))
197 .onReady(defer(self(), &Self::launchContainer))
198 .onFailed(defer(self(), [=](const string& failure) {
199 LOG(ERROR)
200 << "Failed to wait for container '"
201 << waitCall.wait_container().container_id() << "': " << failure;
202
203 terminated.fail(failure);
204 }))
205 .onDiscarded(defer(self(), [=] {
206 LOG(ERROR)
207 << "Failed to wait for container '"
208 << waitCall.wait_container().container_id() << "': future discarded";
209
210 terminated.discard();
211 }));
212}
213
214
215Try<Owned<ContainerDaemon>> ContainerDaemon::create(

Callers

nothing calls this directly

Calls 15

getAuthHeaderFunction · 0.85
deferFunction · 0.85
OKClass · 0.85
NotFoundClass · 0.85
FailureClass · 0.85
NothingClass · 0.85
postFunction · 0.50
serializeFunction · 0.50
evolveFunction · 0.50
stringifyFunction · 0.50
thenMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected