Example #1
0
        self.log.append(("load", self.name))
        return self.value

    def _save(self, data: Any) -> None:
        self.value = data

    def _release(self) -> None:
        self.log.append(("release", self.name))
        self.value = None

    def _describe(self) -> Dict[str, Any]:
        return {}


if not sys.platform.startswith("win"):
    ParallelRunnerManager.register(  # pylint: disable=no-member
        "LoggingDataSet", LoggingDataSet)


@pytest.mark.skipif(sys.platform.startswith("win"),
                    reason="Due to bug in parallel runner")
@pytest.mark.parametrize("is_async", [False, True])
class TestParallelRunnerRelease:
    def test_dont_release_inputs_and_outputs(self, is_async):
        runner = ParallelRunner(is_async=is_async)
        log = runner._manager.list()

        pipeline = Pipeline(
            [node(identity, "in", "middle"),
             node(identity, "middle", "out")])
        # pylint: disable=no-member
        catalog = DataCatalog({
Example #2
0
    def _load(self) -> Any:
        self.log["log"] += [("load", self.name)]
        return self.value

    def _save(self, data: Any) -> None:
        self.value = data

    def _release(self) -> None:
        self.log["log"] += [("release", self.name)]
        self.value = None

    def _describe(self) -> Dict[str, Any]:
        return {}


ParallelRunnerManager.register("LoggingDataSet", LoggingDataSet)


class TestParallelRunnerRelease:
    def test_dont_release_inputs_and_outputs(self):
        manager = ParallelRunnerManager()
        manager.start()
        log = Manager().dict(log=[])

        pipeline = Pipeline(
            [node(identity, "in", "middle"),
             node(identity, "middle", "out")])
        catalog = DataCatalog({
            "in": manager.LoggingDataSet(log, "in", "stuff"),
            "middle": manager.LoggingDataSet(log, "middle"),
            "out": manager.LoggingDataSet(log, "out"),