mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1.01k stars 158 forks source link

help codecarbon monitor no output file #405

Closed HishamAbulfeilat closed 1 year ago

HishamAbulfeilat commented 1 year ago

Description

when I run cmd command codecarbon monitor , it used to save output to csv file but now it doesn't save output anympre

I am also using intel powerlog to monitor CPU updated: Apparently this happens when I use powerlog , I think powerlog changes codecarbon output

What I Did

codecarbon init
codecarbon monitor
inimaz commented 1 year ago

Could you share your config file? If you have no config file, then your emissions file will be generated into ./emissions.csv

If you wish to specify a different directory or file one needs to pass along the params output_dir and output_file. So maybe you can set this config file to force the directory to be wherever you want.

See https://mlco2.github.io/codecarbon/usage.html#configuration for more info.

Hope this helps.

HishamAbulfeilat commented 1 year ago

[codecarbon] experiment_id = c1c6b800-bf60-4fce-b753-6f12b29b4ee5 measure_power_secs=5 log_level = DEBUG

HishamAbulfeilat commented 1 year ago

my apologies for the late response, however, it seems the problem is from after updating intel power log

HishamAbulfeilat commented 1 year ago

i am using powershell to run codecarbon monitor

however, I get this which I don't understand

[codecarbon DEBUG @ 11:33:17] Not running on AWS, couldn't retrieve metadata: ConnectionError(MaxRetryError("HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /latest/dynamic/instance-identity/document (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000219FBBE6C80>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host'))")) [codecarbon DEBUG @ 11:33:17] Not running on Azure, couldn't retrieve metadata: ConnectionError(MaxRetryError("HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /metadata/instance?api-version=2019-08-15 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000219FBBE7610>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host'))")) [codecarbon DEBUG @ 11:33:17] Not running on GCP, couldn't retrieve metadata: ConnectionError(MaxRetryError("HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/?recursive=true&alt=json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000219FBBE7F10>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host'))")) [codecarbon INFO @ 11:33:18] ApiClient Successfully registered your run on the API.

Can you please elaborate? thanks

HishamAbulfeilat commented 1 year ago

It seems the issue was resolved when I used save_to_filer=True where it saves in the emissions.csv file however, it saves only 1 row but can I run it and make it log every 10 sec so I can have multiple rows with multiple emissions it seems that the tracking method = machine measures the carbon emission and saves it to file when I quit the loop.

HishamAbulfeilat commented 1 year ago

I am sorry for asking to many times and disturbing you, I appreciate your help

benoit-cty commented 1 year ago

Hello, When you use codecarbon monitor it will initialize the CodeCarbon API to send you data to http://dashboard.codecarbon.io/ That's the best way to have data every 10 seconds. We write into CSV only at the end. You can force output to CSV by a call to flush() at each time you want to write into it.

benoit-cty commented 1 year ago

i am using powershell to run codecarbon monitor

however, I get this which I don't understand

[codecarbon DEBUG @ 11:33:17] Not running on AWS, couldn't retrieve metadata: ConnectionError(MaxRetryError("HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /latest/dynamic/instance-identity/document (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000219FBBE6C80>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host'))")) [codecarbon DEBUG @ 11:33:17] Not running on Azure, couldn't retrieve metadata: ConnectionError(MaxRetryError("HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /metadata/instance?api-version=2019-08-15 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000219FBBE7610>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host'))")) [codecarbon DEBUG @ 11:33:17] Not running on GCP, couldn't retrieve metadata: ConnectionError(MaxRetryError("HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /computeMetadata/v1/instance/?recursive=true&alt=json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000219FBBE7F10>: Failed to establish a new connection: [WinError 10065] A socket operation was attempted to an unreachable host'))")) [codecarbon INFO @ 11:33:18] ApiClient Successfully registered your run on the API.

Can you please elaborate? thanks

This is just debug trace to explain why we think you are not running in a cloud environment. These errors are expected.

HishamAbulfeilat commented 1 year ago

thanks