1313import requests
1414import psutil
1515from simvue .config .user import SimvueConfiguration
16-
1716import simvue .api .objects
1817from simvue .api .objects .artifact .base import ArtifactBase
1918from simvue .eco .emissions_monitor import CO2Monitor
3736_logger = logging .getLogger (__name__ )
3837
3938
40- def _log_upload_failed (file_path ):
41- with open (file_path , "r" ) as file :
39+ def _log_upload_failed (file_path : pydantic .FilePath ) -> None :
40+ """Record that an object failed to upload in the object offline cache file.
41+
42+ Parameters
43+ ----------
44+ file_path : pydantic.FilePath
45+ The path to the offline cache file for the object
46+ """
47+ with file_path .open ("r" ) as file :
4248 _data = json .load (file )
4349 _data ["upload_failed" ] = True
44- with open (file_path , "w" ) as file :
50+ with file_path . open ("w" ) as file :
4551 json .dump (_data , file )
4652
4753
@@ -52,7 +58,7 @@ def upload_cached_file(
5258 id_mapping : dict [str , str ],
5359 retry_failed_uploads : bool ,
5460 lock : threading .Lock ,
55- ):
61+ ) -> None :
5662 """Upload data stored in a cached file to the Simvue server.
5763
5864 Parameters
@@ -228,12 +234,12 @@ def sender(
228234 if len (_offline_files ) < threading_threshold :
229235 for file_path in _offline_files :
230236 upload_cached_file (
231- cache_dir ,
232- _obj_type ,
233- file_path ,
234- _id_mapping ,
235- retry_failed_uploads ,
236- _lock ,
237+ cache_dir = cache_dir ,
238+ obj_type = _obj_type ,
239+ file_path = file_path ,
240+ id_mapping = _id_mapping ,
241+ retry_failed_uploads = retry_failed_uploads ,
242+ lock = _lock ,
237243 )
238244 else :
239245 with ThreadPoolExecutor (
0 commit comments