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

Method launchContainer

src/slave/container_daemon.cpp:117–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116
117void ContainerDaemonProcess::launchContainer()
118{
119 const ContainerID& containerId = launchCall.launch_container().container_id();
120
121 LOG(INFO) << "Launching container '" << containerId << "'";
122
123 http::post(
124 agentUrl,
125 getAuthHeader(authToken),
126 serialize(contentType, evolve(launchCall)),
127 stringify(contentType))
128 .then(defer(self(), [=](
129 const http::Response& response) -> Future<Nothing> {
130 if (response.status != http::OK().status &&
131 response.status != http::Accepted().status) {
132 return Failure(
133 "Failed to launch container '" +
134 stringify(launchCall.launch_container().container_id()) +
135 "': Unexpected response '" + response.status + "' (" +
136 response.body + ")");
137 }
138
139 if (postStartHook.isSome()) {
140 LOG(INFO)
141 << "Invoking post-start hook for container '" << containerId << "'";
142
143 return postStartHook.get()();
144 }
145
146 return Nothing();
147 }))
148 .onReady(defer(self(), &Self::waitContainer))
149 .onFailed(defer(self(), [=](const string& failure) {
150 LOG(ERROR)
151 << "Failed to launch container '"
152 << launchCall.launch_container().container_id() << "': " << failure;
153
154 terminated.fail(failure);
155 }))
156 .onDiscarded(defer(self(), [=] {
157 LOG(ERROR)
158 << "Failed to launch container '"
159 << launchCall.launch_container().container_id()
160 << "': future discarded";
161
162 terminated.discard();
163 }));
164}
165
166
167void ContainerDaemonProcess::waitContainer()

Callers

nothing calls this directly

Calls 15

getAuthHeaderFunction · 0.85
deferFunction · 0.85
OKClass · 0.85
AcceptedClass · 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