queue-local 0.0.39__tar.gz → 0.0.40__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.
- {queue-local-0.0.39 → queue-local-0.0.40}/PKG-INFO +1 -2
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local/src/database_queue.py +14 -11
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local/src/our_queue.py +0 -4
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local.egg-info/PKG-INFO +1 -2
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local.egg-info/requires.txt +0 -1
- {queue-local-0.0.39 → queue-local-0.0.40}/setup.py +2 -3
- {queue-local-0.0.39 → queue-local-0.0.40}/README.md +0 -0
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local/src/__init__.py +0 -0
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local.egg-info/SOURCES.txt +0 -0
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local.egg-info/dependency_links.txt +0 -0
- {queue-local-0.0.39 → queue-local-0.0.40}/queue_local.egg-info/top_level.txt +0 -0
- {queue-local-0.0.39 → queue-local-0.0.40}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: queue-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.40
|
|
4
4
|
Home-page: https://github.com/circles-zone/queue-local-python-package
|
|
5
5
|
Author: Circles
|
|
6
6
|
Author-email: info@circles.life
|
|
@@ -8,7 +8,6 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: License :: Other/Proprietary License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: pytest>=7.4.1
|
|
12
11
|
Requires-Dist: database-mysql-local>=0.0.120
|
|
13
12
|
Requires-Dist: logger-local>=0.0.59
|
|
14
13
|
Requires-Dist: user-context-remote>=0.0.30
|
|
@@ -25,7 +25,8 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
25
25
|
"""A queue that uses a database table as the queue."""
|
|
26
26
|
|
|
27
27
|
def __init__(self, schema_name: str = "queue", table_name: str = "queue_item_table",
|
|
28
|
-
view_name: str = "queue_item_view", id_column_name: str = "queue_item_id"
|
|
28
|
+
view_name: str = "queue_item_view", id_column_name: str = "queue_item_id",
|
|
29
|
+
is_test_data: bool = False) -> None:
|
|
29
30
|
"""Initialize the queue.
|
|
30
31
|
Make sure the table has the following columns:
|
|
31
32
|
queue_status_id, action_id, process_id, user_jwt
|
|
@@ -62,11 +63,12 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
62
63
|
self.id_column_name = id_column_name
|
|
63
64
|
|
|
64
65
|
GenericCRUD.__init__(self, default_schema_name=schema_name, default_table_name=table_name,
|
|
65
|
-
default_view_table_name=view_name, default_id_column_name=id_column_name
|
|
66
|
+
default_view_table_name=view_name, default_id_column_name=id_column_name,
|
|
67
|
+
is_test_data=is_test_data)
|
|
66
68
|
self.logger.info("DatabaseQueue initialized successfully", object={
|
|
67
69
|
"schema_name": schema_name, "table_name": table_name,
|
|
68
70
|
"view_name": view_name, "id_column_name": id_column_name})
|
|
69
|
-
self.
|
|
71
|
+
self.user_context = UserContext().login_using_user_identification_and_password()
|
|
70
72
|
|
|
71
73
|
def push(self, data_json: dict) -> int:
|
|
72
74
|
"""Pushes a new entry to the queue.
|
|
@@ -82,9 +84,9 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
82
84
|
|
|
83
85
|
queue_id = self.insert(data_json=data_json) # returning the queue_id for messages-local
|
|
84
86
|
self.logger.end("Entry pushed to the queue database successfully")
|
|
85
|
-
except Exception as
|
|
86
|
-
self.logger.
|
|
87
|
-
raise
|
|
87
|
+
except Exception as exception:
|
|
88
|
+
self.logger.error("Error while pushing entry to the queue database", object=exception)
|
|
89
|
+
raise exception
|
|
88
90
|
return queue_id
|
|
89
91
|
|
|
90
92
|
def push_back(self, queue_item: dict) -> None:
|
|
@@ -101,7 +103,7 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
101
103
|
:param action_ids: Tuple of action IDs to consider (optional).
|
|
102
104
|
:return: Dictionary representing the retrieved queue item.
|
|
103
105
|
"""
|
|
104
|
-
updated_user_id = self.
|
|
106
|
+
updated_user_id = self.user_context.get_effective_user_id()
|
|
105
107
|
self.logger.start("Getting and updating queue item from the queue database", object={"action_ids": action_ids})
|
|
106
108
|
action_ids = self._fix_action_ids(action_ids)
|
|
107
109
|
|
|
@@ -119,7 +121,7 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
119
121
|
query = f"UPDATE {self.schema_name}.{self.default_table_name} " \
|
|
120
122
|
f"SET queue_status_id=%s, updated_user_id=%s, user_jwt=%s, updated_timestamp = NOW() " \
|
|
121
123
|
f"WHERE {self.id_column_name} = %s"
|
|
122
|
-
params = (StatusEnum.RETRIEVED.value, updated_user_id, self.
|
|
124
|
+
params = (StatusEnum.RETRIEVED.value, updated_user_id, self.user_context.get_user_jwt(),
|
|
123
125
|
queue_item[self.id_column_name])
|
|
124
126
|
self.cursor.execute(query, params)
|
|
125
127
|
self.connection.commit()
|
|
@@ -127,10 +129,11 @@ class DatabaseQueue(OurQueue, GenericCRUD):
|
|
|
127
129
|
object=queue_item)
|
|
128
130
|
else:
|
|
129
131
|
self.logger.end("The queue is empty")
|
|
130
|
-
except mysql.connector.Error as
|
|
132
|
+
except mysql.connector.Error as exception:
|
|
131
133
|
self.connection.rollback()
|
|
132
|
-
self.logger.
|
|
133
|
-
|
|
134
|
+
self.logger.error("Error while getting and updating queue item from the queue database",
|
|
135
|
+
object=exception)
|
|
136
|
+
raise exception
|
|
134
137
|
return queue_item
|
|
135
138
|
|
|
136
139
|
def peek(self, action_ids: tuple = ()) -> dict:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: queue-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.40
|
|
4
4
|
Home-page: https://github.com/circles-zone/queue-local-python-package
|
|
5
5
|
Author: Circles
|
|
6
6
|
Author-email: info@circles.life
|
|
@@ -8,7 +8,6 @@ Classifier: Programming Language :: Python :: 3
|
|
|
8
8
|
Classifier: License :: Other/Proprietary License
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: pytest>=7.4.1
|
|
12
11
|
Requires-Dist: database-mysql-local>=0.0.120
|
|
13
12
|
Requires-Dist: logger-local>=0.0.59
|
|
14
13
|
Requires-Dist: user-context-remote>=0.0.30
|
|
@@ -5,7 +5,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name=PACKAGE_NAME, # https://pypi.org/project/queue-local
|
|
8
|
-
version='0.0.
|
|
8
|
+
version='0.0.40',
|
|
9
9
|
author="Circles",
|
|
10
10
|
author_email="info@circles.life",
|
|
11
11
|
url=f"https://github.com/circles-zone/{PACKAGE_NAME}-python-package",
|
|
@@ -19,8 +19,7 @@ setuptools.setup(
|
|
|
19
19
|
"License :: Other/Proprietary License",
|
|
20
20
|
"Operating System :: OS Independent",
|
|
21
21
|
],
|
|
22
|
-
install_requires=["
|
|
23
|
-
"database-mysql-local>=0.0.120",
|
|
22
|
+
install_requires=["database-mysql-local>=0.0.120",
|
|
24
23
|
"logger-local>=0.0.59",
|
|
25
24
|
"user-context-remote>=0.0.30",
|
|
26
25
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|