oc-cdtapi 3.17.1__py3-none-any.whl → 3.18.1__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.
oc_cdtapi/PgQAPI.py CHANGED
@@ -102,7 +102,7 @@ class PgQAPI (object):
102
102
  def get_msg(self, message_id):
103
103
  logging.debug('reached get_msg')
104
104
  logging.debug('getting status of message [%s]' % message_id)
105
- ds = self.exec_select('select status, payload from queue_message where id = %s', (str(message_id) ) )
105
+ ds = self.exec_select('select status, payload from queue_message where id = %s', (str(message_id), ) )
106
106
  if ds:
107
107
  logging.debug('message found, returning [%s]', ds[0])
108
108
  return ds[0]
@@ -140,6 +140,7 @@ class PgQAPI (object):
140
140
  return None
141
141
 
142
142
  def msg_proc_start(self, message_id):
143
+ # TODO add consumer ip
143
144
  logging.debug('reached msg_proc_start')
144
145
  logging.debug('starting processing of message [%s]' % message_id)
145
146
  ds = self.get_msg(message_id)
@@ -151,6 +152,35 @@ class PgQAPI (object):
151
152
  logging.error('message [%s] is in bad status [%s]' % (str(message_id), msg_status) )
152
153
  return False
153
154
  self.exec_update('update queue_message set proc_start=now(), status=%s where id = %s', ('A', message_id) )
155
+ logging.debug('returning payload [%s]' % payload)
156
+ return payload
157
+
158
+ def msg_proc_end(self, message_id, error_message=None, comment_text=None):
159
+ logging.debug('reached msg_proc_end')
160
+ logging.debug('ending processing of message [%s]' % message_id)
161
+ ds = self.get_msg(message_id)
162
+ if not ds:
163
+ logging.error('message [%s] does not exist' % message_id)
164
+ return None
165
+ (msg_status, payload) = ds
166
+ if msg_status != 'A':
167
+ logging.error('message [%s] is in bad status [%s]' % (str(message_id), msg_status) )
168
+ return False
169
+ self.exec_update('update queue_message set proc_end=now(), status=%s, error_message=%s, comment_text=%s where id = %s', ('P', error_message, comment_text, message_id) )
170
+ return payload
171
+
172
+ def msg_proc_fail(self, message_id, error_message=None, comment_text=None):
173
+ logging.debug('reached msg_proc_fail')
174
+ logging.debug('failing processing of message [%s]' % message_id)
175
+ ds = self.get_msg(message_id)
176
+ if not ds:
177
+ logging.error('message [%s] does not exist' % message_id)
178
+ return None
179
+ (msg_status, payload) = ds
180
+ if msg_status != 'A':
181
+ logging.error('message [%s] is in bad status [%s]' % (str(message_id), msg_status) )
182
+ return False
183
+ self.exec_update('update queue_message set proc_end=now(), status=%s, error_message=%s, comment_text=%s where id = %s', ('F', error_message, comment_text, message_id) )
154
184
  return payload
155
185
 
156
186
  def msg_proc_end(self, message_id):
@@ -194,6 +224,9 @@ class PgQAPI (object):
194
224
  return None
195
225
  msg_id = ds[0][0]
196
226
  logging.debug('found new message id [%s], [%s] new messages in queue' % (msg_id, ds[0][1]) )
227
+ logging.debug('requesting payload from msg_proc_start')
197
228
  payload = self.msg_proc_start(msg_id)
198
- return payload, msg_id
229
+ logging.debug('msg_proc_start returned [%s]' % payload)
230
+ logging.debug('returning payload [%s] with msg_id [%s]' % (payload, msg_id) )
231
+ return payload,msg_id
199
232
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oc-cdtapi
3
- Version: 3.17.1
3
+ Version: 3.18.1
4
4
  Summary: Custom Development python API libraries
5
5
  License: Apache2.0
6
6
  Requires-Python: >=3.6
@@ -6,13 +6,13 @@ oc_cdtapi/DmsGetverAPI.py,sha256=ZPU4HlF59fngKu5mSFhtss3rlBuduffDOSm_y3XWrxk,155
6
6
  oc_cdtapi/ForemanAPI.py,sha256=9r1MSOsubiSxM1sdzF2MHD7IcSwX9Y4UDJknHqQK07g,44255
7
7
  oc_cdtapi/JenkinsAPI.py,sha256=lZ8pe3a4eb_6h53JE7QLuzOSlu7Sqatc9PQwWhio9Vg,15748
8
8
  oc_cdtapi/NexusAPI.py,sha256=uU12GtHvKlWorFaPAnFcQ5AGEc94MZ5SdmfM2Pw3F7A,26122
9
- oc_cdtapi/PgQAPI.py,sha256=rQxO6N_e1l_ACaAgE0MA1WLHlWypdw6igy942ly6uRo,8151
9
+ oc_cdtapi/PgQAPI.py,sha256=ttAUCX_ghmugu35DEXEIWB5GPnRNaUFuz7YgK2jnrMk,9929
10
10
  oc_cdtapi/RundeckAPI.py,sha256=O3LmcFaHSz8UqeUyIHTTEMJncDD191Utd-iZaeJay2s,24243
11
11
  oc_cdtapi/TestServer.py,sha256=HV97UWg2IK4gOYAp9yaMdwFUWsw9v66MxyZdI3qQctA,2715
12
12
  oc_cdtapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- oc_cdtapi-3.17.1.data/scripts/nexus.py,sha256=4teqZ_KtCSrwHDJVgA7lkreteod4Xt5XJFZNbwb7E6E,6858
14
- oc_cdtapi-3.17.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
- oc_cdtapi-3.17.1.dist-info/METADATA,sha256=_ro_PynB_h1s9PQiutS6kmaKQU5UY5OA3uWSsJnLa-c,484
16
- oc_cdtapi-3.17.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
17
- oc_cdtapi-3.17.1.dist-info/top_level.txt,sha256=d4-5-D-0CSeSXYuLCP7-nIFCpjkfmJr-Y_muzds8iVU,10
18
- oc_cdtapi-3.17.1.dist-info/RECORD,,
13
+ oc_cdtapi-3.18.1.data/scripts/nexus.py,sha256=4teqZ_KtCSrwHDJVgA7lkreteod4Xt5XJFZNbwb7E6E,6858
14
+ oc_cdtapi-3.18.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
+ oc_cdtapi-3.18.1.dist-info/METADATA,sha256=gP-hKZ7BXfFlYYRgZsF2_ZPV690_Awi01Vfa-b9T7hE,484
16
+ oc_cdtapi-3.18.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
17
+ oc_cdtapi-3.18.1.dist-info/top_level.txt,sha256=d4-5-D-0CSeSXYuLCP7-nIFCpjkfmJr-Y_muzds8iVU,10
18
+ oc_cdtapi-3.18.1.dist-info/RECORD,,