def run_node(node: Node, catalog: DataCatalog, is_async: bool = False, run_id: str = None) -> Node: """Run a single `Node` with inputs from and outputs to the `catalog`. Args: node: The ``Node`` to run. catalog: A ``DataCatalog`` containing the node's inputs and outputs. is_async: If True, the node inputs and outputs are loaded and saved asynchronously with threads. Defaults to False. run_id: The id of the pipeline run Returns: The node argument. """ if is_async: node = _run_node_async(node, catalog, run_id) else: node = _run_node_sequential(node, catalog, run_id) for name in node.confirms: catalog.confirm(name) return node
def test_confirm(self, mocker, caplog): """Confirm the dataset""" mock_ds = mocker.Mock() data_catalog = DataCatalog(data_sets={"mocked": mock_ds}) data_catalog.confirm("mocked") mock_ds.confirm.assert_called_once_with() assert caplog.record_tuples == [("kedro.io.data_catalog", logging.INFO, "Confirming DataSet 'mocked'")]
def run_node(node: Node, catalog: DataCatalog) -> Node: """Run a single `Node` with inputs from and outputs to the `catalog`. Args: node: The ``Node`` to run. catalog: A ``DataCatalog`` containing the node's inputs and outputs. Returns: The node argument. """ inputs = {name: catalog.load(name) for name in node.inputs} outputs = node.run(inputs) for name, data in outputs.items(): catalog.save(name, data) for name in node.confirms: catalog.confirm(name) return node