Skip to content

Commit

Permalink
fix exeption flow
Browse files Browse the repository at this point in the history
Removed a catch clause that probably wasn't doing anything and
probably wans't needed.

Fixed a variable error that crept in from cut and paste.

Fixed grouping so that basic_ack and worker=None were at the right
level in the main cleanup loop.
  • Loading branch information
craigsteffen committed Aug 13, 2024
1 parent edf9dcd commit 62202b9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions downloader/CM_B_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ def run(self):
for model_to_process in CDR_model_list:
self.output_model_list.append(model_to_process)

except RequestException as e:
logging.exception(f"Request Error {response.text}.")
self.exception = e
# except RequestException as e:
# logging.exception(f"Request Error {response.text}.")
# self.exception = e
except Exception as e:
logging.exception("Error processing pipeline request.")
logging.exception("Error processing download .")
self.exception = e


Expand Down Expand Up @@ -346,8 +346,8 @@ def main(argv):
my_output_dictionary = worker.output_message_dictionary

if worker.exception:
error_data['exception'] = repr(worker.exception)
channel.basic_publish(exchange='', routing_key=download_error_queue, body=json.dumps(error_data), properties=worker.properties)
my_output_dictionary['exception'] = repr(worker.exception)
channel.basic_publish(exchange='', routing_key=download_error_queue, body=json.dumps(my_output_dictionary), properties=worker.properties)
else:
# send a process message for each model in the list
for model_to_process in my_model_list:
Expand All @@ -360,8 +360,8 @@ def main(argv):
channel.queue_declare(queue=my_process_queue, durable=True)
properties = pika.BasicProperties(delivery_mode=pika.DeliveryMode.Persistent)
channel.basic_publish(exchange='', routing_key=my_process_queue, body=outgoing_message, properties=properties)
channel.basic_ack(delivery_tag=worker.method.delivery_tag)
worker = None
channel.basic_ack(delivery_tag=worker.method.delivery_tag)
worker = None


print ("should never get here! Exiting!")
Expand Down

0 comments on commit 62202b9

Please sign in to comment.