GridWorks DataClasses

class gridworks.data_classes.base_g_node.BaseGNode(g_node_id, *args, **kwargs)

DataClass corresponding to base.g.node.gt type.

The global authority for state of BaseGNodes is managed by the GNodeFactory, and shared with AtomicTNodes from its World Registry. Do not update or create these objects except when starting up and using local data from a file (provided by the World to its docker instance) or in a direct message (Rest POST or rabbit broadcast) from the World.

[more info](https://gridworks.readthedocs.io/en/latest/g-node.html#basegnodes)

children()

Returns the list of BaseGnodes identifying this node as parent

Return type:

List[BaseGNode]

is_copper()

Returns true if role is not other

Return type:

bool

parent()

Raises: DcError if “natural” parent (as suggested by alias) is not Active, and either

  • prev_alias is None, OR

  • the parent as suggested by prev_alias is not Active and/or

does not exist.

Returns:

BaseGNode. Parent BaseGNode
  • If the parent as suggested by the alias exists as an

Active BaseGNode, returns that (“natural” parent)
  • Else, if the parent as suggested by the prev_alais exists

as an active BaseGNode, returns that.

None.
  • If alias is one word long (i.e. root of world)

Return type:

BaseGNode | None

classmethod parent_from_alias(alias)
Returns:

  • BaseGNode. If the parent as suggested by the alias exists as an

Active BaseGNode, returns that. - None. If alias is one word long (i.e. root of world)

Parameters:

alias (str) –

Return type:

BaseGNode | None

class gridworks.data_classes.g_node.GNode(g_node_id, *args, **kwargs)
Parameters:

g_node_id (str) –

Return type:

GNode

children()

Returns the list of BaseGnodes identifying this node as parent.

Return type:

List[GNode]

parent()

Raises: DcError if “natural” parent (as suggested by alias) is not Active, and either

  • prev_alias is None, OR

  • the parent as suggested by prev_alias is not Active and/or

does not exist.

Returns:

BaseGNode. Parent BaseGNode
  • If the parent as suggested by the alias exists as an

Active GNode, returns that (“natural” parent)
  • Else, if the parent as suggested by the prev_alais exists

as an active GNode, returns that.

None.
  • If alias is one word long (i.e. root of world)

Return type:

GNode | None

classmethod parent_from_alias(alias)
Returns:

  • GNode. If the parent as suggested by the alias exists as an

Active BaseGNode, returns that. - None. If alias is one word long (i.e. root of world)

Parameters:

alias (str) –

Return type:

GNode | None

class gridworks.data_classes.g_node_instance.GNodeInstance(g_node_instance_id, *args, **kwargs)
Parameters:

g_node_instance_id (str) –

Return type:

GNodeInstance

children()

Returns the list of BaseGnodes identifying this node as parent

Return type:

List[GNodeInstance]

parent()

Raises: DcError if “natural” parent (as suggested by alias) is not Active, and either

  • prev_alias is None, OR

  • the parent as suggested by prev_alias is not Active and/or

does not exist.

Returns:

BaseGNode. Parent BaseGNode
  • If the parent as suggested by the alias exists as an

Active GNode, returns that (“natural” parent)
  • Else, if the parent as suggested by the prev_alais exists

as an active GNode, returns that.

None.
  • If alias is one word long (i.e. root of world)

Return type:

GNodeInstance | None

classmethod parent_from_alias(alias)
Returns:

  • GNode. If the parent as suggested by the alias exists as an

Active BaseGNode, returns that. - None. If alias is one word long (i.e. root of world)

Parameters:

alias (str) –

Return type:

GNodeInstance | None