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

Method unschedule

src/slave/gc.cpp:127–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125
126
127Future<bool> GarbageCollectorProcess::unschedule(const string& path)
128{
129 LOG(INFO) << "Unscheduling '" << path << "' from gc";
130
131 if (!timeouts.contains(path)) {
132 return false;
133 }
134
135 Timeout timeout = timeouts[path]; // Make a copy, as we erase() below.
136 CHECK(paths.contains(timeout));
137
138 // Locate the path.
139 foreach (const Owned<PathInfo>& info, paths.get(timeout)) {
140 if (info->path == path) {
141 // If the path is currently undergoing removal, we cannot
142 // prevent path removal and wait for removal completion.
143 if (info->removing) {
144 // Return false to be consistent with the behavior when
145 // `unschedule` is called after the path is removed.
146 return info->promise.future()
147 .then([]() { return false; });
148 }
149
150 // Discard the promise.
151 info->promise.discard();
152
153 // Clean up the maps.
154 CHECK(paths.remove(timeout, info));
155 CHECK_EQ(timeouts.erase(info->path), 1u);
156
157 return true;
158 }
159 }
160
161 LOG(FATAL) << "Inconsistent state across 'paths' and 'timeouts'";
162 return false;
163}
164
165
166// Fires a message to self for the next event. This also cancels any

Callers 3

TEST_FFunction · 0.80
runMethod · 0.80
removeMethod · 0.80

Calls 2

dispatchFunction · 0.50
containsMethod · 0.45

Tested by 1

TEST_FFunction · 0.64