Skip to content

Commit

Permalink
Orca cleanup (#767)
Browse files Browse the repository at this point in the history
* whatsnew

* remove orca test fixtures, notes, cli command
  • Loading branch information
lboeman authored Dec 10, 2021
1 parent 1b99ad2 commit 47b5aef
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 30 deletions.
22 changes: 22 additions & 0 deletions docs/source/whatsnew/1.0.11.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. _whatsnew_1011:

.. py:currentmodule:: solarforecastarbiter
1.0.11 (December 13, 2021)
--------------------------

Enhancements
~~~~~~~~~~~~
* Updated Plotly version to 4.9 which uses Kaleido for pdf plot
rendering. Use of Kaleido removes the need for starting an Orca
server when generating reports and is available as a pip installable
package with no other dependencies. This update also improves
performance and reliability of the report computation process.
(:pull:`765`)

Contributors
~~~~~~~~~~~~

* Will Holmgren (:ghuser:`wholmgren`)
* Leland Boeman (:ghuser:`lboeman`)
1 change: 1 addition & 0 deletions docs/source/whatsnew/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ These are new features and improvements of note in each release.
.. toctree::
:maxdepth: 2

1.0.11
1.0.10
1.0.9
1.0.8
Expand Down
10 changes: 1 addition & 9 deletions solarforecastarbiter/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,12 @@ def referencenwp(verbose, user, password, base_url, run_time,
'--serialization-roundtrip', is_flag=True,
help='Run the raw report through a mock API with serialization'
)
@click.option(
'--orca-server-url', help=(
'URL to the plotly orca server to generate PDF images if '
'orca is not installed locally')
)
@click.argument(
'report-file', type=click.Path(exists=True, resolve_path=True))
@click.argument(
'output-file', type=click.Path(resolve_path=True))
def report(verbose, user, password, base_url, report_file, output_file,
format, serialization_roundtrip, orca_server_url):
format, serialization_roundtrip):
"""
Make a report. See API documentation's POST reports section for
REPORT_FILE requirements.
Expand All @@ -468,9 +463,6 @@ def report(verbose, user, password, base_url, report_file, output_file,
metadata = json.load(f)
session = APISession(token, base_url=base_url)
report = session.process_report_dict(metadata)
if orca_server_url is not None:
import plotly.io as pio
pio.orca.config.server_url = orca_server_url
if serialization_roundtrip:
with mock_raw_report_endpoints(base_url):
session.create_report(report)
Expand Down
7 changes: 0 additions & 7 deletions solarforecastarbiter/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3843,13 +3843,6 @@ def raw_report_dict_with_prob(fail_pdf):
}


@pytest.fixture(scope='function')
def remove_orca():
# otherwise generating all pdfs for tests can take ages
import plotly.io as pio
pio.orca.config.executable = '/dev/null'


@pytest.fixture()
def constant_cost():
return datamodel.ConstantCost(
Expand Down
12 changes: 0 additions & 12 deletions solarforecastarbiter/reports/figures/plotly_figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,12 +1120,6 @@ def output_svg(fig):
Returns
-------
svg : str
Notes
-----
Requires `Orca <https://plot.ly/python/orca-management/>`_ for generating
svgs. If orca is not installed, an svg with an error message will be
returned.
"""
try:
svg = fig.to_image(format='svg').decode('utf-8')
Expand Down Expand Up @@ -1157,12 +1151,6 @@ def output_pdf(fig):
-------
pdf : str
An ASCII-85 encoded PDF
Notes
-----
Requires `Orca <https://plot.ly/python/orca-management/>`_ for generating
pdfs. If orca is not installed, an pdf with an error message will be
returned.
"""
# If height is explicitly set on the plot, remove it before generating
# a pdf. Needs to be reset at the end of the function.
Expand Down
4 changes: 2 additions & 2 deletions solarforecastarbiter/reports/tests/test_reports_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


@pytest.fixture()
def _test_data(report_objects, ref_forecast_id, remove_orca):
def _test_data(report_objects, ref_forecast_id):
report, observation, forecast_0, forecast_1, aggregate, forecast_agg = \
report_objects
base = Path(__file__).resolve().parent
Expand Down Expand Up @@ -82,7 +82,7 @@ def test_get_data_for_report(mock_data, report_objects, mocker):


@pytest.fixture()
def _test_event_data(event_report_objects, remove_orca):
def _test_event_data(event_report_objects):
report, observation, forecast_0, forecast_1 = event_report_objects

tz = "US/Pacific"
Expand Down

0 comments on commit 47b5aef

Please sign in to comment.