Exemple #1
0
    def store(cls, env, context_stack, chunk_size=1024):
        """Store the data within the given application context within the environment dict for later retrieval
        @param env the environment dict to be used for the soon-to-be-started process
        @param context_stack a ContextStack instance from which to store all data
        @param chunk_size the size of each chunk to be stored within the environment"""
        source = cls._encode(context_stack.settings().data())

        if source:
            sc = StringChunker()

            keys = sc.split(source, chunk_size, env)
            env[cls.storage_environment_variable] = cls.key_sep.join(keys)
        # end handle source too big to be stored

        # store process data as well
        cls._store_yaml_data(cls.process_information_environment_variable, env,
                             context_stack.settings().value_by_schema(process_schema))

        # Store ConfigHierarchy hashmap for restoring it later
        # merge and store
        hash_map = OrderedDict()
        for einstance in context_stack.stack():
            if isinstance(einstance, StackAwareHierarchicalContext):
                hash_map.update(einstance.hash_map())
            # end update hash_map
        # end for each env on stack

        # Always store it, even if empty
        env[cls.config_file_hash_map_environment_variable] = cls._encode(hash_map)
Exemple #2
0
 def construct_yaml_map(self, node):
     data = OrderedDict()
     yield data
     value = self.construct_mapping(node)
     data.update(value)