@@ -159,19 +159,19 @@ def __init__(
159
159
self ._data : dict [str , typing .Any ] = {}
160
160
self ._step : int = 0
161
161
self ._active : bool = False
162
- self ._config = SimvueConfiguration .fetch ()
162
+ self ._user_config = SimvueConfiguration .fetch ()
163
163
164
164
logging .getLogger (self .__class__ .__module__ ).setLevel (
165
165
logging .DEBUG
166
166
if (debug is not None and debug )
167
- or (debug is None and self ._config .client .debug )
167
+ or (debug is None and self ._user_config .client .debug )
168
168
else logging .INFO
169
169
)
170
170
171
171
self ._aborted : bool = False
172
172
self ._resources_metrics_interval : typing .Optional [int ] = HEARTBEAT_INTERVAL
173
173
self ._headers : dict [str , str ] = {
174
- "Authorization" : f"Bearer { self ._config .server .token } "
174
+ "Authorization" : f"Bearer { self ._user_config .server .token } "
175
175
}
176
176
self ._simvue : typing .Optional [SimvueBaseClass ] = None
177
177
self ._pid : typing .Optional [int ] = 0
@@ -313,7 +313,8 @@ def _create_heartbeat_callback(
313
313
self ,
314
314
) -> typing .Callable [[threading .Event ], None ]:
315
315
if (
316
- self ._mode == "online" and (not self ._config .server .url or not self ._id )
316
+ self ._mode == "online"
317
+ and (not self ._user_config .server .url or not self ._id )
317
318
) or not self ._heartbeat_termination_trigger :
318
319
raise RuntimeError ("Could not commence heartbeat, run not initialised" )
319
320
@@ -395,7 +396,7 @@ def _create_dispatch_callback(
395
396
if self ._mode == "online" and not self ._id :
396
397
raise RuntimeError ("Expected identifier for run" )
397
398
398
- if not self ._config .server .url :
399
+ if not self ._user_config .server .url :
399
400
raise RuntimeError ("Cannot commence dispatch, run not initialised" )
400
401
401
402
def _offline_dispatch_callback (
@@ -404,7 +405,7 @@ def _offline_dispatch_callback(
404
405
run_id : typing .Optional [str ] = self ._id ,
405
406
uuid : str = self ._uuid ,
406
407
) -> None :
407
- _offline_directory = self ._config .offline .cache
408
+ _offline_directory = self ._user_config .offline .cache
408
409
if not os .path .exists (_offline_directory ):
409
410
logger .error (
410
411
f"Cannot write to offline directory '{ _offline_directory } ', directory not found."
@@ -431,7 +432,7 @@ def _offline_dispatch_callback(
431
432
def _online_dispatch_callback (
432
433
buffer : list [typing .Any ],
433
434
category : str ,
434
- url : str = self ._config .server .url ,
435
+ url : str = self ._user_config .server .url ,
435
436
run_id : typing .Optional [str ] = self ._id ,
436
437
headers : dict [str , str ] = self ._headers ,
437
438
) -> None :
@@ -634,11 +635,11 @@ def init(
634
635
)
635
636
return True
636
637
637
- description = description or self ._config .run .description
638
- tags = (tags or []) + (self ._config .run .tags or [])
639
- folder = folder or self ._config .run .folder
640
- name = name or self ._config .run .name
641
- metadata = (metadata or {}) | (self ._config .run .metadata or {})
638
+ description = description or self ._user_config .run .description
639
+ tags = (tags or []) + (self ._user_config .run .tags or [])
640
+ folder = folder or self ._user_config .run .folder
641
+ name = name or self ._user_config .run .name
642
+ metadata = (metadata or {}) | (self ._user_config .run .metadata or {})
642
643
643
644
self ._term_color = not no_color
644
645
@@ -651,7 +652,7 @@ def init(
651
652
self ._error ("invalid mode specified, must be online, offline or disabled" )
652
653
return False
653
654
654
- if not self ._config .server .token or not self ._config .server .url :
655
+ if not self ._user_config .server .token or not self ._user_config .server .url :
655
656
self ._error (
656
657
"Unable to get URL and token from environment variables or config file"
657
658
)
@@ -707,7 +708,7 @@ def init(
707
708
name = self ._name ,
708
709
uniq_id = self ._uuid ,
709
710
mode = self ._mode ,
710
- config = self ._config ,
711
+ config = self ._user_config ,
711
712
suppress_errors = self ._suppress_errors ,
712
713
)
713
714
name , self ._id = self ._simvue .create_run (data )
@@ -730,7 +731,7 @@ def init(
730
731
fg = "green" if self ._term_color else None ,
731
732
)
732
733
click .secho (
733
- f"[simvue] Monitor in the UI at { self ._config .server .url } /dashboard/runs/run/{ self ._id } " ,
734
+ f"[simvue] Monitor in the UI at { self ._user_config .server .url } /dashboard/runs/run/{ self ._id } " ,
734
735
bold = self ._term_color ,
735
736
fg = "green" if self ._term_color else None ,
736
737
)
@@ -938,7 +939,7 @@ def reconnect(self, run_id: str) -> bool:
938
939
939
940
self ._id = run_id
940
941
self ._simvue = Simvue (
941
- self ._name , self ._id , self ._mode , self ._config , self ._suppress_errors
942
+ self ._name , self ._id , self ._mode , self ._user_config , self ._suppress_errors
942
943
)
943
944
self ._start (reconnect = True )
944
945
0 commit comments