Skip to content
Snippets Groups Projects
Commit 2228e8aa authored by Alán Muñoz's avatar Alán Muñoz
Browse files

change(pipe)): move server_info paramas one lvl up

parent c49dae8a
No related branches found
No related tags found
No related merge requests found
......@@ -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)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment