KEMBAR78
application: on plugin load failure, log and continue by wchargin · Pull Request #3486 · tensorflow/tensorboard · GitHub
Skip to content

Conversation

@wchargin
Copy link
Contributor

@wchargin wchargin commented Apr 6, 2020

Summary:
Prior to this change, any exception raised from loader.load() would
crash TensorBoard (see, e.g., #3484). As of this patch, we log an error,
drop the plugin, and continue loading.

Test Plan:
Run bazel run //tensorboard -- --logdir /tmp/logs in a virtualenv with
tensorboard-plugin-wit==1.6.0.post3 but without the patch in #3485
(i.e., run git revert e59e9c4f376a). Note that TensorBoard now prints:

E0406 11:00:39.494363 140089282381632 application.py:260] Failed to load plugin WhatIfToolPluginLoader.load; ignoring it.
Traceback (most recent call last):
  File ".../tensorboard/backend/application.py", line 255, in TensorBoardWSGIApp
    plugin = loader.load(context)
  File "/VIRTUAL_ENV/lib/python3.7/site-packages/tensorboard_plugin_wit/wit_plugin_loader.py", line 51, in load
    version = pkg_resources.parse_version(tensorboard.__version__)
AttributeError: module 'tensorboard' has no attribute '__version__'
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.3.0a0 at http://localhost:6006/ (Press CTRL+C to quit)

wchargin-branch: application-load-failure-robustness

Summary:
Prior to this change, any exception raised from `loader.load()` would
crash TensorBoard (see, e.g., #3484). As of this patch, we log an error,
drop the plugin, and continue loading.

Test Plan:
Run `bazel run //tensorboard -- --logdir /tmp/logs` in a virtualenv with
`tensorboard-plugin-wit==1.6.0.post3` but *without* the patch in #3485.
Note that TensorBoard now prints:

```
E0406 09:57:12.844471 139872056727360 application.py:260] Failed to invoke plugin loader WhatIfToolPluginLoader.load
Traceback (most recent call last):
  File ".../tensorboard/backend/application.py", line 255, in TensorBoardWSGIApp
    plugin = loader.load(context)
  File "/VIRTUAL_ENV/lib/python3.7/site-packages/tensorboard_plugin_wit/wit_plugin_loader.py", line 51, in load
    version = pkg_resources.parse_version(tensorboard.__version__)
AttributeError: module 'tensorboard' has no attribute '__version__'
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.3.0a0 at http://localhost:6006/ (Press CTRL+C to quit)
```

wchargin-branch: application-load-failure-robustness
@wchargin
Copy link
Contributor Author

wchargin commented Apr 6, 2020

The PY2AND3PY3 change is safe, because there are no
Google-internal Python 2 binaries that depend on this target.

plugin = loader.load(context)
except Exception:
logger.error(
"Failed to invoke plugin loader %s",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be user visible error string? Not sure how much user cares about "invoking plugin loader". I think it should say something like "Failed to load plugin %s and ignoring it".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it’s user-facing, and you’re right, it should be improved. Took
your wording; thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It’s slightly awkward because the actual plugin name is given by the
result of load, so all we have is the qualname of the loader itself,
but hopefully “WhatIfToolPluginLoader.load” is clear enough.)

wchargin added 2 commits April 6, 2020 11:01
wchargin-branch: application-load-failure-robustness
wchargin-source: 368ea5aaa168d2972631207ea3740443cbbf1a43
wchargin-branch: application-load-failure-robustness
wchargin-source: 368ea5aaa168d2972631207ea3740443cbbf1a43
@wchargin wchargin merged commit e8826d8 into master Apr 6, 2020
@wchargin wchargin deleted the wchargin-application-load-failure-robustness branch April 6, 2020 18:21
bileschi pushed a commit to bileschi/tensorboard that referenced this pull request Apr 15, 2020
Summary:
Prior to this change, any exception raised from `loader.load()` would
crash TensorBoard (see, e.g., tensorflow#3484). As of this patch, we log an error,
drop the plugin, and continue loading.

Test Plan:
Run `bazel run //tensorboard -- --logdir /tmp/logs` in a virtualenv with
`tensorboard-plugin-wit==1.6.0.post3` but *without* the patch in tensorflow#3485
(i.e., run `git revert e59e9c4`). Note that TensorBoard now prints:

```
E0406 11:00:39.494363 140089282381632 application.py:260] Failed to load plugin WhatIfToolPluginLoader.load; ignoring it.
Traceback (most recent call last):
  File ".../tensorboard/backend/application.py", line 255, in TensorBoardWSGIApp
    plugin = loader.load(context)
  File "/VIRTUAL_ENV/lib/python3.7/site-packages/tensorboard_plugin_wit/wit_plugin_loader.py", line 51, in load
    version = pkg_resources.parse_version(tensorboard.__version__)
AttributeError: module 'tensorboard' has no attribute '__version__'
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.3.0a0 at http://localhost:6006/ (Press CTRL+C to quit)
```

wchargin-branch: application-load-failure-robustness
bileschi pushed a commit that referenced this pull request Apr 15, 2020
Summary:
Prior to this change, any exception raised from `loader.load()` would
crash TensorBoard (see, e.g., #3484). As of this patch, we log an error,
drop the plugin, and continue loading.

Test Plan:
Run `bazel run //tensorboard -- --logdir /tmp/logs` in a virtualenv with
`tensorboard-plugin-wit==1.6.0.post3` but *without* the patch in #3485
(i.e., run `git revert e59e9c4`). Note that TensorBoard now prints:

```
E0406 11:00:39.494363 140089282381632 application.py:260] Failed to load plugin WhatIfToolPluginLoader.load; ignoring it.
Traceback (most recent call last):
  File ".../tensorboard/backend/application.py", line 255, in TensorBoardWSGIApp
    plugin = loader.load(context)
  File "/VIRTUAL_ENV/lib/python3.7/site-packages/tensorboard_plugin_wit/wit_plugin_loader.py", line 51, in load
    version = pkg_resources.parse_version(tensorboard.__version__)
AttributeError: module 'tensorboard' has no attribute '__version__'
Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all
TensorBoard 2.3.0a0 at http://localhost:6006/ (Press CTRL+C to quit)
```

wchargin-branch: application-load-failure-robustness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants