scalable-pypeline 2.1.31__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. pypeline/__init__.py +1 -0
  2. pypeline/barrier.py +63 -0
  3. pypeline/constants.py +94 -0
  4. pypeline/dramatiq.py +455 -0
  5. pypeline/executable_job_config_schema.py +35 -0
  6. pypeline/extensions.py +17 -0
  7. pypeline/flask/__init__.py +16 -0
  8. pypeline/flask/api/__init__.py +0 -0
  9. pypeline/flask/api/pipelines.py +275 -0
  10. pypeline/flask/api/schedules.py +40 -0
  11. pypeline/flask/decorators.py +41 -0
  12. pypeline/flask/flask_pypeline.py +156 -0
  13. pypeline/job_runner.py +205 -0
  14. pypeline/pipeline_config_schema.py +352 -0
  15. pypeline/pipeline_settings_schema.py +561 -0
  16. pypeline/pipelines/__init__.py +0 -0
  17. pypeline/pipelines/composition/__init__.py +0 -0
  18. pypeline/pipelines/composition/parallel_pipeline_composition.py +375 -0
  19. pypeline/pipelines/composition/pypeline_composition.py +215 -0
  20. pypeline/pipelines/factory.py +86 -0
  21. pypeline/pipelines/middleware/__init__.py +0 -0
  22. pypeline/pipelines/middleware/get_active_worker_id_middleware.py +22 -0
  23. pypeline/pipelines/middleware/graceful_shutdown_middleware.py +50 -0
  24. pypeline/pipelines/middleware/parallel_pipeline_middleware.py +60 -0
  25. pypeline/pipelines/middleware/pypeline_middleware.py +202 -0
  26. pypeline/pypeline_yaml.py +468 -0
  27. pypeline/schedule_config_schema.py +125 -0
  28. pypeline/utils/__init__.py +0 -0
  29. pypeline/utils/config_utils.py +81 -0
  30. pypeline/utils/dramatiq_utils.py +134 -0
  31. pypeline/utils/executable_job_util.py +35 -0
  32. pypeline/utils/graceful_shutdown_util.py +39 -0
  33. pypeline/utils/module_utils.py +108 -0
  34. pypeline/utils/pipeline_utils.py +144 -0
  35. pypeline/utils/schema_utils.py +24 -0
  36. scalable_pypeline-2.1.31.dist-info/LICENSE +177 -0
  37. scalable_pypeline-2.1.31.dist-info/METADATA +212 -0
  38. scalable_pypeline-2.1.31.dist-info/RECORD +42 -0
  39. scalable_pypeline-2.1.31.dist-info/WHEEL +6 -0
  40. scalable_pypeline-2.1.31.dist-info/entry_points.txt +6 -0
  41. scalable_pypeline-2.1.31.dist-info/top_level.txt +2 -0
  42. tests/fixtures/__init__.py +0 -0
