Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme to include how to run examples with docker compose #73

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ repos:
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/ambv/black
rev: 22.6.0
hooks:
- id: black
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Brokerless task queue for python based on 0Mq
========================

* Configuring Environment Variables:
- WORKER_HOST=
- WORKER_PORT=
- WORKER_HOST         # The IP address to expose running workers on
- WORKER_PORT               # The port number workers should listen on

-- `If not set defaults to localhost:5690`

Expand Down Expand Up @@ -52,7 +52,51 @@ long_running_task.run(param="dowork")
- Fast
- Open source

### Using a container orchestration technology:

### Running Zebrok examples with docker compose
* First clone the repository using the command `git clone [email protected]:kaypee90/zebrok.git`
* Change directory into the zebrok directory and run `docker compose up` command to start the worker and publisher containers.
* Access the shell for the **worker** container and run the command `python examples/start.py` to start the workers.
* From a different terminal window, access the shell for the running **publisher** container and run the command `python examples/client.py` to queue 2 jobs to be processed.
* Once these commands are executed you should see 2 tasks processed successfully in the publisher terminal.


**Sample output:**
```
** 2 ZEBROK TASKS DISCOVERED!
=====================================================
* long_running_task_one
* long_running_task_two
=====================================================
2023-10-11 23:45:14,227 zebrok.discovery INFO:** 2 ZEBROK TASKS DISCOVERED!
=====================================================
* long_running_task_one
* long_running_task_two
=====================================================
starting worker on: tcp://172.21.0.3:5691
2023-10-11 23:45:14,236 zebrok.worker INFO:starting worker on: tcp://172.21.0.3:5691
starting worker on: tcp://172.21.0.3:5692
2023-10-11 23:45:14,237 zebrok.worker INFO:starting worker on: tcp://172.21.0.3:5692
starting worker on: tcp://172.21.0.3:5693
starting worker on: tcp://172.21.0.3:5690
2023-10-11 23:45:14,238 zebrok.worker INFO:starting worker on: tcp://172.21.0.3:5693
2023-10-11 23:45:14,238 zebrok.worker INFO:starting worker on: tcp://172.21.0.3:5690
sending task to slave worker
2023-10-11 23:48:07,297 zebrok.worker INFO:sending task to slave worker
sending task to slave worker
received task: long_running_task_one
2023-10-11 23:48:07,299 zebrok.worker INFO:sending task to slave worker
2023-10-11 23:48:07,299 zebrok.worker INFO:received task: long_running_task_one
received task: long_running_task_two
2023-10-11 23:48:07,300 zebrok.worker INFO:received task: long_running_task_two
Sent mail to, [email protected]
Hello, Kay Pee
DONE!!!
DONE!!!
```


### Using a container orchestration technology (like Kubernetes):
- `number_of_slaves` must always be set to 0, then you can spin a number of replicas for the workers.
- `WORKER_HOST`Environment variable for a worker must always be `*`
- `WORKER_HOST` Environment variable for a worker must always be `*`

Loading