def test_context_tags_are_passed_to_map(self, monkeypatch): client = MagicMock() monkeypatch.setattr(prefect.engine.executors.dask, "Client", client) executor = DaskExecutor() with executor.start(): with prefect.context(task_tags=["dask-resource:GPU=1"]): executor.map(lambda: None, [1, 2]) kwargs = client.return_value.__enter__.return_value.map.call_args[1] assert kwargs["resources"] == {"GPU": 1.0}
def test_task_names_are_passed_to_map(self, monkeypatch): client = MagicMock() monkeypatch.setattr(prefect.engine.executors.dask, "Client", client) executor = DaskExecutor() with executor.start(): with prefect.context(task_full_name="FISH![0]"): executor.map(lambda: None, [1, 2]) kwargs = client.return_value.__enter__.return_value.map.call_args[1] assert kwargs["key"].startswith("FISH![0]")