scalable-pypeline 2.0.3__py2.py3-none-any.whl → 3.0.0__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.
pypeline/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.0.3"
1
+ __version__ = "3.0.0"
pypeline/composition.py CHANGED
@@ -51,9 +51,8 @@ class parallel_pipeline:
51
51
 
52
52
  self.execution_graph = execution_graph
53
53
 
54
- for message_group in self.messages:
55
- for m in message_group:
56
- m.options["execution_graph"] = execution_graph
54
+ for m in self.messages[0]:
55
+ m.options["execution_graph"] = execution_graph
57
56
 
58
57
  def __len__(self):
59
58
  """Returns the length of the parallel_pipeline."""
pypeline/dramatiq.py CHANGED
@@ -19,7 +19,7 @@ from dramatiq.cli import (
19
19
  make_argument_parser as dramatiq_argument_parser,
20
20
  import_object,
21
21
  )
22
- from dramatiq.middleware import default_middleware
22
+ from dramatiq.middleware import default_middleware, CurrentMessage
23
23
  from dramatiq.results import Results
24
24
  from dramatiq.results.backends.redis import RedisBackend
25
25
  from flask import current_app, Flask
@@ -50,6 +50,7 @@ else:
50
50
  P = TypeVar("P")
51
51
  R = TypeVar("R")
52
52
 
53
+ logging.basicConfig(level=logging.INFO)
53
54
  logger = logging.getLogger(__name__)
54
55
 
55
56
 
@@ -58,6 +59,7 @@ def configure_default_broker(broker: Broker = None):
58
59
  rabbit_broker = broker if broker is not None else RabbitmqBroker(url=RABBIT_URL)
59
60
  rabbit_broker.add_middleware(Results(backend=redis_backend))
60
61
  rabbit_broker.add_middleware(ParallelPipeline(redis_url=REDIS_URL))
62
+ rabbit_broker.add_middleware(CurrentMessage())
61
63
  register_actors_for_workers(rabbit_broker)
62
64
  set_broker(rabbit_broker)
63
65
 
@@ -129,7 +131,6 @@ def register_actors_for_workers(broker: Broker):
129
131
  if not service:
130
132
  return
131
133
  for task in service.get("registeredTasks", []):
132
- print(task)
133
134
  pipeline_meta = None
134
135
  for pipeline_key, pipeline in pypeline_config["pipelines"].items():
135
136
  pipeline_config = pipeline["config"]
@@ -317,9 +318,11 @@ class LazyActor(object):
317
318
  return getattr(self.actor, name)
318
319
 
319
320
  def register(self, broker):
320
- self.actor = register_actor(broker=broker, **self.kw)(
321
- ensure_return_value(default_value=True)(self.fn)
322
- )
321
+ self.actor = register_actor(
322
+ actor_name=f"{self.fn.__module__}.{self.fn.__name__}",
323
+ broker=broker,
324
+ **self.kw,
325
+ )(ensure_return_value(default_value=True)(self.fn))
323
326
 
324
327
  # Next is regular actor API.
325
328
  def send(self, *a, **kw):
@@ -463,8 +466,8 @@ def pypeline_worker(
463
466
  command += ["--queues"] + queues
464
467
  command += verbose * ["-v"]
465
468
  args = parser.parse_args(command)
466
- current_app.logger.info("Able to execute the following actors:")
469
+ logger.info("Able to execute the following actors:")
467
470
  for actor in list_managed_actors(broker, queues):
468
- current_app.logger.info(" %s.", format_actor(actor))
471
+ logger.info(" %s.", format_actor(actor))
469
472
 
470
473
  dramatiq_worker(args)
@@ -135,7 +135,7 @@ class PipelineInvoke(MethodView):
135
135
  tags=["Pipelines"],
136
136
  )
137
137
  @bp.arguments(InvokePipelineSchema)
138
- @bp.response(InvokePipelineResponseSchema)
138
+ @bp.response(200, InvokePipelineResponseSchema)
139
139
  def post(self, payload: dict, pipeline_id: str):
140
140
  """Invoke a pipeline by it's ID; optionally provide pipeline arguments."""
141
141
  pipeline_config = retrieve_latest_pipeline_config(pipeline_id=pipeline_id)
@@ -191,7 +191,7 @@ class PipelineResults(MethodView):
191
191
  ],
192
192
  tags=["Pipelines"],
193
193
  )
194
- @bp.response(GetPipelineResultResponseSchema)
194
+ @bp.response(200, GetPipelineResultResponseSchema)
195
195
  def get(self, execution_id: str):
