|  |  | @ -134,10 +134,16 @@ class Uploader(object): | 
			
		
	
		
		
			
				
					
					|  |  |  |       total_size += os.stat(fn).st_size |  |  |  |       total_size += os.stat(fn).st_size | 
			
		
	
		
		
			
				
					
					|  |  |  |     return dict(name_counts), total_size |  |  |  |     return dict(name_counts), total_size | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   def next_file_to_compress(self): | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     for name, key, fn in self.gen_upload_files(): | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       if name == "rlog": | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return (key, fn, 0) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return None | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   def next_file_to_upload(self, with_video): |  |  |  |   def next_file_to_upload(self, with_video): | 
			
		
	
		
		
			
				
					
					|  |  |  |     # try to upload log files first |  |  |  |     # try to upload log files first | 
			
		
	
		
		
			
				
					
					|  |  |  |     for name, key, fn in self.gen_upload_files(): |  |  |  |     for name, key, fn in self.gen_upload_files(): | 
			
		
	
		
		
			
				
					
					|  |  |  |       if name in ["rlog", "rlog.bz2"]: |  |  |  |       if name  == "rlog.bz2": | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         return (key, fn, 0) |  |  |  |         return (key, fn, 0) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     if with_video: |  |  |  |     if with_video: | 
			
		
	
	
		
		
			
				
					|  |  | @ -208,7 +214,7 @@ class Uploader(object): | 
			
		
	
		
		
			
				
					
					|  |  |  |     raise_on_thread(thread, SystemExit) |  |  |  |     raise_on_thread(thread, SystemExit) | 
			
		
	
		
		
			
				
					
					|  |  |  |     thread.join() |  |  |  |     thread.join() | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   def upload(self, key, fn): |  |  |  |   def compress(self, key, fn): | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     # write out the bz2 compress |  |  |  |     # write out the bz2 compress | 
			
		
	
		
		
			
				
					
					|  |  |  |     if fn.endswith("log"): |  |  |  |     if fn.endswith("log"): | 
			
		
	
		
		
			
				
					
					|  |  |  |       ext = ".bz2" |  |  |  |       ext = ".bz2" | 
			
		
	
	
		
		
			
				
					|  |  | @ -221,6 +227,9 @@ class Uploader(object): | 
			
		
	
		
		
			
				
					
					|  |  |  |       key += ext |  |  |  |       key += ext | 
			
		
	
		
		
			
				
					
					|  |  |  |       fn += ext |  |  |  |       fn += ext | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return (key, fn) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   def upload(self, key, fn): | 
			
		
	
		
		
			
				
					
					|  |  |  |     try: |  |  |  |     try: | 
			
		
	
		
		
			
				
					
					|  |  |  |       sz = os.path.getsize(fn) |  |  |  |       sz = os.path.getsize(fn) | 
			
		
	
		
		
			
				
					
					|  |  |  |     except OSError: |  |  |  |     except OSError: | 
			
		
	
	
		
		
			
				
					|  |  | @ -275,6 +284,12 @@ def uploader_fn(exit_event): | 
			
		
	
		
		
			
				
					
					|  |  |  |     if exit_event.is_set(): |  |  |  |     if exit_event.is_set(): | 
			
		
	
		
		
			
				
					
					|  |  |  |       return |  |  |  |       return | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     d = uploader.next_file_to_compress() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if d is not None: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       key, fn, _ = d | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       uploader.compress(key, fn) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       continue | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     if not should_upload: |  |  |  |     if not should_upload: | 
			
		
	
		
		
			
				
					
					|  |  |  |       time.sleep(5) |  |  |  |       time.sleep(5) | 
			
		
	
		
		
			
				
					
					|  |  |  |       continue |  |  |  |       continue | 
			
		
	
	
		
		
			
				
					|  |  | 
 |