2121from _pytask .mark import Mark
2222from _pytask .mark_utils import get_marks
2323from _pytask .mark_utils import has_mark
24- from _pytask .nodes_utils import FilePathNode
25- from _pytask .nodes_utils import Node
26- from _pytask .nodes_utils import Task
24+ from _pytask .nodes import FilePathNode
25+ from _pytask .nodes import Node
26+ from _pytask .nodes import Task
2727from _pytask .path import find_common_ancestor_of_nodes
2828from _pytask .report import DagReport
2929from _pytask .session import Session
@@ -105,9 +105,9 @@ def pytask_dag_select_execution_dag(session: Session, dag: nx.DiGraph) -> None:
105105
106106
107107@hookimpl
108- def pytask_dag_validate_dag (session : Session , dag : nx .DiGraph ) -> None :
108+ def pytask_dag_validate_dag (dag : nx .DiGraph ) -> None :
109109 """Validate the DAG."""
110- _check_if_root_nodes_are_available (session , dag )
110+ _check_if_root_nodes_are_available (dag )
111111 _check_if_tasks_have_the_same_products (dag )
112112
113113
@@ -128,11 +128,11 @@ def _have_task_or_neighbors_changed(
128128
129129@orm .db_session
130130@hookimpl (trylast = True )
131- def pytask_dag_has_node_changed (session : Session , node : Node , task_name : str ) -> bool :
131+ def pytask_dag_has_node_changed (node : Node , task_name : str ) -> bool :
132132 """Indicate whether a single dependency or product has changed."""
133133 if isinstance (node , (FilePathNode , Task )):
134134 # If node does not exist, we receive None.
135- file_state = session . hook . pytask_node_state ( node = node )
135+ file_state = node . state ( )
136136 if file_state is None :
137137 return True
138138
@@ -155,7 +155,7 @@ def pytask_dag_has_node_changed(session: Session, node: Node, task_name: str) ->
155155 # to avoid unnecessary and expensive reexecutions of tasks.
156156 file_hash = hashlib .sha256 (node .path .read_bytes ()).hexdigest ()
157157 return file_hash != db_state .file_hash
158- return None
158+ return node . state ()
159159
160160
161161def _check_if_dag_has_cycles (dag : nx .DiGraph ) -> None :
@@ -194,7 +194,7 @@ def _format_cycles(cycles: list[tuple[str, ...]]) -> str:
194194 _TEMPLATE_ERROR += "\n \n (Hint: Sometimes case sensitivity is at fault.)"
195195
196196
197- def _check_if_root_nodes_are_available (session : Session , dag : nx .DiGraph ) -> None :
197+ def _check_if_root_nodes_are_available (dag : nx .DiGraph ) -> None :
198198 missing_root_nodes = []
199199 is_task_skipped : dict [str , bool ] = {}
200200
@@ -206,9 +206,7 @@ def _check_if_root_nodes_are_available(session: Session, dag: nx.DiGraph) -> Non
206206 node , dag , is_task_skipped
207207 )
208208 if not are_all_tasks_skipped :
209- node_exists = session .hook .pytask_node_state (
210- node = dag .nodes [node ]["node" ]
211- )
209+ node_exists = dag .nodes [node ]["node" ].state ()
212210 if not node_exists :
213211 missing_root_nodes .append (node )
214212
0 commit comments