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

Function getContainerPid

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

Source from the content-addressed store, hash-verified

91
92
93Result<pid_t> getContainerPid(
94 const string& runtimeDir,
95 const ContainerID& containerId)
96{
97 const string path = path::join(
98 getRuntimePath(runtimeDir, containerId),
99 PID_FILE);
100
101 if (!os::exists(path)) {
102 // This is possible because we don't atomically create the
103 // directory and write the 'pid' file and thus we might
104 // terminate/restart after we've created the directory but
105 // before we've written the file.
106 return None();
107 }
108
109 Result<string> read = state::read<string>(path);
110 if (read.isError()) {
111 return Error("Failed to recover pid of container: " + read.error());
112 }
113
114 Try<pid_t> pid = numify<pid_t>(read.get());
115 if (pid.isError()) {
116 return Error(
117 "Failed to numify pid '" + read.get() +
118 "' of container at '" + path + "': " + pid.error());
119 }
120
121 return pid.get();
122}
123
124
125Result<int> getContainerStatus(

Callers 2

TEST_PFunction · 0.85
foreachFunction · 0.85

Calls 8

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

Tested by 1

TEST_PFunction · 0.68