Skip to content

Commit

Permalink
Fix/kafka tasks docs (#5094)
Browse files Browse the repository at this point in the history
* Added Kafka tasks to docs

* Added changes file

* Fixed Kafka task __init__

* Added missing docstrings

Co-authored-by: Alessandro Lollo <[email protected]>
  • Loading branch information
AlessandroLollo and alollo-ca authored Nov 1, 2021
1 parent 97742df commit 57dbb11
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changes/pr5094.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
enhancement:
- "Added Kafka Tasks entry to website docs - (https://github.com/PrefectHQ/prefect/pull/5094)"

contributor:
- "[Alessandro Lollo](https://github.com/AlessandroLollo)"
8 changes: 8 additions & 0 deletions docs/outline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,14 @@ title = "Jupyter Tasks"
module = "prefect.tasks.jupyter"
classes = ["ExecuteNotebook"]

[pages.tasks.kafka]
title = "Kafka Tasks"
module = "prefect.tasks.kafka"
classes = [
"KafkaBatchConsume",
"KafkaBatchProduce"
]

[pages.tasks.monday]
title = "Monday Tasks"
module = "prefect.tasks.monday"
Expand Down
10 changes: 10 additions & 0 deletions src/prefect/tasks/kafka/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
This module contains a collection of tasks to produce and consume Kafka events
"""

try:
from prefect.tasks.kafka.kafka import KafkaBatchConsume, KafkaBatchProduce
except ImportError as err:
raise ImportError(
'Using `prefect.tasks.kafka` requires Prefect to be installed with the "kafka" extra.'
) from err
2 changes: 2 additions & 0 deletions src/prefect/tasks/kafka/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def run(
closing the consumer
- kafka_configs (dict, optional): a dict of kafka client configuration properties used
to construct the consumer.
- **kwargs (Any, optional): additional keyword arguments to pass to the standard Task
init method
Returns:
- List of consumed messages
"""
Expand Down

0 comments on commit 57dbb11

Please sign in to comment.