diff --git a/quake/client/base/client.py b/quake/client/base/client.py index 70a626da96f4cb98cdc0062066c0e726c67617e8..be2d81c9ef0be94ea897f75c4889735cdc78810c 100644 --- a/quake/client/base/client.py +++ b/quake/client/base/client.py @@ -69,5 +69,7 @@ class Client: def gather(self, task, output_id=None): logger.debug("Gathering task id=%s", task.task_id) + if not task.keep: + raise Exception("'keep' flag is not set for a task") loop = asyncio.get_event_loop() return loop.run_until_complete(self.connection.call("gather", task.task_id, output_id)) diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index cc4cc587f101b8f1138896dbe8db4941a2163204..8ddcb32b3da8e7b7c0353c486cba07a91e8893f2 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py @@ -74,9 +74,14 @@ def test_wrapper_wait_and_gather(client): assert quake.gather(f, collapse_single_output=False) == [[12, 13, 14, 15]] assert quake.gather(f) == [12, 13, 14, 15] assert quake.gather(f, 0) == [12, 13, 14, 15] - quake.remove(f) + f = my_const4() + quake.wait(f) + with pytest.raises(Exception, match="flag is not set"): + quake.gather(f) == [12, 13, 14, 15] + + def test_wrapper_args(client): quake.set_global_client(client)