MCPcopy Create free account
hub / github.com/apache/impala / Container

Class Container

docker/test-with-docker.py:408–436  ·  view source on GitHub ↗

Encapsulates a container, with some metadata.

Source from the content-addressed store, hash-verified

406
407
408class Container(object):
409 """Encapsulates a container, with some metadata."""
410
411 def __init__(self, id_, name, logfile, exitcode=None, running=None):
412 self.id = id_
413 self.name = name
414 self.logfile = logfile
415 self.exitcode = exitcode
416 self.running = running
417 self.start = None
418 self.end = None
419 self.removed = False
420
421 # Protects multiple calls to "docker rm <self.id>"
422 self.lock = threading.Lock()
423
424 # Updated by Timeline class
425 self.total_user_cpu = -1
426 self.total_system_cpu = -1
427 self.peak_total_rss = -1
428
429 def runtime_seconds(self):
430 if self.start and self.end:
431 return self.end - self.start
432
433 def __str__(self):
434 return "Container<" + \
435 ",".join(["%s=%s" % (k, v) for k, v in self.__dict__.items()]) \
436 + ">"
437
438
439class TestWithDocker(object):

Callers 1

_create_containerMethod · 0.85

Calls

no outgoing calls

Tested by 1

_create_containerMethod · 0.68