loki.batch.sgraph
Classes
  | 
The dependency graph underpinning the   | 
- class SGraph
 Bases:
objectThe dependency graph underpinning the
SchedulerIt is built upon a
networkx.DiGraphto expose the dependencies betweenItemnodes. It is typically created from one or multiple seed items viafrom_seed()by recursively chasing dependencies.Cyclic dependencies are broken for procedures that are marked as
RECURSIVE, which would otherwise constitute a dependency on itself. See_break_cycles().- classmethod from_seed(seed, item_factory, config=None)
 Create a new
SGraphusingseedas starting point.- Parameters:
 seed ((list of) str) – The names of the root nodes
item_factory (
ItemFactory) – The item factory to use when creating graph nodesconfig (
SchedulerConfig, optional) – The config object to use when creating items
- as_filegraph(item_factory, config=None, item_filter=None, exclude_ignored=False)
 Convert the
SGraphto a dependency graph that only containsFileItemnodes.- Parameters:
 item_factory (
ItemFactory) – The item factory to use when creating graph nodesconfig (
SchedulerConfig, optional) – The config object to use when creating itemsitem_filter (list of
Itemsubclasses, optional) – Only include files that include at least one dependency item of the given type. By default, all items are included.exclude_ignored (bool, optional) – Exclude
Item`s that have the ``is_ignored`property
- Returns:
 A new graph object
- Return type:
 
- property dependencies
 Return all dependencies, i.e., edges of the dependency graph
- successors(item, item_filter=None)
 Return the list of successor nodes in the dependency tree below
ItemThis returns all immediate successors (but can be filtered accordingly using the item’s
targetsproperty) of the item in the dependency graphThe list of successors is provided to transformations during processing with the
Scheduler.- Parameters:
 item (
Item) – The item node in the dependency graph for which to determine the successorsitem_filter (list of
Itemsubclasses, optional) – Filter successor items to only include items of the provided type. By default, all items are considered. Note that includingProcedureItemin theitem_filterautomatically addsProcedureBindingItemandInterfaceItemas well, since these are intermediate nodes. Their dependencies will also be included until they eventually resolve to aProcedureItem.
- property depths
 Return a mapping of
Itemnodes to their depth (topological generation) in the dependency graph
- add_node(item)
 Add
itemas a node to the dependency graph
- add_edge(edge)
 Add a dependency
edgeto the dependency graph
- add_edges(edges)
 Add the dependency
edgesto the dependency graph
- export_to_file(dotfile_path)
 Generate a dotfile from the current graph
- Parameters:
 dotfile_path (str or pathlib.Path) – Path to write the dotfile to. A corresponding graphical representation will be created with an additional
.pdfappendix.