Ejemplo n.º 1
0
 def __new__(cls, name, bases, attr_dict):
     cmapper = get_mapper(_namespace_mapper_domain)
     for k, v in attr_dict.items():
         if isinstance(v, (ComponentGroup, MultiComponent, MultiComponentGroup)):
             mapped_class = cmapper[v.__class__]
             attr_dict[k] = v.clone(clone_into_class=mapped_class)
     newbie = super(NamespaceModelMeta, cls).__new__(cls, name, bases, attr_dict)
     process_modifiers(newbie)
     return newbie
Ejemplo n.º 2
0
    def __new__(cls, name, bases, attr_dict):
        new_class = super(InfraModelMeta, cls).__new__(cls, name, bases, attr_dict)
        process_modifiers(new_class)
        new_class._class_refs_for_resources()
        #
        #@FIXME: The validation here has been suspended as there are some deeper
        #design problems that have to be sorted out to fix it
#         for resource in components.values():
#             resource._validate_args(new_class)
        return new_class
Ejemplo n.º 3
0
 def __new__(cls, name, bases, attr_dict):
     all_tasks = {v:k for k, v in attr_dict.items() if isinstance(v, _ConfigTask)}
     attr_dict["_node_dict_"] = all_tasks
     newbie = super(ConfigSpecMeta, cls).__new__(cls, name, bases, attr_dict)
     process_modifiers(newbie)
     graph = nx.DiGraph()
     graph.add_nodes_from(newbie._node_dict_.keys())
     if hasattr(newbie, _dependencies):
         graph.add_edges_from( [d.edge() for d in newbie.__dependencies__] )
         try:
             _ = nx.topological_sort(graph)
         except nx.NetworkXUnfeasible, _:
             raise ConfigException("Task dependency graph contains a cycle")
Ejemplo n.º 4
0
    def __new__(cls, name, bases, attr_dict):
        components = {}
        for n, v in attr_dict.items():
            if isinstance(v, InfraComponentBase):
                components[n] = v
        attr_dict[cls._COMPONENTS] = components
        new_class = super(InfraSpecMeta, cls).__new__(cls, name, bases, attr_dict)
        process_modifiers(new_class)
        new_class._class_refs_for_provisionables()
        #
        #@FIXME: The validation here has been suspended as there are some deeper
        #design problems that have to be sorted out to fix it
#         for component in components.values():
#             component._validate_args(new_class)
        return new_class
Ejemplo n.º 5
0
 def __new__(cls, name, bases, attr_dict):
     all_tasks = {v:k for k, v in attr_dict.items() if isinstance(v, _ConfigTask)}
     attr_dict[_node_dict] = all_tasks
     if _config_options not in attr_dict:
         attr_dict[_config_options] = {}
     newbie = super(ConfigModelMeta, cls).__new__(cls, name, bases, attr_dict)
     process_modifiers(newbie)
     for v, k in getattr(newbie, _node_dict).items():
         setattr(newbie, k, v)
     graph = nx.DiGraph()
     graph.add_nodes_from(newbie._node_dict.keys())
     if hasattr(newbie, _dependencies):
         deps = newbie.get_class_dependencies()
         graph.add_edges_from( [d.edge() for d in deps] )
         try:
             _ = nx.topological_sort(graph)
         except nx.NetworkXUnfeasible, _:
             raise ConfigException("Task dependency graph contains a cycle")