Build a new Container or return a existing from cache
186347
private function initializeServiceContainer()
    {
        $this->containerManager = new ServiceContainerManager($this->dispatcher, $this->getLogger());
        $class = $this->getContainerClass();
        $container = $this->containerManager->initializeServiceContainer($class);
        $this->dispatcher->notify(new sfEvent($container, 'service_container.loaded'));

    }
796065
async function build() {
  await run(clean);
  await run(copy);
  await run(bundle);

  if (process.argv.includes('--static')) {
    await run(render);
  }

  if (process.argv.includes('--docker')) {
    cp.spawnSync('docker', ['build', '-t', pkg.name, '.'], {
      stdio: 'inherit',
    });
  }
}
878981
def load(self, key=None):
        # type: (Hashable) -> Promise
        
        if key is None:
            raise TypeError(
                (
                    "The loader.load() function must be called with a value,"
                    + "but got: {}."
                ).format(key)
            )

        cache_key = self.get_cache_key(key)

        # If caching and there is a cache-hit, return cached Promise.
        if self.cache:
            cached_promise = self._promise_cache.get(cache_key)
            if cached_promise:
                return cached_promise

        # Otherwise, produce a new Promise for this value.

        promise = Promise(partial(self.do_resolve_reject, key))  # type: ignore

        # If caching, cache this promise.
        if self.cache:
            self._promise_cache[cache_key] = promise

        return promise
269558
def build(self, db=None, safe_mode=False, for_each_inst=None, extra=None):
        """"""
        result = copy(self.initial)
        result.update(self.static)
        if self.dynamic:
            result.update(self.build_dynamic(db, extra=extra, safe_mode=safe_mode))
        if self.for_each and for_each_inst:
            result.update(self.build_for_each(db, safe_mode=safe_mode, extra=extra))
        if isinstance(extra, dict):
            result.update(extra)
        return result
239868
def build_partition_fs(self):
        """"""

        base_path = os.path.dirname(self.identity.cache_key)

        if not self.build_fs.exists(base_path):
            self.build_fs.makedir(base_path, recursive=True, allow_recreate=True)

        return self.build_fs.opendir(base_path)
277746
def get_init_container(self,
                           init_command,
                           init_args,
                           env_vars,
                           context_mounts,
                           persistence_outputs,
                           persistence_data):
        """"""
        env_vars = to_list(env_vars, check_none=True)
        outputs_path = stores.get_job_outputs_path(
            persistence=persistence_outputs,
            job_name=self.job_name)
        _, outputs_volume_mount = get_pod_outputs_volume(persistence_outputs=persistence_outputs)
        volume_mounts = outputs_volume_mount + to_list(context_mounts, check_none=True)
        init_command = init_command or ["/bin/sh", "-c"]
        init_args = init_args or to_list(
            get_output_args(command=InitCommands.CREATE,
                            outputs_path=outputs_path))
        init_args += to_list(get_auth_context_args(entity='job',
                                                   entity_name=self.job_name))
        return client.V1Container(
            name=self.init_container_name,
            image=self.init_docker_image,
            image_pull_policy=self.init_docker_image_pull_policy,
            command=init_command,
            args=[''.join(init_args)],
            env=env_vars,
            volume_mounts=volume_mounts)
950866
function createCacheEntry(reactorState, getter) {
  // evaluate dependencies
  const args = getDeps(getter).map(dep => evaluate(reactorState, dep).result)
  const value = getComputeFn(getter).apply(null, args)

  const storeDeps = getStoreDeps(getter)
  const storeStates = toImmutable({}).withMutations(map => {
    storeDeps.forEach(storeId => {
      const stateId = reactorState.getIn(['storeStates', storeId])
      map.set(storeId, stateId)
    })
  })

  return CacheEntry({
    value: value,
    storeStates: storeStates,
    dispatchId: reactorState.get('dispatchId'),
  })
}
418276
function Container(parent) {
      this.parent = parent;
      this.children = [];

      this.resolver = parent && parent.resolver || function() {};

      this.registry       = dictionary(parent ? parent.registry : null);
      this.cache          = dictionary(parent ? parent.cache : null);
      this.factoryCache   = dictionary(parent ? parent.factoryCache : null);
      this.resolveCache   = dictionary(parent ? parent.resolveCache : null);
      this.typeInjections = dictionary(parent ? parent.typeInjections : null);
      this.injections     = dictionary(null);
      this.normalizeCache = dictionary(null);

      this.factoryTypeInjections = dictionary(parent ? parent.factoryTypeInjections : null);
      this.factoryInjections     = dictionary(null);

      this._options     = dictionary(parent ? parent._options : null);
      this._typeOptions = dictionary(parent ? parent._typeOptions : null);
    }
