forked from mage-ai/mage-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[xy] Add contributing guide for streaming pipeline. (mage-ai#2222)
- Loading branch information
1 parent
183dd59
commit fc63466
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: "Contributing" | ||
--- | ||
|
||
This doc talks about how to add a new source or destination to the streaming pipeline. | ||
|
||
## Prerequisites | ||
Follow this [doc](https://docs.mage.ai/community/contributing) to set up the development environment for Mage. | ||
|
||
## Add a new source | ||
|
||
Example PR for adding a source: https://github.com/mage-ai/mage-ai/pull/1953 | ||
|
||
* Add the new source type to [mage_ai/streaming/constants.py](https://github.com/mage-ai/mage-ai/blob/master/mage_ai/streaming/constants.py). | ||
* Add the source file to the folder https://github.com/mage-ai/mage-ai/tree/master/mage_ai/streaming/sources | ||
* Define the source class which inherits from the `BaseSource`. | ||
* Define the source config class. | ||
* Implement the methods: | ||
* `init_client`: Initialize the client used to connect to the source. | ||
* `batch_read`: Batch read messages from the source and use `handler` method to process the messages. | ||
* Add the new source to the [SourceFactory](https://github.com/mage-ai/mage-ai/blob/master/mage_ai/streaming/sources/source_factory.py). | ||
* Add a template file with example config to the folder: https://github.com/mage-ai/mage-ai/tree/master/mage_ai/data_preparation/templates/data_loaders/streaming | ||
* Add new source type to the frontend code. | ||
* https://github.com/mage-ai/mage-ai/blob/master/mage_ai/frontend/components/PipelineDetail/AddNewBlocks/utils.tsx#L31 | ||
* https://github.com/mage-ai/mage-ai/blob/master/mage_ai/frontend/interfaces/DataSourceType.ts#L3 | ||
* https://github.com/mage-ai/mage-ai/blob/master/mage_ai/frontend/interfaces/DataSourceType.ts#L22 | ||
* Add unit tests: https://github.com/mage-ai/mage-ai/tree/master/mage_ai/tests/streaming/sources | ||
* Add doc: https://github.com/mage-ai/mage-ai/tree/master/docs/guides/streaming/sources | ||
|
||
--- | ||
|
||
## Add a new destination (sink) | ||
|
||
Example PR for adding a sink: https://github.com/mage-ai/mage-ai/pull/2121 | ||
|
||
* Add the new sink type to [mage_ai/streaming/constants.py](https://github.com/mage-ai/mage-ai/blob/master/mage_ai/streaming/constants.py). | ||
* Add the sink file to the folder https://github.com/mage-ai/mage-ai/tree/master/mage_ai/streaming/sinks | ||
* Define the sink class which inherits from the `BaseSink`. | ||
* Define the sink config class. | ||
* Implement the methods: | ||
* `init_client`: Initialize the client used to connect to the destination. | ||
* `batch_write`: Batch write messages to destination. | ||
* Add the new sink to the [SinkFactory](https://github.com/mage-ai/mage-ai/blob/master/mage_ai/streaming/sinks/sink_factory.py). | ||
* Add a template file with example config to the folder: https://github.com/mage-ai/mage-ai/tree/master/mage_ai/data_preparation/templates/data_exporters/streaming | ||
* Add new source type to the frontend code. | ||
* https://github.com/mage-ai/mage-ai/blob/master/mage_ai/frontend/components/PipelineDetail/AddNewBlocks/utils.tsx#L37 | ||
* https://github.com/mage-ai/mage-ai/blob/master/mage_ai/frontend/interfaces/DataSourceType.ts#L3 | ||
* https://github.com/mage-ai/mage-ai/blob/master/mage_ai/frontend/interfaces/DataSourceType.ts#L22 | ||
* Add unit tests: https://github.com/mage-ai/mage-ai/tree/master/mage_ai/streaming/sinks | ||
* Add doc: https://github.com/mage-ai/mage-ai/tree/master/docs/guides/streaming/destinations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters