Skip to content

Commit

Permalink
Merge pull request #195 from neutrons/remove_webref_link
Browse files Browse the repository at this point in the history
Remove link to webref from run page
  • Loading branch information
backmari authored Nov 19, 2024
2 parents 6dae8e1 + 15107b0 commit 5d250e6
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.webmonchow
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM continuumio/miniconda3:23.3.1-0
RUN conda install --yes -n base conda-libmamba-solver

# Install webmonchow
RUN conda install --yes --solver=libmamba -n base -c conda-forge -c neutrons postgresql=14 webmonchow=1.0.1
RUN conda install --yes --solver=libmamba -n base -c conda-forge -c neutrons/label/rc postgresql=14 webmonchow=1.0.2rc1

# Install webmonchow from a feature branch (only to test the latest changes in webmonchow)
# RUN conda install --yes --solver=libmamba -n base -c conda-forge postgresql=14
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ services:
dockerfile: Dockerfile.webmon
volumes:
- web-static:/var/www/workflow/static/
- ./nginx/nginx.crt:/nginx.crt
# add in folder to be picked up by update-ca-certificates in docker entrypoint
- ./nginx/nginx.crt:/usr/local/share/ca-certificates/nginx.crt
env_file:
- .env
- .env.ci
Expand All @@ -39,8 +40,9 @@ services:
- CATALOG_URL=${CATALOG_URL}
- CATALOG_ID=${CATALOG_ID}
- CATALOG_SECRET=${CATALOG_SECRET}
- CATALOG_API_TOKEN=${CATALOG_API_TOKEN}
- GUNICORN_CMD_ARGS=--reload --workers=8
- REQUESTS_CA_BUNDLE=/nginx.crt
- REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8000/ht || exit 1
interval: 60s
Expand Down
2 changes: 2 additions & 0 deletions src/webmon_app/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ if [[ "$DJANGO_SETTINGS_MODULE" != *".prod" ]]; then
>&2 echo "Not in Production, setting up test users InstrumentScientist, and GeneralUser"
python $MANAGE_PY_WEBMON ensure_adminuser --username="InstrumentScientist" --email='[email protected]' --password="InstrumentScientist"
python $MANAGE_PY_WEBMON ensure_user --username="${GENERAL_USER_USERNAME}" --email='[email protected]' --password="${GENERAL_USER_PASSWORD}"
>&2 echo "Not in Production, updating certificates to add self-signed certificate"
update-ca-certificates
fi

