Skip to content
Snippets Groups Projects

Project Setup

To clone this repo use the command:

$ git clone https://gitlab.rc.uab.edu/mmoo97/flask_user_reg.git

Prerequisites

###Clone Repository

$ git checkout version-1b-local-rabbitmq
$ cd ~/your/repo/path/flask_user_reg
$ source venv/bin/activate
$ pip install -r requirements.txt
  • Note, to install flask in your own $HOME use pip install --user Flask.

RabbitMQ

(Reference Tutorial Part Four)

  • Install RabbitMQ server on the host machine. (Tutorials here.)
    • Additionally, if on a Mac, it is recommended that you add the following line to your .bash_profile:
      export PATH=$PATH:/usr/local/opt/rabbitmq/sbin.
  • Run the command $ rabbitmq-server. (Note, this implementation assumes RabbitMQ is running on localhost on standard port 5672)

Test RabbitMQ

For a simple example on the functionality of RabbitMQ, do the following:

  • Open 4 separate terminal sessions whilst in the flask_user_reg directory and enter one of the following commands per window:
# Run in First 
$ python ohpc_consumer.py

# Run in Second
$ python ood_consumer.py

# Run in Third 
$ python message_manager.py
  • You will notice that the scripts are all awaiting a message to be sent to them.
  • To produce a message run the following in the forth terminal session:
# Run in Forth Window
$ python test_producer.py
  • Notice that the producer sends only to the specified ood and ohpc consumers and not to the message_manager consumer.
    • Note, that the test_producer.py script is identical to the code within the ingest_data() function in run.py.