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

Method _launch_nested_container_session

src/python/cli_new/lib/cli/mesos.py:536–576  ·  view source on GitHub ↗

Sends a request to the Mesos Agent to launch a new nested container and attach to its output stream. The output stream is then sent back in the response.

(self)

Source from the content-addressed store, hash-verified

534 self._process_output_stream(response)
535
536 def _launch_nested_container_session(self):
537 """
538 Sends a request to the Mesos Agent to launch a new
539 nested container and attach to its output stream.
540 The output stream is then sent back in the response.
541 """
542 message = {
543 'type': "LAUNCH_NESTED_CONTAINER_SESSION",
544 'launch_nested_container_session': {
545 'container_id': self.container_id,
546 'command': {
547 'value': self.cmd,
548 'arguments': [self.cmd] + self.args,
549 'shell': False}}}
550
551 if self.tty:
552 message[
553 'launch_nested_container_session'][
554 'container'] = {
555 'type': 'MESOS',
556 'tty_info': {}}
557
558 req_extra_args = {
559 'stream': True,
560 'additional_headers': {
561 'Content-Type': 'application/json',
562 'Accept': 'application/recordio',
563 'Message-Accept': 'application/json'}}
564
565 resource = mesos.http.Resource(self.agent_url)
566 try:
567 response = resource.request(
568 mesos.http.METHOD_POST,
569 data=json.dumps(message),
570 retry=False,
571 timeout=None,
572 **req_extra_args)
573 except MesosException as exception:
574 raise CLIException("{error}".format(error=exception))
575
576 self._process_output_stream(response)
577
578 def _process_output_stream(self, response):
579 """

Callers

nothing calls this directly

Calls 3

requestMethod · 0.95
CLIExceptionClass · 0.90

Tested by

no test coverage detected