scalable-pypeline 2.0.7__tar.gz → 2.0.9__tar.gz

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 (35) hide show
  1. {scalable-pypeline-2.0.7/scalable_pypeline.egg-info → scalable-pypeline-2.0.9}/PKG-INFO +1 -1
  2. scalable-pypeline-2.0.9/pypeline/__init__.py +1 -0
  3. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/dramatiq.py +11 -4
  4. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/flask/api/pipelines.py +27 -6
  5. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/requirements.txt +1 -2
  6. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9/scalable_pypeline.egg-info}/PKG-INFO +1 -1
  7. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/scalable_pypeline.egg-info/requires.txt +4 -10
  8. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/setup.py +4 -8
  9. scalable-pypeline-2.0.7/pypeline/__init__.py +0 -1
  10. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/LICENSE +0 -0
  11. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/MANIFEST.in +0 -0
  12. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/README.md +0 -0
  13. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/barrier.py +0 -0
  14. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/composition.py +0 -0
  15. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/constants.py +0 -0
  16. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/extensions.py +0 -0
  17. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/flask/__init__.py +0 -0
  18. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/flask/api/__init__.py +0 -0
  19. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/flask/api/schedules.py +0 -0
  20. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/flask/decorators.py +0 -0
  21. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/flask/flask_pypeline.py +0 -0
  22. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/middleware.py +0 -0
  23. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/pipeline_config_schema.py +0 -0
  24. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/pypeline_yaml.py +0 -0
  25. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/schedule_config_schema.py +0 -0
  26. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/utils/__init__.py +0 -0
  27. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/utils/config_utils.py +0 -0
  28. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/utils/module_utils.py +0 -0
  29. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/pypeline/utils/pipeline_utils.py +0 -0
  30. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/scalable_pypeline.egg-info/SOURCES.txt +0 -0
  31. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/scalable_pypeline.egg-info/dependency_links.txt +0 -0
  32. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/scalable_pypeline.egg-info/entry_points.txt +0 -0
  33. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/scalable_pypeline.egg-info/top_level.txt +0 -0
  34. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/setup.cfg +0 -0
  35. {scalable-pypeline-2.0.7 → scalable-pypeline-2.0.9}/tests/fixtures/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scalable-pypeline
3
- Version: 2.0.7
3
+ Version: 2.0.9
4
4
  Summary: PypeLine - Python pipelines for the Real World
5
5
  Home-page: https://gitlab.com/bravos2/pypeline
6
6
  Author: Bravos Power Corporation
@@ -0,0 +1 @@
1
+ __version__ = "2.0.9"
@@ -179,8 +179,7 @@ def register_actors_for_workers(broker: Broker):
179
179
  pipeline_meta["store_results"] = True
180
180
  _ = register_lazy_actor(broker, tmp_handler, pipeline_meta)
181
181
  except Exception as e:
182
- print(e)
183
- print(f"Unable to add a task to dramatiq: {e}")
182
+ logger.exception(f"Unable to add a task to dramatiq: {e}")
184
183
 
185
184
 
186
185
  class Dramatiq:
@@ -260,7 +259,7 @@ class Dramatiq:
260
259
 
261
260
  # Callable function is expected to setBroker()
262
261
  if callable(broker_or_callable):
263
- print(f"Configuring broker via {DEFAULT_BROKER_CALLABLE}")
262
+ logger.info(f"Configuring broker via {DEFAULT_BROKER_CALLABLE}")
264
263
  broker_or_callable()
265
264
  else:
266
265
  raise TypeError("DEFAULT_BROKER_CALLABLE must point to a callable function")
@@ -368,7 +367,15 @@ def list_managed_actors(broker, queues):
368
367
  def cron_scheduler(): # pragma: no cover
369
368
  # Configure our broker that we will schedule registered tasks for
370
369
  scheduler = BlockingScheduler()
371
- configure_default_broker()
370
+ module_name, broker_or_callable = import_object(DEFAULT_BROKER_CALLABLE)
371
+
372
+ # Callable function is expected to setBroker()
373
+ if callable(broker_or_callable):
374
+ logger.info(f"Configuring broker via {DEFAULT_BROKER_CALLABLE}")
375
+ broker_or_callable()
376
+ else:
377
+ raise TypeError("DEFAULT_BROKER_CALLABLE must point to a callable function")
378
+
372
379
  broker = get_broker()
373
380
  jobs = retrieve_latest_schedule_config()
374
381
 
@@ -1,25 +1,46 @@
1
1
  """ Pipeline APIs
2
2
  """
3
+
4
+ import importlib.metadata
3
5
  import logging
4
6
 
5
7
  from flask import jsonify
6
- from flask_smorest import Blueprint
7
8
  from flask.views import MethodView
9
+ from flask_smorest import Blueprint
8
10
  from marshmallow import Schema, fields
9
11
  from marshmallow.exceptions import ValidationError
10
12
  from webargs.flaskparser import abort
11
-
13
+ from packaging import version
12
14
  from pypeline.composition import PipelineResult
13
15
  from pypeline.constants import API_DOC_RESPONSES, API_DOC_PARAMS, API_PATH_V1
14
- from pypeline.utils.pipeline_utils import dag_generator
15
16
  from pypeline.flask.decorators import require_accesskey
16
- from pypeline.utils.config_utils import retrieve_latest_pipeline_config
17
17
  from pypeline.pipeline_config_schema import BasePipelineSchema, PipelineSchemaV1
18
+ from pypeline.utils.config_utils import retrieve_latest_pipeline_config
19
+ from pypeline.utils.pipeline_utils import dag_generator
18
20
 
19
21
  logger = logging.getLogger(__name__)
