Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #562 from DiamondLightSource/547_tidy_fake_zocalo
Browse files Browse the repository at this point in the history
Make sure fake zocalo, used for developer testing, is tidied up well
  • Loading branch information
DominicOram committed Mar 10, 2023
2 parents 42d011e + 03e29f9 commit c257cbe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion fake_zocalo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ def on_request(ch: BlockingChannel, method, props, body):
channel = conn.channel()
channel.basic_consume(queue="processing_recipe", on_message_callback=on_request)
print("Listening for zocalo requests")
channel.start_consuming()
try:
channel.start_consuming()
except KeyboardInterrupt:
print("Shutting down gracefully")
channel.close()


if __name__ == "__main__":
Expand Down
10 changes: 9 additions & 1 deletion fake_zocalo/dls_start_fake_zocalo.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/bash
function cleanup()
{
pkill -f rabbitmq
rm -rf /home/$USER/.zocalo/*
echo "May take some seconds for zocalo to die, do not immediately try and restart"
}

trap cleanup EXIT

# kills the gda dummy activemq, that takes the port for rabbitmq
module load dasctools
Expand All @@ -11,4 +19,4 @@ module load rabbitmq/dev
module load dials/latest

source .venv/bin/activate
python fake_zocalo/__main__.py
python fake_zocalo/__main__.py

0 comments on commit c257cbe

Please sign in to comment.