From 2a2877785d71f4c3438be517a520f61ed636922a Mon Sep 17 00:00:00 2001 From: Alexander Streed Date: Wed, 6 Dec 2023 20:18:50 -0600 Subject: [PATCH] Create worker blocklist and add BlockWorker --- src/generate_worker_metadata.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/generate_worker_metadata.py b/src/generate_worker_metadata.py index 4ab88d43..edb24aba 100644 --- a/src/generate_worker_metadata.py +++ b/src/generate_worker_metadata.py @@ -18,6 +18,11 @@ from metadata_schemas import worker_schema import utils +# `block` work pool types should only be created via +# `Infrastructure.publish_as_work_pool` +# See https://github.com/PrefectHQ/prefect/pull/11180 for more details +WORKERS_BLOCKLIST = {"BaseWorker", "BlockWorker"} + @task def generate_worker_metadata(worker_subcls: Type[BaseWorker], package_name: str): @@ -114,7 +119,7 @@ def discover_base_worker_subclasses(module: ModuleType) -> List[Type[BaseWorker] for _, cls in inspect.getmembers(module) if inspect.isclass(cls) and issubclass(cls, BaseWorker) - and cls.__name__ != "BaseWorker" + and cls.__name__ not in WORKERS_BLOCKLIST ]