queue-local 0.0.55__tar.gz → 0.0.56__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.55
3
+ Version: 0.0.56
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
@@ -10,7 +10,7 @@ from user_context_remote.user_context import UserContext
10
10
 
11
11
  from .our_queue import OurQueue
12
12
 
13
- QUEUE_LOCAL_PYTHON_COMPONENT_ID = 155
13
+ QUEUE_LOCAL_PYTHON_COMPONENT_ID = 156
14
14
  QUEUE_LOCAL_PYTHON_COMPONENT_NAME = "queue_local/src/database_queue.py"
15
15
  DEVELOPER_EMAIL = 'akiva.s@circ.zone'
16
16
  queue_logger_object = {
@@ -65,7 +65,8 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
65
65
  is_test_data=is_test_data)
66
66
  self.user_context = UserContext()
67
67
 
68
- def push(self, queue_dict: dict) -> int:
68
+ def push(self, data_dict: dict) -> int:
69
+ queue_dict=data_dict
69
70
  """Pushes a new entry to the queue and returns the new queue id.
70
71
  queue_dict consists of columns and values to insert into the queue table."""
71
72
  created_user_id = UserContext().get_effective_user_id()
@@ -88,12 +89,13 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
88
89
  # TODO Can we do this everywhere? [I will make it auto in the meta logger]
89
90
 
90
91
 
91
- def push_back(self, queue_item: dict) -> None:
92
+ def push_back(self, queue_item: dict = None, data_dict: dict = None) -> None:
92
93
  """Push a taken queue item back to the queue."""
94
+ queue_dict = queue_item or data_dict
93
95
  queue_dict = {"queue_status_id": QueueStatusEnum.NEW.value, "process_id": None}
94
96
  self.update_by_column_and_value(column_value=queue_item[self.queue_item_id_column_name], queue_dict=queue_dict)
95
97
 
96
- def get(self, *, action_ids: tuple = (), custom_condition: str = "") -> dict:
98
+ def get(self, *, action_ids: tuple = (), custom_condition: str = "",data_dict: dict = None) -> dict:
97
99
  """
98
100
  Returns the first item from the queue (possibly considering specific actions) and marks it as taken.
99
101
 
@@ -101,6 +103,7 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
101
103
  :param custom_condition: Custom condition to add to the WHERE clause (optional).
102
104
  :return: Dictionary representing the retrieved queue item.
103
105
  """
106
+ queue_dict=data_dict
104
107
  action_ids = self._fix_action_ids(action_ids)
105
108
 
106
109
  queue_dict = {"process_id": os.getpid()}
@@ -112,6 +115,7 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
112
115
  self.update_by_where(where=update_where, order_by=self.queue_item_id_column_name, limit=1, data_dict=queue_dict)
113
116
 
114
117
  select_where = f"process_id = {os.getpid()} AND (queue_status_id IS NULL OR queue_status_id = {QueueStatusEnum.NEW.value})"
118
+
115
119
  queue_item = self.select_one_dict_by_where(where=select_where)
116
120
  if queue_item:
117
121
  update_queue_dict = {"queue_status_id": QueueStatusEnum.RETRIEVED.value,
@@ -145,7 +149,8 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
145
149
  return action_ids if len(action_ids) != 1 else f"({action_ids[0]})"
146
150
 
147
151
  @staticmethod
148
- def _fix_parameters_json(queue_dict: dict):
152
+ def _fix_parameters_json(data_dict: dict):
153
+ queue_dict=data_dict
149
154
  """Fixes the parameters_json argument to fit the SQL syntax (parameters_json must be a string)"""
150
155
  for key, value in queue_dict.items():
151
156
  if "parameters_json" in key:
@@ -153,3 +158,5 @@ class DatabaseQueue(OurQueue, GenericCRUD, metaclass=MetaLogger, object=queue_lo
153
158
  queue_dict[key] = value.replace("'", '"')
154
159
  else:
155
160
  queue_dict[key] = json.dumps(value)
161
+
162
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queue-local
3
- Version: 0.0.55
3
+ Version: 0.0.56
4
4
  Home-page: https://github.com/circles-zone/queue-local-python-package
5
5
  Author: Circles
6
6
  Author-email: info@circles.life
@@ -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.55',
8
+ version='0.0.56',
9
9
  author="Circles",
10
10
  author_email="info@circles.life",
11
11
  url=f"https://github.com/circles-zone/{PACKAGE_NAME}-python-package",
File without changes
File without changes