diff --git a/src/aliby/pipeline.py b/src/aliby/pipeline.py index 586453f6346f6d816dea9c8706645fcb17587f67..26e9b9dc92e24b9cdf731363ca5432ca702e52b2 100644 --- a/src/aliby/pipeline.py +++ b/src/aliby/pipeline.py @@ -75,7 +75,9 @@ class PipelineParameters(ParametersABC): directory = Path(general.get("directory", "../data")) - with dispatch_dataset(expt_id, **get_server_info(general)) as conn: + with dispatch_dataset( + expt_id, **general.get("server_info", {}) + ) as conn: directory = directory / conn.unique_name if not directory.exists(): directory.mkdir(parents=True) @@ -284,16 +286,17 @@ class Pipeline(ProcessABC): # Steps: all holds general tasks # steps: strain_name holds task for a given strain config = self.parameters.to_dict() - general = config["general"] - expt_id = general["id"] - distributed = general["distributed"] - pos_filter = general["filter"] - root_dir = Path(general["directory"]) + expt_id = config["general"]["id"] + distributed = config["general"]["distributed"] + pos_filter = config["general"]["filter"] + root_dir = Path(config["general"]["directory"]) print("Searching OMERO") # Do all all initialisations - with dispatch_dataset(expt_id, **get_server_info(general)) as conn: + with dispatch_dataset( + expt_id, **self.general.get("server_info", {}) + ) as conn: image_ids = conn.get_images() directory = self.store or root_dir / conn.unique_name @@ -306,7 +309,7 @@ class Pipeline(ProcessABC): # Modify to the configuration self.parameters.general["directory"] = str(directory) - general["directory"] = directory + config["general"]["directory"] = directory self.setLogger(directory) @@ -392,7 +395,7 @@ class Pipeline(ProcessABC): min_process_from = min(process_from.values()) with get_image_class(image_id)( - image_id, **get_server_info(self.general) + image_id, **self.general.get("server_info", {}) ) as image: # Initialise Steps @@ -646,7 +649,7 @@ class Pipeline(ProcessABC): trackers_state: t.List[np.ndarray] = [] with get_image_class(image_id)( - image_id, **get_server_info(general_config) + image_id, **self.general.get("server_info", {}) ) as image: filename = Path(f"{directory}/{image.name}.h5") meta = MetaData(directory, filename) @@ -721,11 +724,3 @@ class Pipeline(ProcessABC): def _close_session(session): if session: session.close() - - -def get_server_info(general: dict) -> t.Dict[str, int or str]: - return { - k: general[k] - for k in ("host", "username", "password") - if general.get(k) - }