After starting the agent, we first need to make sure its reference count is increased and then check that it has successfully registered with the master before proceeding.
(self, timeout=TIMEOUT)
| 264 | |
| 265 | # pylint: disable=arguments-differ |
| 266 | def launch(self, timeout=TIMEOUT): |
| 267 | """ |
| 268 | After starting the agent, we first need to make sure its |
| 269 | reference count is increased and then check that it has |
| 270 | successfully registered with the master before proceeding. |
| 271 | """ |
| 272 | super(Agent, self).launch() |
| 273 | Agent.count += 1 |
| 274 | |
| 275 | try: |
| 276 | # pylint: disable=missing-docstring |
| 277 | def single_slave(data): |
| 278 | return len(data["slaves"]) == 1 |
| 279 | |
| 280 | http.get_json(self.flags["master"], "slaves", single_slave, timeout) |
| 281 | except Exception as exception: |
| 282 | stdout = "" |
| 283 | if self.proc.poll(): |
| 284 | stdout = "\n{output}".format(output=self.proc.stdout.read()) |
| 285 | |
| 286 | raise CLIException("Could not get '/slaves' endpoint as JSON with" |
| 287 | " only 1 agent in it: {error}{stdout}" |
| 288 | .format(error=exception, stdout=stdout)) |
| 289 | |
| 290 | # pylint: disable=arguments-differ |
| 291 | def kill(self, timeout=TIMEOUT): |