Get or instantiate a SparkContext and register it as a singleton object.

        :param conf: SparkConf (optional)
191072
def getOrCreate(cls, conf=None):
        
        with SparkContext._lock:
            if SparkContext._active_spark_context is None:
                SparkContext(conf=conf or SparkConf())
            return SparkContext._active_spark_context
133362
def cache(self):
        
        if self.mode == 'spark':
            self.values.cache()
            return self
        else:
            notsupported(self.mode)
1157893
def initialize(self, conf, ctx):
        
        config = get_config()['ResultTopicBolt']
        kafka_class = import_name(config['kafka_class'])
        self.client = kafka_class(**config['kafka_init'])
        self.topic = self.client.topics[config['topic']]
        self.producer = self.topic.get_producer()

        # Use own default index value while still allowing user config.
        self.tweet_shelf = shelf_from_config(config, index='pre_kafka_shelf')
329558
def singleton(cls):
    
    INSTANCES = {}

    def _singleton(*args, **kwargs):
        if cls not in INSTANCES:
            INSTANCES[cls] = cls(*args, **kwargs)
        return INSTANCES[cls]

    return _singleton
13443
public synchronized static CFMLEngine getInstance(final ServletConfig config) throws ServletException {

	if (singelton != null) {
	    if (factory == null) factory = singelton.getCFMLEngineFactory(); // not sure if this ever is done, but it does not hurt
	    return singelton;
	}

	if (factory == null) factory = new CFMLEngineFactory(config);

	// read init param from config
	factory.readInitParam(config);

	factory.initEngineIfNecessary();
	singelton.addServletConfig(config);

	// add listener for update
	// factory.addListener(singelton);
	return singelton;
    }
907829
@Override
    protected Client instantiateClient(String persistenceUnit)
    {
        
        return new SparkClient(kunderaMetadata, reader, externalProperties, persistenceUnit, sparkContext, sqlContext);
    }
1146369
public CassandraJavaRDD<R> withReadConf(ReadConf config) {
        CassandraRDD<R> newRDD = rdd().withReadConf(config);
        return wrap(newRDD);
    }
1212673
def getInstance(cls, *args):
        '''
        
        '''
        if not cls.__singleton:
            cls.__singleton = Config(*args)
        return cls.__singleton
103556
private static InstanceContext parseContext(JsonObject config) {
    JsonObject context = config.getObject("__context__");
    if (context == null) {
      throw new IllegalArgumentException("No component context found.");
    }
    config.removeField("__context__");
    return Contexts.deserialize(context);
  }
605526
def initialize(self, init_value, context=None, force=False):
        

        if not force and self._instance is not None:
            raise ConfigurationAlreadyInitializedError(
                'Configuration manager object is already initialized.'
            )

        self.__class__._instance = Root(init_value, context=context)
1123028
def instantiate(self, config, *args, **kwargs):
        
        for plugin_config in config:
            self.new_plugin(plugin_config, *args, **kwargs)
458601
def spark_config(self):
        
        configs = [
            'export LD_LIBRARY_PATH={0}/lib/native/:$LD_LIBRARY_PATH'.format(
                bigdata_conf.hadoop_home
            ),
            'export SPARK_LOCAL_IP={0}'.format(env.host_string)
        ]

        append(bigdata_conf.global_env_home, configs, use_sudo=True)
        run('source {0}'.format(bigdata_conf.global_env_home))
1004728
def default_instance():
        
        if ConfigManager._instance is None:
            with threading.Lock():
                if ConfigManager._instance is None:
                    ConfigManager._instance = ConfigManager()

        return ConfigManager._instance
526065
def conf(self):
        '''
        '''
        conf = namedtuple('conf', field_names=self._conf.keys())
        return conf(**self._conf)
1205041
def instantiate_client(self, config):
        
        modules = config.module.split('.')
        class_name = modules.pop()
        module_path = '.'.join(modules)

        client_instance = getattr(
            __import__(module_path, {}, {}, ['']),
            class_name
        )()

        client_instance.add_config(config)

        return client_instance
51613
def instantiate(self):
        
        if self.instance is None:
            self.instance = checked_call(self.cls, self.kwds)
        #endif
        try:
            self.instance.yaml_src = self.yaml_src
        except AttributeError:
            pass
        return self.instance
854419
function(conf) {
  Object.defineProperty(this, 'conf',
    {
      enumerable: false,
      configurable: false,
      writable: false,
      value: conf || {}
    }
  );
  if(this.conf.initialize) {
    this.load();
  }
}