queue-local 0.0.32__tar.gz → 0.0.33__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.
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.1
2
+ Name: queue-local
3
+ Version: 0.0.33
4
+ Home-page: https://github.com/circles-zone/queue-local-python-package
5
+ Author: Circles
6
+ Author-email: info@circles.life
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: Other/Proprietary License
9
+ Classifier: Operating System :: OS Independent
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: mysql-connector>=2.2.9
12
+ Requires-Dist: pytest>=7.4.1
13
+ Requires-Dist: database-mysql-local>=0.0.120
14
+ Requires-Dist: logger-local>=0.0.59
15
+ Requires-Dist: user-context-remote>=0.0.30
16
+ Requires-Dist: requests>=2.22.0
17
+
18
+ queue-local
@@ -97,7 +97,8 @@ class DatabaseQueue(OurQueue, GenericCRUD):
97
97
 
98
98
  try:
99
99
  data_json = {"process_id": os.getpid()}
100
- update_where = f"process_id IS NULL AND queue_status_id = {StatusEnum.NEW.value}" + \
100
+ update_where = f"process_id IS NULL AND queue_status_id = {StatusEnum.NEW.value} AND " \
101
+ f"NOW() > start_timestamp AND (end_timestamp is NULL or NOW() < end_timestamp)" + \
101
102
  (f" AND action_id IN {action_ids}" if action_ids else "")
102
103
  self.update_by_where(where=update_where, order_by="created_timestamp", limit=1, data_json=data_json)
103
104
 
@@ -107,7 +108,7 @@ class DatabaseQueue(OurQueue, GenericCRUD):
107
108
  # Update the selected queue item
108
109
  query = f"UPDATE {self.default_table_name} " \
109
110
  f"SET queue_status_id=%s, updated_user_id=%s, user_jwt=%s, thread_id=%s," \
110
- f"server_ip_v4=%s, server_ip_v6=%s, start_timestamp = NOW() " \
111
+ f"server_ip_v4=%s, server_ip_v6=%s " \
111
112
  f"WHERE {self.id_column_name} = %s"
112
113
  params = (StatusEnum.RETRIEVED.value, updated_user_id, self.user.get_user_JWT(),
113
114
  get_thread_id(), ip_v4, ip_v6, queue_item[self.id_column_name])
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.1
2
+ Name: queue-local
3
+ Version: 0.0.33
4
+ Home-page: https://github.com/circles-zone/queue-local-python-package
5
+ Author: Circles
6
+ Author-email: info@circles.life
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: Other/Proprietary License
9
+ Classifier: Operating System :: OS Independent
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: mysql-connector>=2.2.9
12
+ Requires-Dist: pytest>=7.4.1
13
+ Requires-Dist: database-mysql-local>=0.0.120
14
+ Requires-Dist: logger-local>=0.0.59
15
+ Requires-Dist: user-context-remote>=0.0.30
16
+ Requires-Dist: requests>=2.22.0
17
+
18
+ queue-local
@@ -3,19 +3,16 @@ import setuptools
3
3
  PACKAGE_NAME = "queue-local"
4
4
  package_dir = PACKAGE_NAME.replace("-", "_")
5
5
 
