Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def election_step(self, candidates_id, candidates_attribute):
- # If our id is the first id in the list
- # we have done the full circle and can choose a leader node
- if len(candidates_id) != 0 and candidates_id[0] == str(self.server_id):
- int_attrs = map(int, candidates_attribute)
- win_indx = int_attrs.index(max(int_attrs))
- self.leader = self.vessels[int(candidates_id[win_indx])]
- return None, self.leader
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement