From 5c724c258cd4dd05627bf90050c095037f516837 Mon Sep 17 00:00:00 2001 From: Tatiana Korchuganova Date: Fri, 31 May 2024 11:54:29 +0200 Subject: [PATCH 1/2] core | supporting plug out extra modules for other experiments via env var --- core/dashboards/templates/EventService.html | 4 +- .../templates/JobSummaryRegion.html | 8 +-- .../templates/DataTapeCarouselle.html | 4 +- core/libs/task.py | 5 +- core/settings/base.py | 51 ++++++++------- core/templates/_base_core.html | 63 +++++++++++-------- core/templates/core-mainPage.html | 24 +++---- core/templates/jobInfo.html | 10 +-- core/templates/jobInfoES.html | 8 +-- core/templates/jobList.html | 2 +- core/templates/jobListES.html | 2 +- core/templates/siteInfo.html | 2 +- core/templates/taskInfo.html | 4 +- core/templates/taskInfoESNew.html | 6 +- core/templates/taskList.html | 2 +- core/views.py | 9 ++- 16 files changed, 110 insertions(+), 94 deletions(-) diff --git a/core/dashboards/templates/EventService.html b/core/dashboards/templates/EventService.html index 771afd0e..54763017 100644 --- a/core/dashboards/templates/EventService.html +++ b/core/dashboards/templates/EventService.html @@ -861,14 +861,14 @@ newWinGrafana = window.open('', title + ', built at' + tmstp, strFeatures); if (!newWinGrafana.opener) {newWinGrafana.opener = window; } if (montype === 'jaccounting') { - newWinGrafana.document.write('

'); + newWinGrafana.document.write('

'); } else { newWinGrafana.document.write(""); newWinGrafana.document.write(""); newWinGrafana.document.write(""+ title +""); newWinGrafana.document.write(""); - newWinGrafana.document.write('Loading image...

'); + newWinGrafana.document.write('Loading image...

'); newWinGrafana.document.write('Jobs monitoring dashboard'); newWinGrafana.document.write('

'); newWinGrafana.document.write(''); diff --git a/core/dashboards/templates/JobSummaryRegion.html b/core/dashboards/templates/JobSummaryRegion.html index 42e99347..1db4c0de 100644 --- a/core/dashboards/templates/JobSummaryRegion.html +++ b/core/dashboards/templates/JobSummaryRegion.html @@ -1116,7 +1116,7 @@ sDefaultContent: "---", className: "num", render: function(data, type, row, meta) { - return '' + row[8] + ''; + return '' + row[8] + ''; } }, { @@ -1128,7 +1128,7 @@ (row[21] !== 0) ? diffpct = (row[9] - row[21])*100./row[21] : diffpct = 0; if (diffpct > 20) {cellstr += 'alert';} else if (diffpct > 10) {cellstr += 'warning';} - cellstr += '" href = "{% url 'harvesterWorkerList' %}?hours=12&status=running&computingsite=' + row[0] + '">' + row[9] + ''; + cellstr += '" href = "/harvester/workers/?hours=12&status=running&computingsite=' + row[0] + '">' + row[9] + ''; return cellstr } }, @@ -1387,14 +1387,14 @@ newWinGrafana = window.open('', title + ', built at' + tmstp, strFeatures); if (!newWinGrafana.opener) {newWinGrafana.opener = window; } if (montype === 'jaccounting') { - newWinGrafana.document.write('

'); + newWinGrafana.document.write('

'); } else { newWinGrafana.document.write(""); newWinGrafana.document.write(""); newWinGrafana.document.write(""+ title +""); newWinGrafana.document.write(""); - newWinGrafana.document.write('Loading image...

'); + newWinGrafana.document.write('Loading image...

'); newWinGrafana.document.write('Jobs monitoring dashboard'); newWinGrafana.document.write('

'); newWinGrafana.document.write(''); diff --git a/core/datacarousel/templates/DataTapeCarouselle.html b/core/datacarousel/templates/DataTapeCarouselle.html index 40d6ff0b..c61289d9 100644 --- a/core/datacarousel/templates/DataTapeCarouselle.html +++ b/core/datacarousel/templates/DataTapeCarouselle.html @@ -85,7 +85,7 @@ {$ x.source_rse $} - + @@ -641,7 +641,7 @@ className: 'text icons1', "render": function(data, type, full, meta) { let entry = ''+full['taskid']+' '; - entry += ''; + entry += ''; return entry; }, }, diff --git a/core/libs/task.py b/core/libs/task.py index 48d5dc3e..78eee42b 100644 --- a/core/libs/task.py +++ b/core/libs/task.py @@ -13,7 +13,7 @@ from core.common.models import JediDatasetContents, JediDatasets, JediTaskparams, JediDatasetLocality, JediTasks, \ JediJobRetryHistory from core.pandajob.models import Jobsactive4, Jobsarchived, Jobswaiting4, Jobsdefined4, Jobsarchived4 -from core.iDDS.utils import add_idds_info_to_tasks + from core.libs.exlib import insert_to_temp_table, get_tmp_table_name, round_to_n_digits, convert_sec from core.libs.datetimestrings import parse_datetime @@ -58,7 +58,7 @@ def cleanTaskList(tasks, **kwargs): add_datasets_info = True if 'sortby' in kwargs: sortby = kwargs['sortby'] - if 'add_idds_info' in kwargs: + if 'add_idds_info' in kwargs and 'core.iDDS' in settings.INSTALLED_APPS: add_idds_info = kwargs['add_idds_info'] else: add_idds_info = False @@ -142,6 +142,7 @@ def cleanTaskList(tasks, **kwargs): # check if tasks are part of idds and get workflow id if add_idds_info: + from core.iDDS.utils import add_idds_info_to_tasks tasks = add_idds_info_to_tasks(tasks) if sortby is not None: diff --git a/core/settings/base.py b/core/settings/base.py index 6dd2eea8..2a7b9212 100644 --- a/core/settings/base.py +++ b/core/settings/base.py @@ -125,32 +125,35 @@ INSTALLED_APPS_BIGPANDAMON_CORE = ( # BigPanDAmon core - 'core.oauth', - 'core.common', - 'core.pandajob', - 'core.schedresource', - 'core.dashboards', - 'core.status_summary', + "core.oauth", + "core.common", + "core.pandajob", + "core.schedresource", + "core.dashboards", + "core.status_summary", + "core.harvester", + "core.filebrowser", ) -INSTALLED_APPS_EXTRA = [ - # "core.admin", - "core.art", - "core.buildmonitor", - "core.compare", - "core.datacarousel", - "core.errorsscattering", - "core.filebrowser", - "core.globalshares", - "core.grafana", - "core.harvester", - "core.iDDS", - "core.mlflowdynamic", - "core.reports", - "core.runningprod", - "core.panda_client", - "core.kafka" -] +if 'BIGMON_INSTALLED_APPS_LIST' in os.environ and os.environ['BIGMON_INSTALLED_APPS_LIST']: + INSTALLED_APPS_EXTRA = os.environ['BIGMON_INSTALLED_APPS_LIST'].split(',') +else: + INSTALLED_APPS_EXTRA = [ + # "core.admin", + "core.art", + "core.buildmonitor", + "core.compare", + "core.datacarousel", + "core.errorsscattering", + "core.globalshares", + "core.grafana", + "core.iDDS", + "core.mlflowdynamic", + "core.reports", + "core.runningprod", + "core.panda_client", + "core.kafka" + ] CHANNEL_LAYERS = { "default": { diff --git a/core/templates/_base_core.html b/core/templates/_base_core.html index 341bed0d..9892ea67 100644 --- a/core/templates/_base_core.html +++ b/core/templates/_base_core.html @@ -94,7 +94,9 @@

  • Dash @@ -213,15 +225,16 @@
  • - -
  • - Harvester - -
  • + {% if 'installed_apps' in request.session and 'core.harvester' in request.session.installed_apps %} +
  • + Harvester + +
  • + {% endif %}
  • My BigPanDA @@ -317,8 +330,8 @@