-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme to include how to run examples with docker compose (#73)
* Add black to pre commit hooks * Update readme to include how to run examples with docker compose
- Loading branch information
Showing
2 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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` | ||
|
||
|
@@ -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 `*` | ||
|