watcher.decision_engine.model.model_root
Module¶Openstack implementation of the cluster graph.
watcher.decision_engine.model.model_root.
BaremetalModelRoot
(stale=False)[source]¶Bases: networkx.classes.digraph.DiGraph
, watcher.decision_engine.model.base.Model
Cluster graph for an Openstack cluster: Baremetal Cluster.
add_node
(**kwargs)[source]¶Add a single node node_for_adding and update node attributes.
Parameters: |
|
---|
See also
add_nodes_from()
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_node(1)
>>> G.add_node('Hello')
>>> K3 = nx.Graph([(0, 1), (1, 2), (2, 0)])
>>> G.add_node(K3)
>>> G.number_of_nodes()
3
Use keywords set/change node attributes:
>>> G.add_node(1, size=10)
>>> G.add_node(3, weight=0.4, UTM=('13S', 382871, 3972649))
Notes
A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.
On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn’t change on mutables.
remove_node
(**kwargs)[source]¶Remove node n.
Removes the node n and all adjacent edges. Attempting to remove a non-existent node will raise an exception.
Parameters: | n (node) – A node in the graph |
---|---|
Raises: | NetworkXError – If n is not in the graph. |
See also
remove_nodes_from()
Examples
>>> G = nx.path_graph(3) # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> list(G.edges)
[(0, 1), (1, 2)]
>>> G.remove_node(1)
>>> list(G.edges)
[]
watcher.decision_engine.model.model_root.
ModelRoot
(stale=False)[source]¶Bases: networkx.classes.digraph.DiGraph
, watcher.decision_engine.model.base.Model
Cluster graph for an Openstack cluster.
add_node
(**kwargs)[source]¶Add a single node node_for_adding and update node attributes.
Parameters: |
|
---|
See also
add_nodes_from()
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_node(1)
>>> G.add_node('Hello')
>>> K3 = nx.Graph([(0, 1), (1, 2), (2, 0)])
>>> G.add_node(K3)
>>> G.number_of_nodes()
3
Use keywords set/change node attributes:
>>> G.add_node(1, size=10)
>>> G.add_node(3, weight=0.4, UTM=('13S', 382871, 3972649))
Notes
A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.
On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn’t change on mutables.
map_instance
(**kwargs)[source]¶Map a newly created instance to a node
Parameters: |
|
---|
migrate_instance
(**kwargs)[source]¶Migrate single instance from source_node to destination_node
Parameters: |
|
---|---|
Returns: |
remove_node
(**kwargs)[source]¶Remove node n.
Removes the node n and all adjacent edges. Attempting to remove a non-existent node will raise an exception.
Parameters: | n (node) – A node in the graph |
---|---|
Raises: | NetworkXError – If n is not in the graph. |
See also
remove_nodes_from()
Examples
>>> G = nx.path_graph(3) # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> list(G.edges)
[(0, 1), (1, 2)]
>>> G.remove_node(1)
>>> list(G.edges)
[]
watcher.decision_engine.model.model_root.
StorageModelRoot
(stale=False)[source]¶Bases: networkx.classes.digraph.DiGraph
, watcher.decision_engine.model.base.Model
Cluster graph for an Openstack cluster.
add_node
(**kwargs)[source]¶Add a single node node_for_adding and update node attributes.
Parameters: |
|
---|
See also
add_nodes_from()
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_node(1)
>>> G.add_node('Hello')
>>> K3 = nx.Graph([(0, 1), (1, 2), (2, 0)])
>>> G.add_node(K3)
>>> G.number_of_nodes()
3
Use keywords set/change node attributes:
>>> G.add_node(1, size=10)
>>> G.add_node(3, weight=0.4, UTM=('13S', 382871, 3972649))
Notes
A hashable object is one that can be used as a key in a Python dictionary. This includes strings, numbers, tuples of strings and numbers, etc.
On many platforms hashable items also include mutables such as NetworkX Graphs, though one should be careful that the hash doesn’t change on mutables.
get_node_by_name
(**kwargs)[source]¶Get a node by node name
Parameters: | node – StorageNode object or node name |
---|
map_pool
(**kwargs)[source]¶Map a newly created pool to a node
Parameters: |
|
---|
remove_node
(**kwargs)[source]¶Remove node n.
Removes the node n and all adjacent edges. Attempting to remove a non-existent node will raise an exception.
Parameters: | n (node) – A node in the graph |
---|---|
Raises: | NetworkXError – If n is not in the graph. |
See also
remove_nodes_from()
Examples
>>> G = nx.path_graph(3) # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> list(G.edges)
[(0, 1), (1, 2)]
>>> G.remove_node(1)
>>> list(G.edges)
[]
unmap_pool
(**kwargs)[source]¶Unmap a pool from a node
Parameters: |
|
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.