(path: Path = Path("./.codecarbon.config"))
| 68 | |
| 69 | |
| 70 | def 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( |
no test coverage detected
searching dependent graphs…