196
196
  """Retrieve results of a pipeline's execution based on execution_id
197
197
 
pypeline/middleware.py CHANGED
@@ -1,6 +1,4 @@
1
1
  import copy
2
- import os
3
-
4
2
  from dramatiq.middleware import Middleware
5
3
 
6
4
  from pypeline.barrier import LockingParallelBarrier
@@ -29,7 +27,6 @@ class ParallelPipeline(Middleware):
29
27
  remaining_tasks = locking_parallel_barrier.decrement_task_count()
30
28
  finally:
31
29
  locking_parallel_barrier.release_lock()
32
-
33
30
  if remaining_tasks <= 0:
34
31
  execution_graph = message.options.get("execution_graph")
35
32
 
@@ -54,8 +51,10 @@ class ParallelPipeline(Middleware):
54
51
  lock_key=f"{completion_uuid}-lock",
55
52
  )
56
53
  locking_parallel_barrier.set_task_count(len(next_group))
54
+ execution_graph_copy = copy.deepcopy(execution_graph)
55
+
57
56
  for next_message in next_group:
58
57
  next_message["options"][
59
58
  "execution_graph"
60
- ] = copy.deepcopy(execution_graph)
59
+ ] = execution_graph_copy
61
60
  broker.enqueue(Message(**next_message))
@@ -79,8 +79,6 @@ def process_non_none_value(value: T) -> None:
79
79
  """
80
80
  if value is None:
81
81
  raise ValueError("None value is not allowed")
82
- # Process the value
83
- print(f"Processing value: {value}")
84
82
 
85
83
 
