Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
account_init_cleanup
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mitchell Moore
account_init_cleanup
Commits
6b1bf10f
Commit
6b1bf10f
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
Update readme
parent
45725d2c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+32
-0
32 additions, 0 deletions
README.md
test_producer.py
+20
-0
20 additions, 0 deletions
test_producer.py
with
52 additions
and
0 deletions
README.md
+
32
−
0
View file @
6b1bf10f
...
@@ -7,15 +7,47 @@ $ git clone https://gitlab.rc.uab.edu/mmoo97/flask_user_reg.git
...
@@ -7,15 +7,47 @@ $ git clone https://gitlab.rc.uab.edu/mmoo97/flask_user_reg.git
```
```
## Prerequisites
## Prerequisites
###Clone Repository
-
Ensure
`pip`
is installed (see: https://packaging.python.org/guides/installing-using-pip-and-virtualenv/ ).
-
Ensure
`pip`
is installed (see: https://packaging.python.org/guides/installing-using-pip-and-virtualenv/ ).
-
Ensure you have created a
[
virtual environment
](
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments
)
-
Ensure you have created a
[
virtual environment
](
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments
)
called
`venv`
setup within the cloned project.
called
`venv`
setup within the cloned project.
-
Note, this project requires a virtual environment running python2 (2.7)
-
Note, this project requires a virtual environment running python2 (2.7)
-
Ensure Flask and other dependencies are installed using the following commands:
-
Ensure Flask and other dependencies are installed using the following commands:
```
```
$ git checkout version-1b-local-rabbitmq
$ cd ~/your/repo/path/flask_user_reg
$ cd ~/your/repo/path/flask_user_reg
$ source venv/bin/activate
$ source venv/bin/activate
$ pip install -r requirements.txt
$ pip install -r requirements.txt
```
```
-
Note, to install flask in your own
`$HOME`
use
`pip install --user Flask`
.
-
Note, to install flask in your own
`$HOME`
use
`pip install --user Flask`
.
###RabbitMQ
-
Install RabbitMQ server on the host machine. (Tutorials
[
here
](
https://www.rabbitmq.com/download.html
)
.)
-
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`
.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test_producer.py
0 → 100644
+
20
−
0
View file @
6b1bf10f
import
pika
import
sys
# Begin RabbitMQ process.
connection
=
pika
.
BlockingConnection
(
pika
.
ConnectionParameters
(
host
=
'
localhost
'
))
channel
=
connection
.
channel
()
channel
.
exchange_declare
(
exchange
=
'
direct_logs
'
,
exchange_type
=
'
direct
'
)
message
=
"
Hey there
"
# todo: account info goes here
channel
.
basic_publish
(
exchange
=
'
direct_logs
'
,
routing_key
=
"
ohpc
"
,
body
=
message
)
print
(
"
[x] Sent %r:%r
"
%
(
"
ohpc
"
,
message
))
channel
.
basic_publish
(
exchange
=
'
direct_logs
'
,
routing_key
=
"
ood
"
,
body
=
message
)
print
(
"
[x] Sent %r:%r
"
%
(
"
ood
"
,
message
))
connection
.
close
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment