From c57bb1023cb150fedae24004f22d0d189da572fa Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Thu, 27 Dec 2018 08:58:45 -0500 Subject: [PATCH 1/2] Add orca_env context manage to clear and restore environment variables that interfere with the correct functioning of orca. --- plotly/io/_orca.py | 65 +++++++++++++++------- plotly/tests/test_orca/test_orca_server.py | 4 ++ plotly/tests/test_orca/test_to_image.py | 37 ++++++++++++ 3 files changed, 87 insertions(+), 19 deletions(-) diff --git a/plotly/io/_orca.py b/plotly/io/_orca.py index 95b7724631f..f0b5bc3a445 100644 --- a/plotly/io/_orca.py +++ b/plotly/io/_orca.py @@ -9,6 +9,7 @@ import threading import warnings from copy import copy +from contextlib import contextmanager import requests import retrying @@ -836,6 +837,36 @@ def __repr__(self): del OrcaStatus +@contextmanager +def orca_env(): + """ + Context manager to clear and restore environment variables that are + problematic for orca to function properly + + NODE_OPTIONS: When this variable is set, orca Date: Thu, 27 Dec 2018 09:03:06 -0500 Subject: [PATCH 2/2] Increase the orca request retry duration from 8s to 30s 8 seconds was arbitrary, and we've received reports that it is sometimes not long enough. So increasing to 30s. --- plotly/io/_orca.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly/io/_orca.py b/plotly/io/_orca.py index f0b5bc3a445..d51e5ed6b6d 100644 --- a/plotly/io/_orca.py +++ b/plotly/io/_orca.py @@ -1218,7 +1218,7 @@ def ensure_server(): orca_state['shutdown_timer'] = t -@retrying.retry(wait_random_min=5, wait_random_max=10, stop_max_delay=8000) +@retrying.retry(wait_random_min=5, wait_random_max=10, stop_max_delay=30000) def request_image_with_retrying(**kwargs): """ Helper method to perform an image request to a running orca server process