scalable-pypeline 2.1.23__tar.gz → 2.1.25__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.
Potentially problematic release.
This version of scalable-pypeline might be problematic. Click here for more details.
- {scalable-pypeline-2.1.23/scalable_pypeline.egg-info → scalable-pypeline-2.1.25}/PKG-INFO +1 -1
- scalable-pypeline-2.1.25/pypeline/__init__.py +1 -0
- scalable-pypeline-2.1.25/pypeline/barrier.py +63 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/constants.py +1 -1
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/dramatiq.py +3 -3
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25/scalable_pypeline.egg-info}/PKG-INFO +1 -1
- scalable-pypeline-2.1.23/pypeline/__init__.py +0 -1
- scalable-pypeline-2.1.23/pypeline/barrier.py +0 -37
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/LICENSE +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/MANIFEST.in +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/README.md +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/executable_job_config_schema.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/extensions.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/flask/__init__.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/flask/api/__init__.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/flask/api/pipelines.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/flask/api/schedules.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/flask/decorators.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/flask/flask_pypeline.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipeline_config_schema.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipeline_settings_schema.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/__init__.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/composition/__init__.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/composition/parallel_pipeline_composition.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/composition/pypeline_composition.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/factory.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/middleware/__init__.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/middleware/get_active_worker_id_middleware.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/middleware/graceful_shutdown_middleware.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/middleware/parallel_pipeline_middleware.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/middleware/pypeline_middleware.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pypeline_yaml.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/schedule_config_schema.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/__init__.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/config_utils.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/dramatiq_utils.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/executable_job_util.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/graceful_shutdown_util.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/module_utils.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/pipeline_utils.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/schema_utils.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/requirements.txt +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/SOURCES.txt +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/dependency_links.txt +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/entry_points.txt +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/requires.txt +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/top_level.txt +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/setup.cfg +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/setup.py +0 -0
- {scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/tests/fixtures/__init__.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.1.25"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import time
|
|
2
|
+
import redis
|
|
3
|
+
from redis.sentinel import Sentinel
|
|
4
|
+
from urllib.parse import urlparse
|
|
5
|
+
from pypeline.constants import (
|
|
6
|
+
REDIS_SENTINEL_MASTER_NAME,
|
|
7
|
+
DEFAULT_REDIS_SOCKET_CONNECT_TIMEOUT,
|
|
8
|
+
DEFAULT_REDIS_SOCKET_TIMEOUT,
|
|
9
|
+
DEFAULT_REDIS_RETRY_ON_TIMEOUT,
|
|
10
|
+
DEFAULT_REDIS_SOCKET_KEEPALIVE,
|
|
11
|
+
DEFAULT_REDIS_HEALTH_CHECK_INTERVAL,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class LockingParallelBarrier:
|
|
16
|
+
def __init__(self, redis_url, task_key="task_counter", lock_key="task_lock"):
|
|
17
|
+
# Connect to Redis using the provided URL
|
|
18
|
+
if REDIS_SENTINEL_MASTER_NAME is not None:
|
|
19
|
+
parsed_redis_url = urlparse(redis_url)
|
|
20
|
+
redis_sentinel = Sentinel(
|
|
21
|
+
sentinels=[(parsed_redis_url.hostname, parsed_redis_url.port)],
|
|
22
|
+
)
|
|
23
|
+
self.redis = redis_sentinel.master_for(
|
|
24
|
+
REDIS_SENTINEL_MASTER_NAME,
|
|
25
|
+
db=int(parsed_redis_url.path[1]) if parsed_redis_url.path else 0,
|
|
26
|
+
password=parsed_redis_url.password,
|
|
27
|
+
socket_connect_timeout=DEFAULT_REDIS_SOCKET_CONNECT_TIMEOUT,
|
|
28
|
+
socket_timeout=DEFAULT_REDIS_SOCKET_TIMEOUT,
|
|
29
|
+
retry_on_timeout=DEFAULT_REDIS_RETRY_ON_TIMEOUT,
|
|
30
|
+
socket_keepalive=DEFAULT_REDIS_SOCKET_KEEPALIVE,
|
|
31
|
+
health_check_interval=DEFAULT_REDIS_HEALTH_CHECK_INTERVAL,
|
|
32
|
+
decode_responses=True,
|
|
33
|
+
)
|
|
34
|
+
else:
|
|
35
|
+
self.redis = redis.StrictRedis.from_url(redis_url, decode_responses=True)
|
|
36
|
+
self.task_key = task_key
|
|
37
|
+
self.lock_key = lock_key
|
|
38
|
+
|
|
39
|
+
def acquire_lock(self, timeout=5):
|
|
40
|
+
"""Acquire a lock using Redis."""
|
|
41
|
+
while True:
|
|
42
|
+
if self.redis.set(self.lock_key, "locked", nx=True, ex=timeout):
|
|
43
|
+
return True
|
|
44
|
+
time.sleep(0.1)
|
|
45
|
+
|
|
46
|
+
def release_lock(self):
|
|
47
|
+
"""Release the lock in Redis."""
|
|
48
|
+
self.redis.delete(self.lock_key)
|
|
49
|
+
|
|
50
|
+
def set_task_count(self, count):
|
|
51
|
+
"""Initialize the task counter in Redis."""
|
|
52
|
+
self.redis.set(self.task_key, count)
|
|
53
|
+
|
|
54
|
+
def decrement_task_count(self):
|
|
55
|
+
"""Decrement the task counter in Redis."""
|
|
56
|
+
return self.redis.decr(self.task_key)
|
|
57
|
+
|
|
58
|
+
def task_exists(self):
|
|
59
|
+
return self.redis.exists(self.task_key)
|
|
60
|
+
|
|
61
|
+
def get_task_count(self):
|
|
62
|
+
"""Get the current value of the task counter."""
|
|
63
|
+
return int(self.redis.get(self.task_key) or 0)
|
|
@@ -14,7 +14,7 @@ DEFAULT_BROKER_CALLABLE = os.environ.get(
|
|
|
14
14
|
# Pypeline broker connections
|
|
15
15
|
RABBIT_URL = os.environ.get("RABBIT_URL", "amqp://admin:password@127.0.0.1:5672")
|
|
16
16
|
REDIS_URL = os.environ.get("REDIS_URL", "redis://localhost:6379/0")
|
|
17
|
-
|
|
17
|
+
REDIS_SENTINEL_MASTER_NAME = os.environ.get("REDIS_SENTINEL_MASTER_NAME", None)
|
|
18
18
|
|
|
19
19
|
# Pypeline task defaults
|
|
20
20
|
PARALLEL_PIPELINE_CALLBACK_BARRIER_TTL = int(
|
|
@@ -30,7 +30,7 @@ from flask.cli import with_appcontext
|
|
|
30
30
|
|
|
31
31
|
from pypeline.constants import (
|
|
32
32
|
REDIS_URL,
|
|
33
|
-
|
|
33
|
+
REDIS_SENTINEL_MASTER_NAME,
|
|
34
34
|
RABBIT_URL,
|
|
35
35
|
DEFAULT_BROKER_CALLABLE,
|
|
36
36
|
DEFAULT_BROKER_CONNECTION_HEARTBEAT,
|
|
@@ -70,13 +70,13 @@ logger = logging.getLogger(__name__)
|
|
|
70
70
|
|
|
71
71
|
def configure_default_broker(broker: Broker = None):
|
|
72
72
|
redis_client = None
|
|
73
|
-
if
|
|
73
|
+
if REDIS_SENTINEL_MASTER_NAME is not None:
|
|
74
74
|
parsed_redis_url = urlparse(REDIS_URL)
|
|
75
75
|
redis_sentinel = Sentinel(
|
|
76
76
|
sentinels=[(parsed_redis_url.hostname, parsed_redis_url.port)],
|
|
77
77
|
)
|
|
78
78
|
redis_client = redis_sentinel.master_for(
|
|
79
|
-
|
|
79
|
+
REDIS_SENTINEL_MASTER_NAME,
|
|
80
80
|
db=int(parsed_redis_url.path[1]) if parsed_redis_url.path else 0,
|
|
81
81
|
password=parsed_redis_url.password,
|
|
82
82
|
socket_connect_timeout=DEFAULT_REDIS_SOCKET_CONNECT_TIMEOUT,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.1.23"
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import time
|
|
2
|
-
|
|
3
|
-
import redis
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class LockingParallelBarrier:
|
|
7
|
-
def __init__(self, redis_url, task_key="task_counter", lock_key="task_lock"):
|
|
8
|
-
# Connect to Redis using the provided URL
|
|
9
|
-
self.redis = redis.StrictRedis.from_url(redis_url, decode_responses=True)
|
|
10
|
-
self.task_key = task_key
|
|
11
|
-
self.lock_key = lock_key
|
|
12
|
-
|
|
13
|
-
def acquire_lock(self, timeout=5):
|
|
14
|
-
"""Acquire a lock using Redis."""
|
|
15
|
-
while True:
|
|
16
|
-
if self.redis.set(self.lock_key, "locked", nx=True, ex=timeout):
|
|
17
|
-
return True
|
|
18
|
-
time.sleep(0.1)
|
|
19
|
-
|
|
20
|
-
def release_lock(self):
|
|
21
|
-
"""Release the lock in Redis."""
|
|
22
|
-
self.redis.delete(self.lock_key)
|
|
23
|
-
|
|
24
|
-
def set_task_count(self, count):
|
|
25
|
-
"""Initialize the task counter in Redis."""
|
|
26
|
-
self.redis.set(self.task_key, count)
|
|
27
|
-
|
|
28
|
-
def decrement_task_count(self):
|
|
29
|
-
"""Decrement the task counter in Redis."""
|
|
30
|
-
return self.redis.decr(self.task_key)
|
|
31
|
-
|
|
32
|
-
def task_exists(self):
|
|
33
|
-
return self.redis.exists(self.task_key)
|
|
34
|
-
|
|
35
|
-
def get_task_count(self):
|
|
36
|
-
"""Get the current value of the task counter."""
|
|
37
|
-
return int(self.redis.get(self.task_key) or 0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/executable_job_config_schema.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/composition/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/pipelines/middleware/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/pypeline/utils/graceful_shutdown_util.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/requires.txt
RENAMED
|
File without changes
|
{scalable-pypeline-2.1.23 → scalable-pypeline-2.1.25}/scalable_pypeline.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|