MCPcopy Create free account
hub / github.com/mlco2/codecarbon / show_config

Function show_config

codecarbon/cli/main.py:70–107  ·  view source on GitHub ↗
(path: Path = Path("./.codecarbon.config"))

Source from the content-addressed store, hash-verified

68
69
70def show_config(path: Path = Path("./.codecarbon.config")) -> None:
71 d = get_config(path)
72 print("Current configuration : \n")
73 print("Config file content : ")
74 print(d)
75 try:
76 api_endpoint = get_api_endpoint(path)
77 api = ApiClient(endpoint_url=api_endpoint)
78 api.set_access_token(get_access_token())
79 if "organization_id" not in d:
80 print(
81 "No organization_id in config, follow setup instruction to complete your configuration file!",
82 )
83 else:
84 org = api.get_organization(d["organization_id"])
85
86 if "project_id" not in d:
87 print(
88 "No project_id in config, follow setup instruction to complete your configuration file!",
89 )
90 else:
91 project = api.get_project(d["project_id"])
92 if "experiment_id" not in d:
93 print(
94 "No experiment_id in config, follow setup instruction to complete your configuration file!",
95 )
96 else:
97 experiment = api.get_experiment(d["experiment_id"])
98 print("\nExperiment :")
99 print(experiment)
100 print("\nProject :")
101 print(project)
102 print("\nOrganization :")
103 print(org)
104 except Exception as e:
105 print(
106 f"[yellow]Could not validate remote configuration details[/yellow]. You can continue with local configuration setup. (error: {e})"
107 )
108
109
110@codecarbon.command(

Callers 1

configFunction · 0.85

Calls 8

set_access_tokenMethod · 0.95
get_organizationMethod · 0.95
get_projectMethod · 0.95
get_experimentMethod · 0.95
get_configFunction · 0.90
get_api_endpointFunction · 0.90
ApiClientClass · 0.90
get_access_tokenFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…