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

Function getContainerStatus

src/slave/containerizer/mesos/paths.cpp:125–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123
124
125Result<int> getContainerStatus(
126 const string& runtimeDir,
127 const ContainerID& containerId)
128{
129 const string path = path::join(
130 getRuntimePath(runtimeDir, containerId),
131 STATUS_FILE);
132
133 if (!os::exists(path)) {
134 return None();
135 }
136
137 Try<string> read = os::read(path);
138 if (read.isError()) {
139 return Error("Unable to read status for container '" +
140 containerId.value() + "' from checkpoint file '" +
141 path + "': " + read.error());
142 }
143
144 if (read.get() != "") {
145 Try<int> containerStatus = numify<int>(read.get());
146 if (containerStatus.isError()) {
147 return Error("Unable to read status for container '" +
148 containerId.value() + "' as integer from '" +
149 path + "': " + read.error());
150 }
151
152 return containerStatus.get();
153 }
154
155 return None();
156}
157
158
159#ifndef __WINDOWS__

Callers 1

reapMethod · 0.85

Calls 10

getRuntimePathFunction · 0.85
NoneClass · 0.85
errorMethod · 0.65
joinFunction · 0.50
existsFunction · 0.50
readFunction · 0.50
ErrorFunction · 0.50
isErrorMethod · 0.45
valueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected