File: README.md

package info (click to toggle)
python-kubernetes 30.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 39,984 kB
  • sloc: python: 126,462; sh: 699; makefile: 46
file content (18 lines) | stat: -rw-r--r-- 835 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## Leader Election Example  
This example demonstrates how to use the leader election library.

## Running
Run the following command in multiple separate terminals preferably an odd number. 
Each running process uses a unique identifier displayed when it starts to run.

- When a program runs, if a lock object already exists with the specified name, 
all candidates will start as followers. 
- If a lock object does not exist with the specified name then whichever candidate 
creates a lock object first will become the leader and the rest will be followers.
- The user will be prompted about the status of the candidates and transitions. 

### Command to run
```python example.py```

Now kill the existing leader. You will see from the terminal outputs that one of the
 remaining running processes will be elected as the new leader.