Skip to content

Commit d1b409e

Browse files
committed
Add logging to import logic in dm_control/_render/__init__.py
PiperOrigin-RevId: 258344886
1 parent db37d50 commit d1b409e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

dm_control/_render/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import collections
2626
import os
2727

28+
from absl import logging
2829
from dm_control._render import constants
2930

3031
BACKEND = os.environ.get(constants.MUJOCO_GL)
@@ -61,18 +62,25 @@ def _import_osmesa():
6162
raise RuntimeError(
6263
'Environment variable {} must be one of {!r}: got {!r}.'
6364
.format(constants.MUJOCO_GL, _ALL_RENDERERS.keys(), BACKEND))
65+
logging.info('MUJOCO_GL=%s, attempting to import specified OpenGL backend.',
66+
BACKEND)
6467
Renderer = import_func() # pylint: disable=invalid-name
6568
else:
69+
logging.info('MUJOCO_GL is not set, so an OpenGL backend will be chosen '
70+
'automatically.')
6671
# Otherwise try importing them in descending order of priority until
6772
# successful.
6873
for name, import_func in _ALL_RENDERERS.items():
6974
try:
7075
Renderer = import_func()
7176
BACKEND = name
77+
logging.info('Successfully imported OpenGL backend: %s', name)
7278
break
7379
except ImportError:
74-
pass
80+
logging.info('Failed to import OpenGL backend: %s', name)
7581
if BACKEND is None:
82+
logging.info('No OpenGL backend could be imported. Attempting to create a '
83+
'rendering context will result in a RuntimeError.')
7684

7785
def Renderer(*args, **kwargs): # pylint: disable=function-redefined,invalid-name
7886
del args, kwargs

0 commit comments

Comments
 (0)