Skip to content

Commit

Permalink
small edits
Browse files Browse the repository at this point in the history
  • Loading branch information
backmari committed Jan 7, 2025
1 parent be6c462 commit fbac362
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
9 changes: 5 additions & 4 deletions src/webmon_app/reporting/report/view_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import datetime
import string
import re
import requests
import hashlib
import requests
from reporting.report.models import (
DataRun,
RunStatus,
Expand Down Expand Up @@ -510,11 +510,12 @@ def get_plot_template_dict(run_object=None, instrument=None, run_id=None):
"plot_label_x": "",
"plot_label_y": "",
"update_url": None,
"key": generate_key(instrument, run_id),
}

url_template = string.Template(settings.LIVE_DATA_SERVER)
live_data_url = url_template.substitute(instrument=instrument, run_number=run_id)
live_data_url = "https://%s:%s%s" % (
live_data_url = "https://{}:{}{}".format(
settings.LIVE_DATA_SERVER_DOMAIN,
settings.LIVE_DATA_SERVER_PORT,
live_data_url,
Expand All @@ -524,7 +525,7 @@ def get_plot_template_dict(run_object=None, instrument=None, run_id=None):
html_data = get_plot_data_from_server(instrument, run_id, "html")
if html_data is not None:
plot_dict["html_data"] = html_data
plot_dict["update_url"] = append_key("%s/html/" % live_data_url, instrument, run_id)
plot_dict["update_url"] = append_key(live_data_url + "/html/", instrument, run_id)
if extract_ascii_from_div(html_data) is not None:
plot_dict["data_url"] = reverse("report:download_reduced_data", args=[instrument, run_id])
return plot_dict
Expand All @@ -534,7 +535,7 @@ def get_plot_template_dict(run_object=None, instrument=None, run_id=None):

# Third, local json data for the d3 plots
if json_data:
plot_dict["update_url"] = append_key("%s/json/" % live_data_url, instrument, run_id)
plot_dict["update_url"] = append_key(live_data_url + "/json/", instrument, run_id)

plot_data, x_label, y_label = extract_d3_data_from_json(json_data)
if plot_data is not None:
Expand Down
5 changes: 0 additions & 5 deletions src/webmon_app/reporting/tests/test_report/test_view_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
from reporting.report.models import WorkflowSummary
from reporting.report.models import StatusQueueMessageCount

import os
import json
from reporting import dasmon, report, reporting_app
import httplib2

_ = [dasmon, report, reporting_app, os, httplib2]


class ViewUtilTest(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_livedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def send_request(self, task, run_number, requestType):
return response.text

def test_reduction_request_livedata(self):
key = generate_key(self.instrument, self.run_number)
ssl_crt_filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../nginx/nginx.crt")

key = generate_key(self.instrument, self.run_number)
# first check that the there isn't an existing plot, should 404
response = requests.get(
f"{LIVEDATA_TEST_URL}/plots/{self.instrument}/{self.run_number}/update/html/?key={key}",
Expand Down

0 comments on commit fbac362

Please sign in to comment.