autodepgraph

graph

class autodepgraph.graph.AutoDepGraph_DAG(name, cfg_plot_mode='svg', incoming_graph_data=None, **attr)[source]
node_states

Allowed states for the nodes

Type

List[str]

matplotlib_edge_properties

Properties passed to networkx plotting of edges

Type

Dict[str, Any]

matplotlib_label_properties

Properties passed to networkx plotting of labels

Type

Dict[str, Any]

add_edge(u_of_edge, v_of_edge, **attr)[source]

Adds an edge that denotes a dependency in the calibration graph. u_of_edge -> v_of_edge denotes that u depends on v.

add_node(node_for_adding, **attr)[source]

Adds a node to the graph, including starting attributes.

attr:

name (type) = default_value

calibrate_function = ‘NotImplementedCalibration’ check_functions = ‘return_fixed_value’ tolerance (float) = 0 timeout (float) = np.inf state (str) = ‘unknown’

calibrate_node(node: str, verbose: bool = False)[source]

Calibrate specified node

Parameters
  • node – Node to calibration

  • verbose – Verbosity level

Returns

Returns True if the calibration was succesfull, otherwise False

calibration_state()[source]

Return dictionary with current calibration state

property cfg_svg_filename

Default location for storing svg based visualizations of the DAG.

check_node(node, verbose=False)[source]

Perform check method on specified node

Parameters
  • node – Node to check

  • verbose – Verbosity level

Returns

Returns node state after the check

draw_svg(filename: Optional[str] = None)[source]
get_node_attribute(node, attribute)[source]

Return the attribute of the specified node

Parameters
  • node (str) – name of the node

  • attribute (str) – attribute to get

Returns

attribute of the object

Return type

value (ojbect)

maintain_node(node: str, verbose=True)str[source]
Maintaining a node attempts to go from any state to a good state.

any_state -> good

Maintain a node performs the following steps:
  1. get the state of the dependency nodes. If all are OK or unknown, perform a check on the node itself. If a node is any other state, execute it to move it to a good state

  2. perform the “check” experiment on the node itself. This quick check

  3. Perform calibration and second round of maintaining dependencies

Returns

State of the node after maintaining the node

Raises

Exception if the node could not be calibrated

open_html_viewer()[source]

Open html viewer for the file specified by the svg backend

set_node_attribute(node, attribute, value)[source]

Set the attribute of the specified node

Parameters
  • node (str) – name of the node

  • attribute (str) – attribute to set

  • value (ojbect) – value to set

set_node_description(node, description)[source]

Set the node description field

Parameters
  • node (str) – name of the node

  • description (str) – description to set

update_monitor_mpl()[source]

Updates a plot using the draw_graph_mpl based on matplotlib.

autodepgraph.graph.get_function_from_module(funcStr)[source]

visualization

autodepgraph.visualization.draw_graph_svg(nxG, filename: str)[source]

Creates an svg using graphviz.

If the file is saved to “autodepgraph/svg_viewer/adg_graph.svg” the realtime svg viewer can render it.

node_functions

autodepgraph.node_functions.calibration_functions.test_calibration_False()[source]

Dummy calibration function for test cases. Always returns False.

autodepgraph.node_functions.calibration_functions.test_calibration_True()[source]

Dummy calibration function for test cases. Always returns True.

autodepgraph.node_functions.calibration_functions.test_calibration_True_delayed(delay=0.5)[source]

Dummy calibration function for test cases. Always returns True.

autodepgraph.node_functions.check_functions.return_fixed_value()[source]

Always return 1.0, useful as a default