simvue-io / python-api

Simvue Python API
https://docs.simvue.io
Apache License 2.0
4 stars 0 forks source link

Added codecarbon tracking to Simvue Run #508

Closed kzscisoft closed 1 month ago

kzscisoft commented 1 month ago

Uses Code Carbon to track emissions during a Simvue run, this can be disabled via the config method.

alahiff commented 1 month ago

The names of the metrics are possibly not compatible with the standard way "magic" metrics grouping works in the UI. By default the following will be grouped:

Does it make sense for deltas and totals to be displayed together?

Update: with the special Emissions page the above is not really an issue anymore.

alahiff commented 1 month ago

Is it possible to suppress this message to stdout?

[codecarbon WARNING @ 05:39:03] Multiple instances of codecarbon are allowed to run at the same time.

I also get this warning now when running the client:

/home/alahiff/.cache/pypoetry/virtualenvs/simvue-0vzJveOR-py3.10/lib/python3.10/site-packages/codecarbon/output_methods/file.py:52: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
  df = pd.concat([df, pd.DataFrame.from_records([dict(total.values)])])
alahiff commented 1 month ago

When running this for 180 seconds I only get a single set of codecarbon metrics at the very end. Is this expected?

kzscisoft commented 1 month ago

Is it possible to suppress this message to stdout?

[codecarbon WARNING @ 05:39:03] Multiple instances of codecarbon are allowed to run at the same time.

I also get this warning now when running the client:

/home/alahiff/.cache/pypoetry/virtualenvs/simvue-0vzJveOR-py3.10/lib/python3.10/site-packages/codecarbon/output_methods/file.py:52: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
  df = pd.concat([df, pd.DataFrame.from_records([dict(total.values)])])

I would need to see if it is possible to disable CC logging. As for the second that would be a fix to CC itself, my concern would be changing this would break it for older Python versions

AbyAbraham21 commented 1 month ago

"Keep emissions data off by default" - Why? I would assume you want it on by default?

kzscisoft commented 1 month ago

@AbyAbraham21 Due to the fact that setup is required on the host machine for the CC metrics to be valid and correct we should make the user accountable for their recording as opposed to it being our responsibility that their setup is correct. @alahiff and I agreed having these off by default made sense.

We will of course need to document enabling the feature.