838689
protected function init()
    {
        if ($this->container) {
            return;
        }

        $this->container = new Container();
        $this->connectionPool = new Pool();
        $this->cacheComponent = new CacheComponent();

        $this->container->instance(Pool::class, $this->connectionPool);
        $this->container->instance(CacheComponentInterface::class, $this->cacheComponent);
        Ioc::setContainer($this->container);

        static::$singleton = $this;
    }
938111
def _get_container(self, path):
        """"""
        path = path.strip(SEP)
        if SEP in path:
            raise errors.InvalidNameException(
                "Path contains %s - %s" % (SEP, path))
        return self.cont_cls.from_path(self, path)
543131
def cache(self, obj):
        '''
        
        '''
        # Check cache path exists for current obj
        write_path = os.path.join( self.cache_path, obj.org_id )
        if not os.path.exists( write_path ): 
            mkdir_p( write_path )

        with open(os.path.join( write_path, obj.id ), 'wb') as f:
            pickle.dump( obj, f )
        
        # Add to localstore (keep track of numbers of objects, etc.)
        self.add_to_localstore(obj)   
        self.add_to_names(obj)
146115
def _load_service_containers(self, service, configs, use_cache):
        
        if not isinstance(service, Service):
            raise TypeError("service must of an instance of Service")

        if not service.containers:
            container_name = self._container_registration(service.alias)

            if service.dependencies:
                self._load_dependency_containers(service)

            if not service.cargo:
                self._load_service_cargo(service, configs, use_cache)

            self._update_container_host_config(service)
            service.containers[container_name] = Container(
                self._client_session,
                container_name,
                service.cargo.id,
                container_config=service.container_config.to_dict(),
                host_config=service.host_config.to_dict()
            )
965055
def ensure_container(self, name=None):
        """"""
        if get_lxc_version() < pkg_resources.parse_version('2.0.0'):
            # Nothing to do for old versions of LXC
            return

        if name is None:
            name = self.container_name

        args = [
            'lxc-create',
            '--name', name,
            '--template', 'none',
            '>', '/dev/null', '2>&1',
        ]
        os.system(' '.join(args))
1366947
function(cid) {

    // Find a container.
    return findContainerThrows(cid)
    // Inspect container.
    .then(function(container) {
      // Make sure to retry call to inspect.
      return Promise.fromNode(function(cb) {
        container.inspect(cb);
      });
    })
    // Wrap errors.
    .catch(function(err) {
      throw new VError(err, 'Error inspecting container: %s.', cid);
    });
  }
50396
def _refresh_mine_cache(wrapped):
    '''
    
    '''
    @functools.wraps(wrapped)
    def wrapper(*args, **kwargs):
        '''
        refresh salt mine on exit.
        '''
        returned = wrapped(*args, **__utils__['args.clean_kwargs'](**kwargs))
        if _check_update_mine():
            __salt__['mine.send'](
                'docker.ps', verbose=True, all=True, host=True)
        return returned
    return wrapper
565339
protected function buildContainer() {
		$cache = $this->getCache();
		if($cache) {
			if(($container = $cache->fetch('asgard.container')) instanceof \Asgard\Container\Container) {
				$container['kernel'] = $this;
				$container['errorHandler'] = $this->errorHandler;

				$this->container = $container;
				#make $this->container the default instance of Container, in case someones uses it
				\Asgard\Container\Container::setInstance($this->container);
				return $this->container;
			}
		}

		$bundles = $this->getAllBundles();
		#use the Container default instance, in case someones uses it
		$container = $this->container = \Asgard\Container\Container::singleton();
		$container['errorHandler'] = $this->errorHandler;
		$container['kernel'] = $this;
		$container['config'] = $this->getConfig();

		foreach($bundles as $bundle)
			$bundle->buildContainer($container);

		if($cache)
			$cache->save('asgard.container', $container);

		return $container;
	}
1374253
function() {
            var container;
            //first, try get it by `containerDataName`
            if(this.containerDataName) {
                if(container = this.$element.data(this.containerDataName)) {
                    return container;
                }
            }
            //second, try `containerName`
            container = this.$element.data(this.containerName);
            return container;
        }