Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

EntityNavigatorResource

Navigator over resources. Edges: resource -> views built from it, resource -> next resources via consuming tasks, resource -> consuming scenarios.

Functions
__init__

Initialize self. See help(type(self)) for accurate signature.

entities : Union
delete_propagated_tags

Inverse of propagate_tags for resource edges: remove RESOURCE_PROPAGATED copies from views and TASK_PROPAGATED copies from next resources, then recurse downstream.

tags : list
entity_tags_cache : dict[gws_core.entity_navigator.entity_navigator_type.NavigableEntity, gws_core.tag.entity_tag_list.EntityTagList] | None
visited : set[gws_core.entity_navigator.entity_navigator_type.NavigableEntity] | None
get_as_nav_set

Wrap the current entities as a depth-0 NavigableEntitySet.

Return type : NavigableEntitySet
get_entities_as_set

Return the wrapped entities as a set.

Return type : set
get_entities_list

Return the wrapped entities as a list. Order is not guaranteed (the underlying storage is a set).

Return type : list
get_first_entity

Return an arbitrary entity from the set, or None if empty.

Useful when the caller knows the navigator wraps a single entity.

Return type : Optional
get_next_entities

Return the direct downstream neighbors of the wrapped entities.

Only one hop is followed (no recursion). Entities of any type listed in requested_entities are merged into a single NavigableEntitySet.

requested_entities : list
Return type : NavigableEntitySet
get_next_entities_recursive

Return every entity transitively reachable downstream.

Traverses the lineage graph breadth-first. Each entity is visited once, annotated with its depth in the returned NavigableEntitySet. Use this for impact analysis ("what entities would be affected"). Edge-level provenance is not preserved -- if you need to know which immediate upstream caused a given downstream to be reached, use propagate_tags instead.

requested_entities : list[gws_core.entity_navigator.entity_navigator_type.NavigableEntityType] | None
entity types to consider during traversal. Defaults to all four navigable types.
include_current_entities : bool - False
Return type : NavigableEntitySet
get_next_notes

Return notes attached to the views of the wrapped resources.

Return type : EntityNavigatorNote
get_next_resources

Return resources produced by tasks that consume the wrapped resources as input.

Return type : EntityNavigatorResource
get_next_scenarios

Return all the scenarios that use the resource in a source task or as input of a task

A scenario is considered a "next" scenario if it consumes (uses as input) any resource from this set. Scenarios that only produced resources in this set are excluded, unless they also consume resources produced by a different scenario in the set (which happens when resources from multiple scenarios are batched together).

Return type : EntityNavigatorScenario
get_next_scenarios_select_model

Return all the scenarios that use the resource in a source task or as input of a task

Return type : ModelSelect
get_next_views

Return views configured against the wrapped resources.

Return type : EntityNavigatorView
get_previous_entities_recursive

Return every entity transitively reachable upstream.

Mirror of get_next_entities_recursive but walks the lineage graph in the opposite direction (towards ancestors).

requested_entities : list[gws_core.entity_navigator.entity_navigator_type.NavigableEntityType] | None
entity types to consider during traversal. Defaults to all four navigable types.
include_current_entities : bool - False
Return type : NavigableEntitySet
get_previous_notes

Return the direct upstream notes. Empty by default; overridden by subclasses.

Return type : EntityNavigatorNote
get_previous_resources

Return resources consumed as input by the tasks that produced the wrapped resources.

Return type : EntityNavigatorResource
get_previous_scenarios

Return the scenarios that generated the wrapped resources.

Return type : EntityNavigatorScenario
get_previous_views

Return the direct upstream views. Empty by default; overridden by subclasses.

Return type : EntityNavigatorView
has_entities

Return True if at least one entity is wrapped.

Return type : bool
has_next_entities

Return True if any direct downstream neighbor exists.

requested_entities : list[gws_core.entity_navigator.entity_navigator_type.NavigableEntityType] | None
Return type : bool
is_empty

Return True if no entities are wrapped.

Return type : bool
propagate_tags

Propagate tags along two edge kinds and recurse:

  • resource -> view, with origin RESOURCE_PROPAGATED carrying the upstream resource's id;
  • resource -> next resource, with origin TASK_PROPAGATED carrying the producing task's id.

See EntityNavigator.propagate_tags for the cache/visited contract.

tags : list
entity_tags_cache : dict[gws_core.entity_navigator.entity_navigator_type.NavigableEntity, gws_core.tag.entity_tag_list.EntityTagList] | None
visited : set[gws_core.entity_navigator.entity_navigator_type.NavigableEntity] | None
from_entity_id @classmethod

Build the appropriate concrete navigator for a single entity, by type and id.

Raises if the entity does not exist or if entity_type is unknown.

entity_type : NavigableEntityType
entity_id : str
Return type : EntityNavigator
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.