From dbf5aae883d7dd48fb6cc32aa25e429bb3d09721 Mon Sep 17 00:00:00 2001
From: alaskowski <alaskowski@ethz.ch>
Date: Wed, 2 Aug 2023 12:52:53 +0200
Subject: [PATCH] SSDM-13689: fixes to object-search, performance improvements,
 OBIS 0.4.2rc7

---
 .../src/python/obis/__init__.py                   |  2 +-
 .../src/python/obis/dm/commands/search.py         | 15 +++++++--------
 app-openbis-command-line/src/python/setup.py      |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/app-openbis-command-line/src/python/obis/__init__.py b/app-openbis-command-line/src/python/obis/__init__.py
index 6d545ea634c..abd8a4890fa 100644
--- a/app-openbis-command-line/src/python/obis/__init__.py
+++ b/app-openbis-command-line/src/python/obis/__init__.py
@@ -14,6 +14,6 @@
 #
 __author__ = "ID SIS • ETH Zürich"
 __email__ = "openbis-support@id.ethz.ch"
-__version__ = "0.4.2rc7"
+__version__ = "0.4.2"
 
 from .dm import *
diff --git a/app-openbis-command-line/src/python/obis/dm/commands/search.py b/app-openbis-command-line/src/python/obis/dm/commands/search.py
index 3198164bd16..5f525bb8146 100644
--- a/app-openbis-command-line/src/python/obis/dm/commands/search.py
+++ b/app-openbis-command-line/src/python/obis/dm/commands/search.py
@@ -30,7 +30,8 @@ def _dfs(objects, prop, func, func_specific):
     with concurrent.futures.ThreadPoolExecutor(
             max_workers=5) as pool_simple, concurrent.futures.ThreadPoolExecutor(
         max_workers=20) as pool_full:
-        stack = [openbis_obj[prop] for openbis_obj in objects]  # datasets and samples provide children in different formats
+        stack = [openbis_obj[prop] for openbis_obj in
+                 objects]  # datasets and samples provide children in different formats
         visited = set()
         stack.reverse()
         output = []
@@ -180,10 +181,8 @@ class Search(OpenbisCommand):
         return self.openbis.get_samples(identifier, attrs=["children", "dataSets"])
 
     def _get_sample_with_datasets(self, identifier):
-        return self.openbis.get_sample(identifier, withDataSetIds=True)
-
-    def _get_sample_with_datasets2(self, identifier):
-        return self.openbis.get_sample(identifier, withDataSetIds=True, raw_response=True)
+        return self.openbis.get_sample(identifier, withDataSetIds=True, raw_response=True,
+                                       props=self.props)
 
     def _search_samples(self, raw_response=False):
         """Helper method to search samples"""
@@ -202,8 +201,8 @@ class Search(OpenbisCommand):
             results = self.openbis.get_samples(**args)
 
         if self.recursive:
-            click_echo(f"Recursive search enabled. It may take time to produce results.")
-            output2 = _dfs_samples(results['objects'], 'identifier', self._get_sample_with_datasets2)
+            click_echo("Recursive search enabled. It may take time to produce results.")
+            output2 = _dfs_samples(results['objects'], 'identifier', self._get_sample_with_datasets)
 
             search_results = output2
         else:
@@ -237,7 +236,7 @@ class Search(OpenbisCommand):
             datasets = [x["dataSets"] for x in search_results]
             datasets = flatten(datasets)
             datasets = [x['permId']['permId'] for x in datasets]
-            datasets = self.openbis.get_dataset(permIds=datasets)
+            datasets = self.openbis.get_dataset(permIds=datasets, props=self.props)
 
             filtered_datasets = []
             for dataset in datasets:
diff --git a/app-openbis-command-line/src/python/setup.py b/app-openbis-command-line/src/python/setup.py
index 993559aaf63..e6b3c06626f 100644
--- a/app-openbis-command-line/src/python/setup.py
+++ b/app-openbis-command-line/src/python/setup.py
@@ -31,7 +31,7 @@ data_files = [
 
 setup(
     name="obis",
-    version="0.4.2rc7",
+    version="0.4.2",
     description="Local data management with assistance from OpenBIS.",
     long_description=long_description,
     long_description_content_type="text/markdown",
-- 
GitLab