valohai / valohai-utils

Python helper library for Valohai
MIT License
2 stars 2 forks source link

valohai-utils logger to print deployment metrics correctly #55

Closed JuhaKiili closed 1 year ago

JuhaKiili commented 3 years ago

With valohai-utils:

logger.log("x", 0.54)
logger.log("y", 0.12)
logger.flush_logs()

The output is:

{"x": 0.54, "y": 0.12}

But in deployment you'd want:

{"vh_metadata": {"x": 0.54, "y": 0.12}}

In the short-term, the logger should look for existence of VALOHAI_PORT env var or /valohai/valohai-metadata.json to figure out that it is in deployment and print the metrics accordingly.

In the long-term a VALOHAI_DEPLOYMENT should be injected into the container for this purpose.