86
84
  def topological_sort_with_parallelism(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scalable-pypeline
3
- Version: 2.0.3
3
+ Version: 3.0.0
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
@@ -8,8 +8,6 @@ License: Apache License 2.0
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: PyYAML (<7,>=6.0.1)
11
- Requires-Dist: click (==8.0.4)
12
- Requires-Dist: marshmallow (<4,>=3.2.1)
13
11
  Requires-Dist: redis (<5,>=4.5.4)
14
12
  Requires-Dist: db-medley[redis] (<2,>=1.0.2)
15
13
  Requires-Dist: croniter (<2,>=1.0.15)
@@ -19,11 +17,7 @@ Requires-Dist: twine ; extra == 'build'
19
17
  Provides-Extra: dev
20
18
  Requires-Dist: blackd ; extra == 'dev'
21
19
  Provides-Extra: flask
22
- Requires-Dist: Werkzeug (==2.0.3) ; extra == 'flask'
23
- Requires-Dist: itsdangerous (==2.0.1) ; extra == 'flask'
24
- Requires-Dist: Flask (<2,>=1.1.2) ; extra == 'flask'
25
- Requires-Dist: flask-smorest (<0.29,>=0.23.0) ; extra == 'flask'
26
- Requires-Dist: Jinja2 (==3.0.3) ; extra == 'flask'
20
+ Requires-Dist: flask-smorest (<0.45,>=0.44.0) ; extra == 'flask'
27
21
  Provides-Extra: test
28
22
  Requires-Dist: pytest-cov (<3,>=2.6.1) ; extra == 'test'
29
23
  Requires-Dist: tox (<4,>=3.14.1) ; extra == 'test'
@@ -1,10 +1,10 @@
1
- pypeline/__init__.py,sha256=_GEKEa6BYjBV34SZkSlAR87aCM5Y9G0aSI0LXL52iJg,22
1
+ pypeline/__init__.py,sha256=EPmgXOdWKks5S__ZMH7Nu6xpAeVrZpfxaFy4pykuyeI,22
2
2
  pypeline/barrier.py,sha256=dLDaprH5NB-C7MQjZqPpBBhMjmO0VV_kTonlgweznHc,1096
3
- pypeline/composition.py,sha256=tnSe9CHejayBGI__VMFpQ6NYuebTqoPTWuKiBMnANKc,13025
3
+ pypeline/composition.py,sha256=pTw9Xb9h4JnV4siFc3JStm5lB-i9djUADo3Kh5K3s7g,12976
4
4
  pypeline/constants.py,sha256=vi4UZz1xd0ZeIuelp4QgCQsMlIHW65-lVB8l_iA8kBE,2578
5
- pypeline/dramatiq.py,sha256=jr9WORqtusC1gnbvF59CNXny8ORk2Lmlbmf1qsbiLXo,14799
5
+ pypeline/dramatiq.py,sha256=vO79DHqLldh5mqQf6-okn6gjFWxYU_bGdkMvTyV9Qmc,14942
6
6
  pypeline/extensions.py,sha256=BzOTnXhNxap3N7uIUUh_hO6dDwx08Vc_RJDE93_K0Lo,610
7
- pypeline/middleware.py,sha256=6vWNCoRVqnASJ40CAOEpe0JcYRpB6BTkLz8E51q4z2Y,2756
7
+ pypeline/middleware.py,sha256=kTp6niYoe2nXIiN6EGRfdpxrJyioo0GPxDkfefbGlEk,2821
8
8
  pypeline/pipeline_config_schema.py,sha256=DQ_RMucnA0AyrndlW6lkb0orGromcO6C9GgLHyG6lJ0,8013
9
9
  pypeline/pypeline_yaml.py,sha256=Og08sUKwOjq7JYPnkg-NIcGbHravYCkC5Arz22rZEtA,16981
10
10
  pypeline/schedule_config_schema.py,sha256=vtZV-5wpGcAiYcXxdBPRkrjsbR6x_9E-1PC2elrKKbE,3611
@@ -12,16 +12,16 @@ pypeline/flask/__init__.py,sha256=AdljRh0lMiS8ExgDmgzObwVs8jW7hqQuf83Ml8kn8GQ,49
12
12
  pypeline/flask/decorators.py,sha256=ki6jkjZwbDbCWuj7ET7N-ncZwrASp4Fy7257WIYiAAQ,1102
13
13
  pypeline/flask/flask_pypeline.py,sha256=Uqyu3PnSP3DoVZUJPqV9chjT4xdRgvcL3OMXxkbdTEg,5490
14
14
  pypeline/flask/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- pypeline/flask/api/pipelines.py,sha256=sPvEoNwmnJPSA96lZHYS2fwKqZlVyE2OSjUmOPFi91o,7267
15
+ pypeline/flask/api/pipelines.py,sha256=Hne41W0VSmHuiDBE9YwpTt9dUZsTb8ew9U9dKoB85bs,7277
16
16
  pypeline/flask/api/schedules.py,sha256=31lwoFlGv-S-2ahGUCnD5YbmKws8yddj6_PEzzdBi9s,1321
17
17
  pypeline/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  pypeline/utils/config_utils.py,sha256=rAIATyoW7kGETZ_Z2DqiXtGd7bJp5uPfcLtfNPOYsNs,2167
19
19
  pypeline/utils/module_utils.py,sha256=boEP9IYr4p_ick7HlVUfIxOYHQlEmo7dgvDBCQc-C28,2914
20
- pypeline/utils/pipeline_utils.py,sha256=dewzkMajs7uyPHyHjJfISA9pc2-1J5A99Hm4XqNw5qM,6031
20
+ pypeline/utils/pipeline_utils.py,sha256=tt71hLEFgPieokJZlC1rP2dmCTctrOPt7K1rGlbnT4o,5967
21
21
  tests/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- scalable_pypeline-2.0.3.dist-info/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
23
- scalable_pypeline-2.0.3.dist-info/METADATA,sha256=5P802DsrRS3QyRxK07sls35o6P7_gHJBEkuhb8GGPwQ,6239
24
- scalable_pypeline-2.0.3.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
25
- scalable_pypeline-2.0.3.dist-info/entry_points.txt,sha256=uWs10ODfHSBKo2Cx_QaUjPHQTpZ3e77j9VlAdRRmMyg,119
26
- scalable_pypeline-2.0.3.dist-info/top_level.txt,sha256=C7dpkEOc_-nnsAQb28BfQknjD6XHRyS9ZrvVeoIbV7s,15
27
- scalable_pypeline-2.0.3.dist-info/RECORD,,
22
+ scalable_pypeline-3.0.0.dist-info/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
23
+ scalable_pypeline-3.0.0.dist-info/METADATA,sha256=rRgk8isNwrBWH4qXZ3pmtN6SlJm_-MhdQF78LPWRf60,5954
24
+ scalable_pypeline-3.0.0.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
25
+ scalable_pypeline-3.0.0.dist-info/entry_points.txt,sha256=uWs10ODfHSBKo2Cx_QaUjPHQTpZ3e77j9VlAdRRmMyg,119
26
+ scalable_pypeline-3.0.0.dist-info/top_level.txt,sha256=C7dpkEOc_-nnsAQb28BfQknjD6XHRyS9ZrvVeoIbV7s,15
27
+ scalable_pypeline-3.0.0.dist-info/RECORD,,