Leader election for the cloudify cosmo project