20
22
  bp = Blueprint("pipelines", __name__, url_prefix=API_PATH_V1 + "/pipelines")
21
23
 
22
24
 
25
+ try:
26
+ flask_smorest_version = importlib.metadata.version("flask-smorest")
27
+ flask_smorest_version_parsed = version.parse(flask_smorest_version)
28
+ except importlib.metadata.PackageNotFoundError:
29
+ flask_smorest_version_parsed = None
30
+
31
+
32
+ def get_response_decorator(bp, status_code, *args, **kwargs):
33
+ if flask_smorest_version is None:
34
+ # Handle the case where flask-smorest is not installed
35
+ raise ImportError("flask-smorest is not installed.")
36
+ elif flask_smorest_version_parsed < version.parse("0.29"):
37
+ # Adjust arguments for older versions if needed
38
+ return bp.response(*args, **kwargs)
39
+ else:
40
+ # Adjust arguments for newer versions if needed
41
+ return bp.response(status_code, *args, **kwargs)
42
+
43
+
23
44
  class InvokePipelineSchema(Schema):
24
45
  """Incoming schema for invoking a pipeline"""
25
46
 
@@ -135,7 +156,7 @@ class PipelineInvoke(MethodView):
135
156
  tags=["Pipelines"],
136
157
  )
137
158
  @bp.arguments(InvokePipelineSchema)
138
- @bp.response(InvokePipelineResponseSchema)
159
+ @get_response_decorator(bp, "200", InvokePipelineResponseSchema)
139
160
  def post(self, payload: dict, pipeline_id: str):
140
161
  """Invoke a pipeline by it's ID; optionally provide pipeline arguments."""
141
162
  pipeline_config = retrieve_latest_pipeline_config(pipeline_id=pipeline_id)
@@ -191,7 +212,7 @@ class PipelineResults(MethodView):
191
212
  ],
192
213
  tags=["Pipelines"],
193
214
  )
194
- @bp.response(GetPipelineResultResponseSchema)
215
+ @get_response_decorator(bp, "200", GetPipelineResultResponseSchema)
195
216
  def get(self, execution_id: str):
196
217
  """Retrieve results of a pipeline's execution based on execution_id
197
218
 
@@ -1,6 +1,5 @@
1
1
  PyYAML>=6.0.1,<7
2
- click==8.0.4
3
2
  marshmallow>=3.2.1,<4
4
3
  redis>=4.5.4,<5
5
- db-medley[redis]>=1.0.2,<2
6
4
  croniter>=1.0.15,<2
5
+ db-medley[redis]>=1.0.2,<2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scalable-pypeline
3
- Version: 2.0.7
3
+ Version: 2.0.9
4
4
  Summary: PypeLine - Python pipelines for the Real World
5
5
  Home-page: https://gitlab.com/bravos2/pypeline
6
6
  Author: Bravos Power Corporation
@@ -1,32 +1,26 @@
1
1
  PyYAML<7,>=6.0.1
2
- click==8.0.4
3
2
  marshmallow<4,>=3.2.1
4
3
  redis<5,>=4.5.4
5
- db-medley[redis]<2,>=1.0.2
6
4
  croniter<2,>=1.0.15
5
+ db-medley[redis]<2,>=1.0.2
7
6
 
8
7
  [build]
9
8
  wheel
10
9
  twine
11
10
 
12
11
  [dev]
13
- blackd
12
+ black
14
13
 
15
14
  [flask]
16
- Werkzeug==2.0.3
17
- itsdangerous==2.0.1
18
- Flask<2,>=1.1.2
19
- flask-smorest<0.29,>=0.23.0
20
- Jinja2==3.0.3
15
+ markupsafe==2.0.1
16
+ flask-smorest<1,>=0.23.0
21
17
 
22
18
  [test]
23
19
  pytest-cov<3,>=2.6.1
24
20
  tox<4,>=3.14.1
25
21
  mock<2,>=1
26
- moto<4,>=1.3.16
27
22
  responses<0.11,>=0.10.16
28
23
  fakeredis<3,>=2.10.3
29
- importlib-metadata<5,>=4.12
30
24
 
31
25
  [web]
32
26
  gunicorn
@@ -1,5 +1,6 @@
1
1
  """ PypeLine Library Setup
2
2
  """
3
+
3
4
  import re
4
5
  import ast
5
6
  import sys
@@ -174,11 +175,8 @@ setup(
174
175
  extras_require={
175
176
  "build": ["wheel", "twine"],
176
177
  "flask": [
177
- "Werkzeug==2.0.3",
178
- "itsdangerous==2.0.1",
179
- "Flask>=1.1.2,<2",
180
- "flask-smorest>=0.23.0,<0.29",
181
- "Jinja2==3.0.3",
178
+ "markupsafe==2.0.1",
179
+ "flask-smorest>=0.23.0,<1",
182
180
  ],
183
181
  "web": ["gunicorn", "gevent>=21.12.0,<22"],
184
182
  "workers": [
@@ -186,15 +184,13 @@ setup(
186
184
  "dramatiq[rabbitmq]>=1.17.0,<2",
187
185
  "apscheduler>=3.10.4,<4",
188
186
  ],
189
- "dev": ["blackd"],
187
+ "dev": ["black"],
190
188
  "test": [
191
189
  "pytest-cov>=2.6.1,<3",
192
190
  "tox>=3.14.1,<4",
193
191
  "mock>=1,<2",
194
- "moto>=1.3.16,<4",
195
192
  "responses>=0.10.16,<0.11",
196
193
  "fakeredis>=2.10.3,<3",
197
- "importlib-metadata>=4.12,<5",
198
194
  ],
199
195
  },
200
196
  entry_points={
@@ -1 +0,0 @@
1
- __version__ = "2.0.7"