From 2446283ad3cad2209c4016eac2579e4822bc7420 Mon Sep 17 00:00:00 2001 From: --local Date: Mon, 30 May 2022 15:54:18 +0200 Subject: [PATCH 1/2] Fixed output file ids, using DB id now --- remotescripts/models.py | 8 ++++---- remotescripts/templates/remotescripts/remote.html | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/remotescripts/models.py b/remotescripts/models.py index 3dd363b3..92616fc9 100644 --- a/remotescripts/models.py +++ b/remotescripts/models.py @@ -280,15 +280,15 @@ def execute(self, *args, **kwargs) -> int: ) # Get output files from remote machine - for i, f in enumerate(output_files): - localpath = os.path.join(tempfile.gettempdir(), f[1]) - remotepath = os.path.join(f[0].directory, f[1]) + for f_db, f_remote in output_files: + localpath = os.path.join(tempfile.gettempdir(), f_remote) + remotepath = os.path.join(f_db.directory, f_remote) logger.info(f"Copying remote file '{remotepath}' to '{localpath}'") ftp.get( remotepath=remotepath, localpath=localpath, ) - self.on_new_output_file(i, localpath) + self.on_new_output_file(f_db.id, localpath) ftp.close() ssh.close() return exit_status diff --git a/remotescripts/templates/remotescripts/remote.html b/remotescripts/templates/remotescripts/remote.html index 3f648e36..9daf6bd2 100644 --- a/remotescripts/templates/remotescripts/remote.html +++ b/remotescripts/templates/remotescripts/remote.html @@ -50,7 +50,7 @@
Script arguments
{{ output_file.filename_regex }}
- +
{% endfor %} @@ -86,7 +86,7 @@
{{ output_file.filename_regex }}
for(var key of Object.keys(data['message'])){ if (key.startsWith('file')) { - var file_id = Number(key.substring(key.indexOf('file') + 4)) + 1; + var file_id = Number(key.substring(key.indexOf('file') + 4)); img_div = document.getElementById(`output-img-${file_id}`); img_div.src = `data:image/png;base64,${data['message'][key]}` } From 357c8e4f59b7c84c0940931cc378c3686c2663a9 Mon Sep 17 00:00:00 2001 From: --local Date: Mon, 30 May 2022 16:03:04 +0200 Subject: [PATCH 2/2] Restore old trackermaps view --- cablingmap/templates/cablingmap/cablingmap.html | 9 +++++++++ dqmhelper/settings.py | 2 +- home/templates/home/home.html | 7 ++++--- remotescripts/urls.py | 3 +++ remotescripts/views.py | 12 ++++++------ 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/cablingmap/templates/cablingmap/cablingmap.html b/cablingmap/templates/cablingmap/cablingmap.html index e558384a..adf6c049 100644 --- a/cablingmap/templates/cablingmap/cablingmap.html +++ b/cablingmap/templates/cablingmap/cablingmap.html @@ -32,6 +32,15 @@

Strip Detector

+
+
+

Remote tools

+
+ Card image cap +
+

Tools running on remote machines

+
+
diff --git a/dqmhelper/settings.py b/dqmhelper/settings.py index e18d6b1c..95e15a7b 100644 --- a/dqmhelper/settings.py +++ b/dqmhelper/settings.py @@ -19,7 +19,7 @@ messages.ERROR: "danger", } # Version to display in order to keep track of changes -CERTHELPER_VERSION = "1.5.0" +CERTHELPER_VERSION = "1.5.1" # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) diff --git a/home/templates/home/home.html b/home/templates/home/home.html index d0ee219f..374bc6ee 100644 --- a/home/templates/home/home.html +++ b/home/templates/home/home.html @@ -103,15 +103,16 @@

Cabling Map & DCS Trend

-
+
-

Remote tools

+

Tracker Maps

Card image cap
-

Tools running on remote machines

+

Generate tracker maps

+ {% endif %}
{% else %} diff --git a/remotescripts/urls.py b/remotescripts/urls.py index cb18216a..f3c2f13c 100644 --- a/remotescripts/urls.py +++ b/remotescripts/urls.py @@ -5,4 +5,7 @@ urlpatterns = [ path("remote/list/", views.RemoteScriptListView.as_view(), name="list"), path("remote//", views.RemoteScriptView.as_view(), name="detail"), + path( + "trackermaps_standalone/", views.TrackerMapsView.as_view(), name="trackermaps" + ), ] diff --git a/remotescripts/views.py b/remotescripts/views.py index 647b544f..00c00528 100644 --- a/remotescripts/views.py +++ b/remotescripts/views.py @@ -196,12 +196,12 @@ def run_tracker_maps(self, run_type: str, run_number_list: list) -> bool: Function that connects to vocms066 using the env-supplied username/password and executes the script to generate specific tracker maps. """ - # tracker_maps_command = ( - # "cd /data/users/event_display/ShiftRun3/TkMapGeneration/CMS* &&" - # " bash /data/users/event_display/ShiftRun3/TkMapGeneration/tkmapsFromCertHelper.sh" - # f" {str(run_type)} {''.join(str(run_number)+' ' for run_number in run_number_list)}" - # ) - tracker_maps_command = TEST_BASH_SCRIPT + tracker_maps_command = ( + "cd /data/users/event_display/ShiftRun3/TkMapGeneration/CMS* &&" + " bash /data/users/event_display/ShiftRun3/TkMapGeneration/tkmapsFromCertHelper.sh" + f" {str(run_type)} {''.join(str(run_number)+' ' for run_number in run_number_list)}" + ) + # tracker_maps_command = TEST_BASH_SCRIPT channel_layer = get_channel_layer()