Uploader speedup (#2214)
	
		
	
				
					
				
			* use caching for getxattr
* fix some git issues
* Scheduled network checks
* attempt optimization
* Delete speed_test.py
* Style fixes
* Fix styling
* fix spaces
* fix spaces
* fix naming
* Update uploader.py
* Update mark_all_uploaded.py
* Add file to release
* Update selfdrive/loggerd/tools/mark_all_uploaded.py
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: cf46de13d2
			
			
				vw-mqb-aeb
			
			
		
							parent
							
								
									e17440c9a7
								
							
						
					
					
						commit
						079f409e58
					
				
				 4 changed files with 38 additions and 8 deletions
			
			
		@ -0,0 +1,9 @@ | 
				
			||||
import os | 
				
			||||
from common.xattr import setxattr | 
				
			||||
from selfdrive.loggerd.uploader import UPLOAD_ATTR_NAME, UPLOAD_ATTR_VALUE | 
				
			||||
 | 
				
			||||
from selfdrive.loggerd.config import ROOT | 
				
			||||
for folder in os.walk(ROOT): | 
				
			||||
  for file1 in folder[2]: | 
				
			||||
    full_path = os.path.join(folder[0], file1) | 
				
			||||
    setxattr(full_path, UPLOAD_ATTR_NAME, UPLOAD_ATTR_VALUE) | 
				
			||||
@ -0,0 +1,13 @@ | 
				
			||||
from common.xattr import getxattr as getattr1 | 
				
			||||
from common.xattr import setxattr as setattr1 | 
				
			||||
 | 
				
			||||
cached_attributes = {} | 
				
			||||
def getxattr(path, attr_name): | 
				
			||||
  if (path, attr_name) not in cached_attributes: | 
				
			||||
    response = getattr1(path, attr_name) | 
				
			||||
    cached_attributes[(path, attr_name)] = response | 
				
			||||
  return cached_attributes[(path, attr_name)] | 
				
			||||
 | 
				
			||||
def setxattr(path, attr_name, attr_value): | 
				
			||||
  cached_attributes.pop((path, attr_name), None) | 
				
			||||
  return setattr1(path, attr_name, attr_value) | 
				
			||||
					Loading…
					
					
				
		Reference in new issue