dsw-command-queue 4.21.0__py2.py3-none-any.whl → 4.22.1__py2.py3-none-any.whl
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.
- dsw/command_queue/build_info.py +4 -4
- dsw/command_queue/command_queue.py +11 -17
- dsw/command_queue/query.py +1 -1
- {dsw_command_queue-4.21.0.dist-info → dsw_command_queue-4.22.1.dist-info}/METADATA +2 -2
- dsw_command_queue-4.22.1.dist-info/RECORD +9 -0
- dsw_command_queue-4.21.0.dist-info/RECORD +0 -9
- {dsw_command_queue-4.21.0.dist-info → dsw_command_queue-4.22.1.dist-info}/WHEEL +0 -0
- {dsw_command_queue-4.21.0.dist-info → dsw_command_queue-4.22.1.dist-info}/licenses/LICENSE +0 -0
- {dsw_command_queue-4.21.0.dist-info → dsw_command_queue-4.22.1.dist-info}/top_level.txt +0 -0
dsw/command_queue/build_info.py
CHANGED
|
@@ -9,9 +9,9 @@ BuildInfo = namedtuple(
|
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
BUILD_INFO = BuildInfo(
|
|
12
|
-
version='v4.
|
|
13
|
-
built_at='2025-
|
|
14
|
-
sha='
|
|
12
|
+
version='v4.22.1~13699ca',
|
|
13
|
+
built_at='2025-09-04 06:56:13Z',
|
|
14
|
+
sha='13699ca0f74ff51a24bd76e242a89ef434b74658',
|
|
15
15
|
branch='HEAD',
|
|
16
|
-
tag='v4.
|
|
16
|
+
tag='v4.22.1',
|
|
17
17
|
)
|
|
@@ -107,7 +107,7 @@ class CommandQueue:
|
|
|
107
107
|
after=tenacity.after_log(LOG, logging.INFO),
|
|
108
108
|
)
|
|
109
109
|
def run(self):
|
|
110
|
-
LOG.info('Preparing to listen to command queue')
|
|
110
|
+
LOG.info('Preparing to listen to command queue (issuing LISTEN)')
|
|
111
111
|
queue_conn = self.db.conn_queue
|
|
112
112
|
queue_conn.connection.execute(
|
|
113
113
|
query=self.queries.query_listen(),
|
|
@@ -121,7 +121,7 @@ class CommandQueue:
|
|
|
121
121
|
while True:
|
|
122
122
|
self._fetch_and_process_queued()
|
|
123
123
|
|
|
124
|
-
LOG.
|
|
124
|
+
LOG.info('Waiting for notifications (up to %s seconds)', self.wait_timeout)
|
|
125
125
|
w = select.select(fds, [], [], self.wait_timeout)
|
|
126
126
|
|
|
127
127
|
if self._interrupted:
|
|
@@ -129,15 +129,15 @@ class CommandQueue:
|
|
|
129
129
|
break
|
|
130
130
|
|
|
131
131
|
if w == ([], [], []):
|
|
132
|
-
LOG.
|
|
133
|
-
|
|
132
|
+
LOG.info('Nothing received in this cycle (timeout %s seconds)',
|
|
133
|
+
self.wait_timeout)
|
|
134
134
|
else:
|
|
135
135
|
notifications = 0
|
|
136
|
-
for
|
|
136
|
+
for notification in psycopg.generators.notifies(queue_conn.connection.pgconn):
|
|
137
137
|
notifications += 1
|
|
138
|
-
LOG.
|
|
138
|
+
LOG.info('Notification received: %s', notification)
|
|
139
139
|
LOG.info('Notifications received (%s in total)', notifications)
|
|
140
|
-
LOG.
|
|
140
|
+
LOG.info('Exiting command queue')
|
|
141
141
|
|
|
142
142
|
@tenacity.retry(
|
|
143
143
|
reraise=True,
|
|
@@ -158,12 +158,6 @@ class CommandQueue:
|
|
|
158
158
|
LOG.info('There are no more commands to process (%s processed)',
|
|
159
159
|
count)
|
|
160
160
|
|
|
161
|
-
def accept_notification(self, payload: psycopg.Notify) -> bool:
|
|
162
|
-
LOG.debug('Accepting notification from channel "%s" (PID = %s) %s',
|
|
163
|
-
payload.channel, payload.pid, payload.payload)
|
|
164
|
-
LOG.debug('Trying to fetch a new job')
|
|
165
|
-
return self.fetch_and_process()
|
|
166
|
-
|
|
167
161
|
def fetch_and_process(self) -> bool:
|
|
168
162
|
cursor = self.db.conn_query.new_cursor(use_dict=True)
|
|
169
163
|
cursor.execute(
|
|
@@ -172,14 +166,14 @@ class CommandQueue:
|
|
|
172
166
|
)
|
|
173
167
|
result = cursor.fetchall()
|
|
174
168
|
if len(result) != 1:
|
|
175
|
-
LOG.
|
|
169
|
+
LOG.info('Fetched %s persistent commands', len(result))
|
|
176
170
|
return False
|
|
177
171
|
|
|
178
172
|
command = PersistentCommand.from_dict_row(result[0])
|
|
179
173
|
LOG.info('Retrieved persistent command %s for processing', command.uuid)
|
|
180
|
-
LOG.
|
|
181
|
-
LOG.
|
|
182
|
-
LOG.
|
|
174
|
+
LOG.info('Previous state: %s', command.state)
|
|
175
|
+
LOG.info('Attempts: %s / %s', command.attempts, command.max_attempts)
|
|
176
|
+
LOG.info('Last error: %s', command.last_error_message)
|
|
183
177
|
|
|
184
178
|
self._process(command)
|
|
185
179
|
|
dsw/command_queue/query.py
CHANGED
|
@@ -25,7 +25,7 @@ class CommandQueries:
|
|
|
25
25
|
AND attempts < max_attempts
|
|
26
26
|
AND state != '{CommandState.DONE.value}'
|
|
27
27
|
AND state != '{CommandState.IGNORE.value}'
|
|
28
|
-
AND (
|
|
28
|
+
AND (created_at AT TIME ZONE 'UTC')
|
|
29
29
|
<
|
|
30
30
|
(%(now)s - ({exp} ^ attempts - 1) * INTERVAL '{interval}')
|
|
31
31
|
ORDER BY attempts ASC, updated_at DESC
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dsw-command-queue
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.22.1
|
|
4
4
|
Summary: Library for working with command queue and persistent commands
|
|
5
5
|
Author-email: Marek Suchánek <marek.suchanek@ds-wizard.org>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -20,7 +20,7 @@ Requires-Python: <4,>=3.12
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: func-timeout
|
|
23
|
-
Requires-Dist: dsw-database==4.
|
|
23
|
+
Requires-Dist: dsw-database==4.22.1
|
|
24
24
|
Dynamic: license-file
|
|
25
25
|
|
|
26
26
|
# Data Stewardship Wizard: Command Queue
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
dsw/command_queue/__init__.py,sha256=153BhwEbazTo33P4r7w8MdGHpODhvzrhL6u7fwDMaQc,136
|
|
2
|
+
dsw/command_queue/build_info.py,sha256=w8nwDy6OgBsURxJyQJ0vHJ4d0e7kFCpoggvm8hiEkGk,381
|
|
3
|
+
dsw/command_queue/command_queue.py,sha256=T21w63tQ5__0oLtME0RlM1KItXH2SIm1mXmdyTSgo_M,9016
|
|
4
|
+
dsw/command_queue/query.py,sha256=lF4xu1l64Yzx5rkSLUooq1UAkDA04aHacehpsPteRz8,2364
|
|
5
|
+
dsw_command_queue-4.22.1.dist-info/licenses/LICENSE,sha256=rDtJ4LdsXvf_euOpGD0Q86P78K4JyM5m4yfYz9wZ750,11346
|
|
6
|
+
dsw_command_queue-4.22.1.dist-info/METADATA,sha256=0Pqy_dZ21MkoeFKVYmKGeeIR2RWkvYX5XJ6Gp9oX7M8,1971
|
|
7
|
+
dsw_command_queue-4.22.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
8
|
+
dsw_command_queue-4.22.1.dist-info/top_level.txt,sha256=7SfbsHFoJ_vlAgG6C-xzETETwYO71dBrGnod8uMFnjw,4
|
|
9
|
+
dsw_command_queue-4.22.1.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
dsw/command_queue/__init__.py,sha256=153BhwEbazTo33P4r7w8MdGHpODhvzrhL6u7fwDMaQc,136
|
|
2
|
-
dsw/command_queue/build_info.py,sha256=toKrUjIKl-X8rANQeO9aA4KHWyRm4cGzBJQkUY9P2-Y,381
|
|
3
|
-
dsw/command_queue/command_queue.py,sha256=xBR-oomDgenf42cUVjD0S4vLYqkPFfPrcH5mFrgWMMg,9221
|
|
4
|
-
dsw/command_queue/query.py,sha256=Aqbr18bHEujz1IU6-rYxWgXG4N3_AJwZI7ojl3F894E,2364
|
|
5
|
-
dsw_command_queue-4.21.0.dist-info/licenses/LICENSE,sha256=rDtJ4LdsXvf_euOpGD0Q86P78K4JyM5m4yfYz9wZ750,11346
|
|
6
|
-
dsw_command_queue-4.21.0.dist-info/METADATA,sha256=6Ho_RiNidZNpz9VlK8yhf-F_kxD4DseiLmld2ksFX0Y,1971
|
|
7
|
-
dsw_command_queue-4.21.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
8
|
-
dsw_command_queue-4.21.0.dist-info/top_level.txt,sha256=7SfbsHFoJ_vlAgG6C-xzETETwYO71dBrGnod8uMFnjw,4
|
|
9
|
-
dsw_command_queue-4.21.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|