Election#

Election of which instance(s) is/are Runner or Backup_Runner

In a cluster or distributed system which has high fault tolerance, it must have some instances be the backup for the others. But how to decide which one(s) is/are Runner and which one(s) is/are Backup_Runner? This election module for handling the processing.

Common Modules#

Election Result#

class smoothcrawler_cluster.election.ElectionResult(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

The enum of election result

No matter which election strategy, they all must return the electing result outside to clear who is/are runner(s) and otherwise is/are loser(s).

WINNER = 'Winner'#

The winner of election for deciding who is/are runner(s).

LOSER = 'Loser'#

The loser of election for deciding who is/are backup of runner(s).

Below are all election strategies with different conditions for different scenarios: