def _make_container_name(app, module, version, instance): base_name_tmpl = '{app}.{module}.{version}.{instance}.logs' base_name = _escape( base_name_tmpl.format(app=app, module=module, version=version, instance=instance)) return containers.CleanableContainerName(_APP_ENGINE_PREFIX, base_name)
def _ContainerName(image_name, instance_id, timestamp=None): """Generates a container name. Args: image_name: the base image name. instance_id: the instance # of the module. timestamp: the timestamp as a string you want to generate the name from. If None, it will be the now in the UTC timezone in ISO 8601. Returns: the generated container name. """ return containers.CleanableContainerName(_APP_ENGINE_PREFIX, base_name='%s.%s' % (image_name, instance_id), timestamp=timestamp)
def __init__(self, docker_client, log_server_port): super(_LogManager, self).__init__(docker_client, log_server_port) self._docker_client = docker_client volumes = [_describe_volume(_DB_PATH)] self._server = containers.Container( self._docker_client, containers.ContainerOptions( image_opts=containers.ImageOptions(tag=_LOG_SERVER_IMAGE), port=log_server_port, volumes=dict(volumes), name=containers.CleanableContainerName(_APP_ENGINE_PREFIX, 'log-server'))) self._lock = threading.RLock() self._containers = {}