Skip to content

Commit

Permalink
Merge pull request #324 from PrefectHQ/add-worker-blocklist
Browse files Browse the repository at this point in the history
Create worker blocklist and add `BlockWorker`
  • Loading branch information
zzstoatzz authored Dec 8, 2023
2 parents 743a13d + 2a28777 commit 31c97b2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/generate_worker_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
]


Expand Down

0 comments on commit 31c97b2

Please sign in to comment.