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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queue-local
3
- Version: 0.0.39
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") -> None:
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.user = UserContext()
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 e:
86
- self.logger.exception("Error while pushing entry to the queue database", object=e)
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.user.get_effective_user_id()
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.user.get_user_jwt(),
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 e:
132
+ except mysql.connector.Error as exception:
131
133
  self.connection.rollback()
132
- self.logger.exception("Error while getting and updating queue item from the queue database", object=e)
133
- raise
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,9 +1,5 @@
1
- import os
2
- import sys
3
1
  from abc import ABC, abstractmethod
4
2
 
5
- sys.path.append(os.path.dirname(os.path.abspath(__file__)))
6
-
7
3
 
8
4
  class OurQueue(ABC):
9
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queue-local
3
- Version: 0.0.39
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
@@ -1,4 +1,3 @@
1
- pytest>=7.4.1
2
1
  database-mysql-local>=0.0.120
3
2
  logger-local>=0.0.59
4
3
  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.39',
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=["pytest>=7.4.1",
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