@@ -0,0 +1,212 @@
1
+ Metadata-Version: 2.1
2
+ Name: scalable-pypeline
3
+ Version: 2.1.31
4
+ Summary: PypeLine - Python pipelines for the Real World
5
+ Home-page: https://gitlab.com/bravos2/pypeline
6
+ Author: Bravos Power Corporation
7
+ License: Apache License 2.0
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: PyYAML (<7,>=6.0.1)
11
+ Requires-Dist: marshmallow (<4,>=3.2.1)
12
+ Requires-Dist: redis (<5,>=4.5.4)
13
+ Requires-Dist: croniter (<2,>=1.0.15)
14
+ Requires-Dist: db-medley[redis] (<2,>=1.0.2)
15
+ Provides-Extra: build
16
+ Requires-Dist: wheel ; extra == 'build'
17
+ Requires-Dist: twine ; extra == 'build'
18
+ Provides-Extra: dev
19
+ Requires-Dist: black ; extra == 'dev'
20
+ Provides-Extra: flask
21
+ Requires-Dist: markupsafe (==2.0.1) ; extra == 'flask'
22
+ Requires-Dist: flask-smorest (<1,>=0.23.0) ; extra == 'flask'
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest-cov (<3,>=2.6.1) ; extra == 'test'
25
+ Requires-Dist: tox (<4,>=3.14.1) ; extra == 'test'
26
+ Requires-Dist: mock (<2,>=1) ; extra == 'test'
27
+ Requires-Dist: responses (<0.11,>=0.10.16) ; extra == 'test'
28
+ Requires-Dist: fakeredis (<2.31,>=2.10.3) ; extra == 'test'
29
+ Provides-Extra: web
30
+ Requires-Dist: gunicorn ; extra == 'web'
31
+ Requires-Dist: gevent (<22,>=21.12.0) ; extra == 'web'
32
+ Provides-Extra: workers
33
+ Requires-Dist: networkx (>=2.4) ; extra == 'workers'
34
+ Requires-Dist: dramatiq[rabbitmq] (==1.17.0) ; extra == 'workers'
35
+ Requires-Dist: apscheduler (<4,>=3.10.4) ; extra == 'workers'
36
+ Requires-Dist: tenacity (==8.0.1) ; extra == 'workers'
37
+
38
+ ```
39
+ ______ __ ________ _____ _ _____ _ _ _____
40
+ | ___ \\ \ / /| ___ \| ___|| | |_ _|| \ | || ___|
41
+ | |_/ / \ V / | |_/ /| |__ | | | | | \| || |__
42
+ | __/ \ / | __/ | __| | | | | | . ` || __|
43
+ | | | | | | | |___ | |_____| |_ | |\ || |___
44
+ \_| \_/ \_| \____/ \_____/\___/ \_| \_/\____/
45
+ ```
46
+
47
+ ## Overview
48
+
49
+ PypeLine is a versatile open-source library designed to streamline the management of data workflows and APIs. With PypeLine, you can efficiently schedule cron jobs, execute complex Directed Acyclical Graph (DAG) pipelines, and set up a Flask API complete with OpenAPI documentation.
50
+
51
+ #### Key Features
52
+ - Cron Job Scheduling: Easily schedule recurring tasks with flexible cron job functionality, ensuring that your processes run reliably at specified intervals.
53
+ - DAG Pipelines: Define and execute DAGs to manage complex data workflows with dependencies. PypeLine handles the execution order and parallelism, ensuring that each task runs in the correct sequence.
54
+ - Flask API with OpenAPI: Quickly configure a RESTful API using Flask, with built-in support for OpenAPI documentation, allowing for clear, standardized documentation of your endpoints.
55
+
56
+ ## Requirements
57
+
58
+ - RabbitMQ
59
+ - Redis
60
+ - Docker (optional for dev)
61
+
62
+ ## Getting Started
63
+
64
+ Install PypeLines:
65
+
66
+ ```commandline
67
+ pip install scalable-pypeline[flask,web,workers]>=1.2.3
68
+ ```
69
+
70
+ Configure your Flask project (app.py)
71
+
72
+ ```python
73
+ from flask import Flask
74
+ from pypeline.flask import FlaskPypeline
75
+ from pypeline_demo.api import bp
76
+ from pypeline_demo.config import Config
77
+ from pypeline_demo.extensions import dramatiq
78
+
79
+
80
+
81
+ def create_app():
82
+ app = Flask(__name__)
83
+
84
+ dramatiq.init_app(app)
85
+
86
+ # Initialize your app with a configuration
87
+ app.config.from_object(Config)
88
+
89
+ pypeline = FlaskPypeline()
90
+ pypeline.init_app(app, init_api=True)
91
+
92
+ # Register API blueprints you wish
93
+ app.extensions["pypeline_core_api"].register_blueprint(bp)
94
+ # Register application blueprints to application
95
+ app.register_blueprint(bp)
96
+
97
+ return app
98
+
99
+
100
+ if __name__ == "__main__":
101
+ app = create_app()
102
+ app.run(port=5001)
103
+ ```
104
+
105
+ Configure Dramatiq extension (extensions.py)
106
+
107
+ ```python
108
+ from pypeline.dramatiq import Dramatiq
109
+
110
+
111
+ dramatiq = Dramatiq()
112
+ ```
113
+
114
+ Setup your yaml configuration for pypelines (pypeline.yaml)
115
+
116
+ ```yaml
117
+ serviceConfig:
118
+ - name: pipeline-worker
119
+ registeredTasks:
120
+ - handler: pypeline_demo.pipeline.a
121
+ - handler: pypeline_demo.pipeline.b
122
+ - handler: pypeline_demo.pipeline.c
123
+ - handler: pypeline_demo.scheduled_tasks.cron_task
124
+
125
+ pipelines:
126
+ demo_pipeline:
127
+ name: Demo Pipeline
128
+ description: Pipeline to show examples of DAG Adjacency
129
+ schemaVersion: 1
130
+ config:
131
+ dagAdjacency:
132
+ a:
133
+ - b
134
+ - c
135
+ metadata:
136
+ maxRetry: 1
137
+ retryBackoff: 180
138
+ retryBackoffMax: 300
139
+ retryJitter: true
140
+ maxTtl: 10800
141
+ queue: new-queue
142
+ taskDefinitions:
143
+ a:
144
+ handler: pypeline_demo.pipeline.a
145
+ b:
146
+ handler: pypeline_demo.pipeline.b
147
+ c:
148
+ handler: pypeline_demo.pipeline.c
149
+ scheduledTasks:
150
+ cron-task:
151
+ name: Example cron task
152
+ enabled: true
153
+ config:
154
+ task: pypeline_demo.scheduled_tasks.cron_task
155
+ queue: new-queue
156
+ schedule:
157
+ minute: '*'
158
+ hour: '*'
159
+ dayOfWeek: '*'
160
+ dayOfMonth: '*'
161
+ monthOfYear: '*'
162
+ schemaVersion: 1
163
+ ```
164
+
165
+ Setup your modules to be executed by yaml (pipeline.py && scheduled_tasks.py)
166
+
167
+ ```python
168
+ import time
169
+
170
+
171
+ def a(event):
172
+ print("A")
173
+
174
+
175
+ def b(event):
176
+ print("B")
177
+ time.sleep(10)
178
+
179
+
180
+ def c(event):
181
+ print("C")
182
+ ```
183
+
184
+ ```python
185
+ def cron_task():
186
+ print("HI")
187
+ ```
188
+
189
+ Configure your environment variables (demo.env)
190
+
191
+ ```env
192
+ SERMOS_BASE_URL=local
193
+ PYPELINE_CLIENT_PKG_NAME=pypeline_demo
194
+ REDIS_URL=redis://:password@localhost:6379/0
195
+ RABBITMQ_URL=amqp://admin:password@localhost:5672
196
+ ```
197
+
198
+ Start Rabbit & Redis as your message broker and backend results storage. We use `docker compose` for this.
199
+
200
+ ## DEMO PROJECT COMING SOON!
201
+
202
+
203
+ ## Testing
204
+
205
+ If you are developing pypeline and want to test this package,
206
+ install the test dependencies:
207
+
208
+ $ pip install -e .[test]
209
+
210
+ Now, run the tests:
211
+
212
+ $ tox
@@ -0,0 +1,42 @@
1
+ pypeline/__init__.py,sha256=Ot_7SOv9f1OG3mDRlKxeTuWgH4qbOFyTXh8THXd9ZXs,23
2
+ pypeline/barrier.py,sha256=ojSgbuZnGKpKiSBYXTV4CxG9j1Z01YdzBSORli4MnzI,2376
3
+ pypeline/constants.py,sha256=SSRWNCpJ-VjwZrwCzfE1bLXyD6_h9_bHBr4olG9Oab0,3591
4
+ pypeline/dramatiq.py,sha256=NHwKrXG_BN7O9zjGt8y04DfynsHJmINzxPiJl4_0rZY,15862
5
+ pypeline/executable_job_config_schema.py,sha256=P2Z8SO057Jgyt4I5oZxcbEi1iaZkLoAh7qp8PtuqcqU,1010
6
+ pypeline/extensions.py,sha256=BzOTnXhNxap3N7uIUUh_hO6dDwx08Vc_RJDE93_K0Lo,610
7
+ pypeline/job_runner.py,sha256=08tZLMK8KNovgaW4Jic3K7zMX0EQ5lZO60H0rQimRxs,6747
8
+ pypeline/pipeline_config_schema.py,sha256=kRZcCMlk2FIITDzVrAfcSmHnxi1mIWmDzasTW0TnaAU,11169
9
+ pypeline/pipeline_settings_schema.py,sha256=s_oqZ-TBiLdInSprR9k6myw1zykV2PpEbEfVaMfb5VY,21010
10
+ pypeline/pypeline_yaml.py,sha256=hbOdwKDUg10wsZnwVaBt46FbpS3iuB3bLwVuYyXh4OY,17270
11
+ pypeline/schedule_config_schema.py,sha256=vtZV-5wpGcAiYcXxdBPRkrjsbR6x_9E-1PC2elrKKbE,3611
12
+ pypeline/flask/__init__.py,sha256=AdljRh0lMiS8ExgDmgzObwVs8jW7hqQuf83Ml8kn8GQ,491
13
+ pypeline/flask/decorators.py,sha256=ki6jkjZwbDbCWuj7ET7N-ncZwrASp4Fy7257WIYiAAQ,1102
14
+ pypeline/flask/flask_pypeline.py,sha256=Uqyu3PnSP3DoVZUJPqV9chjT4xdRgvcL3OMXxkbdTEg,5490
15
+ pypeline/flask/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ pypeline/flask/api/pipelines.py,sha256=lw1ggsjp_Iha5MhyQGHtVW0akpVJnxIk0hn6NkC3c8s,9314
17
+ pypeline/flask/api/schedules.py,sha256=8PKCMdPucaer8opchNlI5aDssK2UqT79hHpeg5BMtTA,1210
18
+ pypeline/pipelines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ pypeline/pipelines/factory.py,sha256=ftm6AwXIdkC8LEzy3c4CLPzXtoQonBKUo3yojbYTsUE,3309
20
+ pypeline/pipelines/composition/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ pypeline/pipelines/composition/parallel_pipeline_composition.py,sha256=JrEsIxaB36wLWg5ztCMkANye9VizGuRIhyxyCP4DCl8,14162
22
+ pypeline/pipelines/composition/pypeline_composition.py,sha256=lY1RO7luLqDBLfoX99YbBatx1Qov1cxGoS5lRAjB_DQ,8534
23
+ pypeline/pipelines/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ pypeline/pipelines/middleware/get_active_worker_id_middleware.py,sha256=X4ZfRk3L8MD00DTsGHth7oOdy-W7LQV96T8vu5UC42A,755
25
+ pypeline/pipelines/middleware/graceful_shutdown_middleware.py,sha256=k37zmFk9dOye05BoQP7KcB9MEQgvodI16kOJyYhRyAc,1764
26
+ pypeline/pipelines/middleware/parallel_pipeline_middleware.py,sha256=kTp6niYoe2nXIiN6EGRfdpxrJyioo0GPxDkfefbGlEk,2821
27
+ pypeline/pipelines/middleware/pypeline_middleware.py,sha256=FjREuPDdTfeYOVGVUjJgx8Szh6yu7g8OnHRc5N__448,9385
28
+ pypeline/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
+ pypeline/utils/config_utils.py,sha256=bblh8clRDDNQpQIDkBrtskZBo-csakoO1IJiaqVGyr8,2508
30
+ pypeline/utils/dramatiq_utils.py,sha256=tbG3o5FD0zUOKtJJJECE2cM2ovDv3OLQ5CplJ9cXfM4,4001
31
+ pypeline/utils/executable_job_util.py,sha256=Id4FYvCdzqOCzQYSoU2yeOncubKwSwITUf_BgIPZQUw,1206
32
+ pypeline/utils/graceful_shutdown_util.py,sha256=gdyf4r_vlunZZP-prcol_9aJQEG9Hk8evivVSe_H0N0,1293
33
+ pypeline/utils/module_utils.py,sha256=-yEJIukDCoXnmlZVXB6Dww25tH6GdPE5SoFqv6pfdVU,3682
34
+ pypeline/utils/pipeline_utils.py,sha256=kGP1QwCJikGC5QNRtzRXCDVewyRMpWIqERTNnxGLlSY,4795
35
+ pypeline/utils/schema_utils.py,sha256=Fgl0y9Cuo_TZeEx_S3gaSVnLjn6467LTkjb2ek7Ms98,851
36
+ tests/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ scalable_pypeline-2.1.31.dist-info/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
38
+ scalable_pypeline-2.1.31.dist-info/METADATA,sha256=nInraHJGNTj9lTVB1zOvh2mMmzYL7l7asOuBa-0e_vg,5985
39
+ scalable_pypeline-2.1.31.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
40
+ scalable_pypeline-2.1.31.dist-info/entry_points.txt,sha256=q5V8Qe0-5mrZ982FGbUaT2-bEURsiGjLNKEvpR6m7VU,176
41
+ scalable_pypeline-2.1.31.dist-info/top_level.txt,sha256=C7dpkEOc_-nnsAQb28BfQknjD6XHRyS9ZrvVeoIbV7s,15
42
+ scalable_pypeline-2.1.31.dist-info/RECORD,,
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.38.4)
3
+ Root-Is-Purelib: true
4
+ Tag: py2-none-any
5
+ Tag: py3-none-any
6
+
@@ -0,0 +1,6 @@
1
+ [console_scripts]
2
+ job-runner = pypeline.job_runner:main
3
+
4
+ [flask.commands]
5
+ cron-scheduler = pypeline.dramatiq:cron_scheduler
6
+ pypeline-worker = pypeline.dramatiq:pypeline_worker
@@ -0,0 +1,2 @@
1
+ pypeline
2
+ tests
File without changes