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

Method __init__

src/python/cli_new/lib/cli/tests/base.py:222–255  ·  view source on GitHub ↗
(self, flags=None)

Source from the content-addressed store, hash-verified

220 count = 0
221
222 def __init__(self, flags=None):
223 super(Agent, self).__init__()
224
225 if Agent.count > 0:
226 raise CLIException("Creating more than one agent"
227 " is currently not possible")
228
229 if flags is None:
230 flags = {}
231
232 if "ip" not in flags:
233 flags["ip"] = TEST_AGENT_IP
234 if "port" not in flags:
235 flags["port"] = TEST_AGENT_PORT
236 if "master" not in flags:
237 flags["master"] = "{ip}:{port}".format(
238 ip=TEST_MASTER_IP,
239 port=TEST_MASTER_PORT)
240 if "work_dir" not in flags:
241 flags["work_dir"] = tempfile.mkdtemp()
242 if "runtime_dir" not in flags:
243 flags["runtime_dir"] = tempfile.mkdtemp()
244 # Disabling systemd support on Linux to run without sudo.
245 if "linux" in sys.platform and "systemd_enable_support" not in flags:
246 flags["systemd_enable_support"] = "false"
247
248 self.flags = flags
249 self.name = "agent"
250 self.addr = "{ip}:{port}".format(ip=flags["ip"], port=flags["port"])
251 self.executable = os.path.join(
252 CLITestCase.MESOS_BUILD_DIR,
253 "bin",
254 "mesos-{name}.sh".format(name=self.name))
255 self.shell = True
256
257 def __del__(self):
258 super(Agent, self).__del__()

Callers

nothing calls this directly

Calls 4

CLIExceptionClass · 0.90
mkdtempMethod · 0.80
joinMethod · 0.65
__init__Method · 0.45

Tested by

no test coverage detected