6
- with open('README.md') as f:
7
- readme = f.read()
8
-
9
6
  setuptools.setup(
10
7
  name=PACKAGE_NAME, # https://pypi.org/project/queue-local
11
- version='0.0.32',
8
+ version='0.0.33',
12
9
  author="Circles",
13
10
  author_email="info@circles.life",
14
11
  url=f"https://github.com/circles-zone/{PACKAGE_NAME}-python-package",
15
12
  packages=[package_dir],
16
13
  package_dir={package_dir: f'{package_dir}/src'},
17
14
  package_data={package_dir: ['*.py']},
18
- long_description=readme,
15
+ long_description="queue-local",
19
16
  long_description_content_type='text/markdown',
20
17
  classifiers=[
21
18
  "Programming Language :: Python :: 3",
@@ -1,75 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: queue-local
3
- Version: 0.0.32
4
- Home-page: https://github.com/circles-zone/queue-local-python-package
5
- Author: Circles
6
- Author-email: info@circles.life
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: Other/Proprietary License
9
- Classifier: Operating System :: OS Independent
10
- Description-Content-Type: text/markdown
11
- Requires-Dist: mysql-connector>=2.2.9
12
- Requires-Dist: pytest>=7.4.1
13
- Requires-Dist: database-mysql-local>=0.0.120
14
- Requires-Dist: logger-local>=0.0.59
15
- Requires-Dist: user-context-remote>=0.0.30
16
- Requires-Dist: requests>=2.22.0
17
-
18
- # queue-local-python-package
19
-
20
- ## Usage:
21
-
22
- Install:
23
- ```bash
24
- pip install queue-local
25
- ```
26
- - It's recommended to add `queue-local` to your `requirements.txt` file if you're using it as part of your project dependencies.
27
-
28
-
29
- ### Using the `DatabaseQueue` Class:
30
-
31
- ```py
32
- from queue_local.database_queue import DatabaseQueue
33
-
34
- q = DatabaseQueue() # you can also pass some parameters here, see the class definition for more info
35
-
36
- # Push items into the queue
37
- q.push({"item_description": "test 1", "action_id": 1, "parameters_json": "{'a': 1, 'b': 2}"})
38
- q.push({"item_description": "test 2", "action_id": 2, "parameters_json": {'a': 1, 'b': 2}})
39
-
40
- # Peek at the first item in the queue (without removing it)
41
- result1 = q.peek() # "test 1" is still in the queue
42
-
43
- # Get an item from the queue (and remove it) based on action_id
44
- result2 = q.get(action_ids=(2, )) # Gets "test 2" (the first item with action_id=2)
45
-
46
- # Get an item from the queue (and remove it)
47
- result3 = q.get() # Gets "test 1"
48
-
49
- q.close() # close the database connection
50
- ```
51
-
52
-
53
-
54
- ### Inheriting from the Abstract `OurQueue` Class:
55
-
56
- ```py
57
- from queue_local.our_queue import OurQueue
58
-
59
- class YourCustomQueue(OurQueue):
60
- def __init__(self):
61
- pass
62
-
63
- def push(self, item):
64
- """Push an item to the queue"""
65
- pass
66
-
67
- def get(self):
68
- """Get an item from the queue (and delete)"""
69
- pass
70
-
71
- def peek(self):
72
- """Peek at the head of the queue (without deleting)"""
73
- pass
74
- # Add any additional functions you need, such as is_empty()
75
- ```
@@ -1,75 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: queue-local
3
- Version: 0.0.32
4
- Home-page: https://github.com/circles-zone/queue-local-python-package
5
- Author: Circles
6
- Author-email: info@circles.life
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: License :: Other/Proprietary License
9
- Classifier: Operating System :: OS Independent
10
- Description-Content-Type: text/markdown
11
- Requires-Dist: mysql-connector>=2.2.9
12
- Requires-Dist: pytest>=7.4.1
13
- Requires-Dist: database-mysql-local>=0.0.120
14
- Requires-Dist: logger-local>=0.0.59
15
- Requires-Dist: user-context-remote>=0.0.30
16
- Requires-Dist: requests>=2.22.0
17
-
18
- # queue-local-python-package
19
-
20
- ## Usage:
21
-
22
- Install:
23
- ```bash
24
- pip install queue-local
25
- ```
26
- - It's recommended to add `queue-local` to your `requirements.txt` file if you're using it as part of your project dependencies.
27
-
28
-
29
- ### Using the `DatabaseQueue` Class:
30
-
31
- ```py
32
- from queue_local.database_queue import DatabaseQueue
33
-
34
- q = DatabaseQueue() # you can also pass some parameters here, see the class definition for more info
35
-
36
- # Push items into the queue
37
- q.push({"item_description": "test 1", "action_id": 1, "parameters_json": "{'a': 1, 'b': 2}"})
38
- q.push({"item_description": "test 2", "action_id": 2, "parameters_json": {'a': 1, 'b': 2}})
39
-
40
- # Peek at the first item in the queue (without removing it)
41
- result1 = q.peek() # "test 1" is still in the queue
42
-
43
- # Get an item from the queue (and remove it) based on action_id
44
- result2 = q.get(action_ids=(2, )) # Gets "test 2" (the first item with action_id=2)
45
-
46
- # Get an item from the queue (and remove it)
47
- result3 = q.get() # Gets "test 1"
48
-
49
- q.close() # close the database connection
50
- ```
51
-
52
-
53
-
54
- ### Inheriting from the Abstract `OurQueue` Class:
55
-
56
- ```py
57
- from queue_local.our_queue import OurQueue
58
-
59
- class YourCustomQueue(OurQueue):
60
- def __init__(self):
61
- pass
62
-
63
- def push(self, item):
64
- """Push an item to the queue"""
65
- pass
66
-
67
- def get(self):
68
- """Get an item from the queue (and delete)"""
69
- pass
70
-
71
- def peek(self):
72
- """Peek at the head of the queue (without deleting)"""
73
- pass
74
- # Add any additional functions you need, such as is_empty()
75
- ```
File without changes
File without changes