File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -316,14 +316,17 @@ def monitor(
316316 api (Annotated[bool, typer.Option, optional): Choose to call Code Carbon API or not. Defaults to True.
317317 """
318318 experiment_id = get_existing_local_exp_id ()
319- if api and experiment_id is None :
320- print ("ERROR: No experiment id, call 'codecarbon init' first." , err = True )
319+ token = None
320+ if api :
321+ if experiment_id is None :
322+ print ("ERROR: No experiment id, call 'codecarbon init' first." , err = True )
323+ token = _get_access_token ()
321324 print ("CodeCarbon is going in an infinite loop to monitor this machine." )
322325 with EmissionsTracker (
323326 measure_power_secs = measure_power_secs ,
324327 api_call_interval = api_call_interval ,
325328 save_to_api = api ,
326- access_token = _get_access_token () ,
329+ access_token = token ,
327330 ) as tracker :
328331 # Infinite loop
329332 while True :
You can’t perform that action at this time.
0 commit comments