From 71b30bdcb4cf6c7c0ce44fc09d00c8ba03bcae92 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Thu, 30 Nov 2023 11:02:24 +0100
Subject: [PATCH] TMSS-2836: added method get_stations. added option to get
 slimmed-down version of scheduling unit

---
 SAS/TMSS/client/lib/tmss_http_rest_client.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/SAS/TMSS/client/lib/tmss_http_rest_client.py b/SAS/TMSS/client/lib/tmss_http_rest_client.py
index 92ce074dc55..aa7b17b90d6 100644
--- a/SAS/TMSS/client/lib/tmss_http_rest_client.py
+++ b/SAS/TMSS/client/lib/tmss_http_rest_client.py
@@ -691,11 +691,12 @@ class TMSSsession(object):
             scheduling_unit['specifications_doc'] = self.get_schedulingunit_draft_specifications_doc(scheduling_unit_draft_id)
         return scheduling_unit
 
-    def get_schedulingunit_blueprint(self, scheduling_unit_blueprint_id: str, extended: bool=True, include_specifications_doc: bool=False) -> dict:
+    def get_schedulingunit_blueprint(self, scheduling_unit_blueprint_id: str, extended: bool=False, slim: bool=False, include_specifications_doc: bool=False) -> dict:
         '''get the schedulingunit_blueprint as dict for the given scheduling_unit_blueprint_id.
         When extended==True then you get the full scheduling_unit,task,subtask tree.
+        When slim==True then you get a slimmed-down version of the scheduling_unit with the most relevant info.
         When include_specifications_doc==True then an exported/generated spcifications_doc is included representing the task graph and its settings.'''
-        scheduling_unit = self.get_path_as_json_object('scheduling_unit_blueprint%s/%s' % ('_extended' if extended else '', scheduling_unit_blueprint_id))
+        scheduling_unit = self.get_path_as_json_object('scheduling_unit_blueprint%s/%s' % ('_extended' if extended else '_slim' if slim else '', scheduling_unit_blueprint_id))
         if include_specifications_doc:
             scheduling_unit['specifications_doc'] = self.get_schedulingunit_blueprint_specifications_doc(scheduling_unit_blueprint_id)
         return scheduling_unit
@@ -900,3 +901,9 @@ class TMSSsession(object):
         returns the new sibling scheduling_unit_blueprint upon success, or raises."""
         return self.post_to_path_and_get_result_as_json_object('scheduling_unit_blueprint/%s/create_lofar2_sibling' % (scheduling_unit_blueprint_id),
                                                                retry_count=retry_count)
+
+    def get_stations(self, retry_count: int=DEFAULT_RETRY_COUNT) -> {}:
+        '''get a dict of all lofar stations and their properties (currently only lat/long and version)'''
+        return self.get_path_as_json_object('/util/stations', retry_count=retry_count)
+
+
-- 
GitLab