 fd730c42a3
			
		
	
	fd730c42a3
	
	
	
		
			
			It is great to ensure that the examples that tooz has actually run during testing time, so enable this as well as adjust the examples to create unique group ids and run for a limited amount of time instead of running forever (and fix a few other brokeness)... Change-Id: I573cf5946a1d3f13862c0c28cf3a5d7fc6178873
		
			
				
	
	
		
			23 lines
		
	
	
		
			501 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			501 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import uuid
 | |
| 
 | |
| import six
 | |
| 
 | |
| from tooz import coordination
 | |
| 
 | |
| coordinator = coordination.get_coordinator('kazoo://localhost', b'host-1')
 | |
| coordinator.start()
 | |
| 
 | |
| # Create a group
 | |
| group = six.binary_type(six.text_type(uuid.uuid4()).encode('ascii'))
 | |
| request = coordinator.create_group(group)
 | |
| request.get()
 | |
| 
 | |
| 
 | |
| def group_joined(event):
 | |
|     # Event is an instance of tooz.coordination.MemberJoinedGroup
 | |
|     print(event.group_id, event.member_id)
 | |
| 
 | |
| 
 | |
| coordinator.watch_join_group(group, group_joined)
 | |
| coordinator.stop()
 |