From 02aed5a191be5c0bf9a02b5036e0c0ca639521eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <amuoz@ed.ac.uk>
Date: Sat, 18 Dec 2021 15:07:37 +0000
Subject: [PATCH] pass server info as kwarg

---
 aliby/io/omero.py | 8 ++++----
 aliby/pipeline.py | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/aliby/io/omero.py b/aliby/io/omero.py
index 266d7d16..d9677af2 100644
--- a/aliby/io/omero.py
+++ b/aliby/io/omero.py
@@ -31,8 +31,8 @@ class Argo:
 
 
 class Dataset(Argo):
-    def __init__(self, expt_id):
-        super().__init__()
+    def __init__(self, expt_id, **server_info):
+        super().__init__(**server_info)
         self.expt_id = expt_id
         self._files = None
 
@@ -87,8 +87,8 @@ class Dataset(Argo):
 
 
 class Image(Argo):
-    def __init__(self, image_id):
-        super().__init__()
+    def __init__(self, image_id, **server_info):
+        super().__init__(**server_info)
         self.image_id = image_id
         self._image_wrap = None
 
diff --git a/aliby/pipeline.py b/aliby/pipeline.py
index 7d0c3158..73cd003e 100644
--- a/aliby/pipeline.py
+++ b/aliby/pipeline.py
@@ -57,7 +57,7 @@ class PipelineParameters(ParametersABC):
         """
         expt_id = general.get("expt_id", 19993)
         directory = Path(general.get("directory", "../data"))
-        with Dataset(int(expt_id)) as conn:
+        with Dataset(int(expt_id), **general.get("server_info")) as conn:
             directory = directory / conn.unique_name
             if not directory.exists():
                 directory.mkdir(parents=True)
@@ -132,7 +132,7 @@ class Pipeline(ProcessABC):
 
         print("Searching OMERO")
         # Do all initialis
-        with Dataset(int(expt_id)) as conn:
+        with Dataset(int(expt_id), **self.general["server_info"]) as conn:
             image_ids = conn.get_images()
             directory = root_dir / conn.unique_name
             if not directory.exists():
@@ -165,7 +165,7 @@ class Pipeline(ProcessABC):
         earlystop = general_config["earlystop"]
         try:
             directory = general_config["directory"]
-            with Image(image_id) as image:
+            with Image(image_id, **self.general['server_info']) as image:
                 filename = f"{directory}/{image.name}.h5"
                 try:
                     os.remove(filename)
-- 
GitLab