# start up web-service
Expand Down
10 changes: 1 addition & 9 deletions src/webmon_app/reporting/report/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,7 @@ def _get_run_info(instrument, ipts, run_number, facility="SNS"):
"""
run_info = {}
try:
oncat = pyoncat.ONCat(
settings.CATALOG_URL,
# Here we're using the machine-to-machine "Client Credentials" flow,
# which requires a client ID and secret, but no *user* credentials.
flow=pyoncat.CLIENT_CREDENTIALS_FLOW,
client_id=settings.CATALOG_ID,
client_secret=settings.CATALOG_SECRET,
)
oncat.login()
oncat = pyoncat.ONCat(settings.CATALOG_URL, api_token=settings.CATALOG_API_TOKEN)

datafiles = oncat.Datafile.list(
facility=facility,
Expand Down
8 changes: 0 additions & 8 deletions src/webmon_app/reporting/report/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys
import logging
import json
import string
import datetime
from django.http import HttpResponse, HttpResponseNotFound
from django.shortcuts import render, get_object_or_404
Expand Down Expand Up @@ -250,19 +249,12 @@ def detail(request, instrument, run_id):
except: # noqa: E722
prev_url = None

# Fitting URL
fitting_url = None
if hasattr(settings, "FITTING_URLS") and instrument.lower() in settings.FITTING_URLS:
url_template = string.Template(settings.FITTING_URLS[instrument.lower()])
fitting_url = url_template.substitute(run_number=run_id)

template_values = {
"instrument": instrument.upper(),
"run_object": run_object,
"status": status_objects,
"breadcrumbs": breadcrumbs,
"icat_info": icat_info,
"fitting_url": fitting_url,
"reduce_url": reduce_url,
"reduction_setup_url": reporting_view_util.reduction_setup_url(instrument),
"prev_url": prev_url,
Expand Down
5 changes: 1 addition & 4 deletions src/webmon_app/reporting/reporting_app/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def validate_ldap_settings(server_uri, user_dn_template):
CATALOG_URL = environ.get("CATALOG_URL")
CATALOG_ID = environ.get("CATALOG_ID")
CATALOG_SECRET = environ.get("CATALOG_SECRET")
CATALOG_API_TOKEN = environ.get("CATALOG_API_TOKEN")

# The DB settings are defined the same as in the workflow manager
DATABASES = {
Expand Down Expand Up @@ -365,10 +366,6 @@ def validate_ldap_settings(server_uri, user_dn_template):
for instr, facility in additions.items():
FACILITY_INFO[instr] = facility

# Link out to fitting application
FITTING_URLS = {}


# remote worker options
# setting these will force all execution to happen as a single user
TEST_REMOTE_USER = ""
Expand Down
2 changes: 0 additions & 2 deletions src/webmon_app/reporting/reporting_app/settings/envtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@
GENERAL_USER_USERNAME = environ.get("GENERAL_USER_USERNAME", "GeneralUser") # noqa: F405
GENERAL_USER_PASSWORD = environ.get("GENERAL_USER_PASSWORD", "GeneralUser") # noqa: F405

FITTING_URLS = {"ref_l": "https://reflectivity-test.ornl.gov/fit/ref_l/$run_number"}

validate_ldap_settings(server_uri=AUTH_LDAP_SERVER_URI, user_dn_template=AUTH_LDAP_USER_DN_TEMPLATE) # noqa: F405
2 changes: 0 additions & 2 deletions src/webmon_app/reporting/reporting_app/settings/prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = environ.get("DEBUG", False)

FITTING_URLS = {"ref_l": "https://reflectivity.sns.gov/fit/ref_l/$run_number"}

validate_ldap_settings(server_uri=AUTH_LDAP_SERVER_URI, user_dn_template=AUTH_LDAP_USER_DN_TEMPLATE) # noqa: F405
5 changes: 0 additions & 5 deletions src/webmon_app/reporting/templates/report/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@
<p>
{% endif %}

{% if fitting_url %}
<p>
<a href='{{ fitting_url }}' target="_blank">fit data</a> |
{% endif %}

{% if html_data %}
{% if data_url %}
Data access: <a href='{{ data_url }}'>download plot data points</a>
Expand Down
Empty file.
Empty file.
43 changes: 43 additions & 0 deletions tests/data/REF_L/shared/autoreduce/reduce_REF_L.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python
import os
import sys
from datetime import datetime
from postprocessing.publish_plot import publish_plot

plot_div = """
<div>
<div id="plot"></div>
<script>
// Layout configuration
// Render the plot
Plotly.newPlot('plot',
[
{
"x": [1, 2, 3, 4, 5],
"y": [10, 15, 13, 17, 20],
"type": 'scatter',
"mode": 'lines+markers',
"marker": { "color": 'red' }
}
],
{
"title": 'My First Plot',
"xaxis": { "title": 'X Axis Label' },
"yaxis": { "title": 'Y Axis Label' }
}
);
</script>
</div>
"""

if __name__ == "__main__":
time = datetime.isoformat(datetime.now())
filename = sys.argv[1]
print("Running reduction for " + filename + " at " + time)

publish_plot(
"REF_L",
os.path.basename(filename).split(".")[0].split("_")[-1],
files={"file": f"<div>{plot_div}</div>"},
)
Empty file.
Empty file.

0 comments on commit 5d250e6

Please sign in to comment.