Skip to content

Commit 1398046

Browse files
authored
Merge pull request #164 from MiraGeoscience/GEOPY-2466
GEOPY-2466: Parallelize the Sweeps
2 parents af0d42f + 4465f03 commit 1398046

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

geoapps_utils/run.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from __future__ import annotations
1212

1313
import inspect
14+
import json
1415
import logging
1516
import sys
1617
from importlib import import_module
@@ -163,7 +164,7 @@ def copy_uijson_relatives_only(
163164
with Workspace.create(workspace_path) as new_workspace:
164165
ifile.copy_relatives(new_workspace)
165166
temp_json = ifile.ui_json.copy()
166-
temp_json["geoh5"] = workspace_path
167+
temp_json["geoh5"] = new_workspace
167168
if monitoring_directory is not None:
168169
temp_json["monitoring_directory"] = str(monitoring_directory)
169170
new_input_file = InputFile(ui_json=temp_json)
@@ -194,7 +195,8 @@ def copy_uijson_and_workspace(
194195
195196
:return: Path to the new ui.json file.
196197
"""
197-
uijson_path = Path(uijson_path)
198+
uijson_path = Path(uijson_path).resolve()
199+
destination = Path(destination).resolve()
198200
uijson_dict = load_ui_json_as_dict(uijson_path)
199201

200202
orig_geoh5 = Path(str(uijson_dict.get("geoh5")))
@@ -203,17 +205,16 @@ def copy_uijson_and_workspace(
203205
)
204206
copy(orig_geoh5, Path(str(workspace_path)))
205207

206-
with Workspace(workspace_path):
207-
uijson_dict["geoh5"] = workspace_path
208-
if monitoring_directory is not None:
209-
uijson_dict["monitoring_directory"] = str(monitoring_directory)
210-
new_input_file = InputFile(ui_json=uijson_dict)
208+
uijson_dict["geoh5"] = str(workspace_path)
209+
if monitoring_directory is not None:
210+
uijson_dict["monitoring_directory"] = str(monitoring_directory)
211211

212-
uijson_path_name = new_input_file.write_ui_json(
213-
path=str(destination), name=new_workspace_name or uijson_path.name
214-
)
212+
output_uijson = destination / (new_workspace_name or uijson_path.name)
215213

216-
return uijson_path_name
214+
with open(output_uijson, "w", encoding="utf8") as out_file:
215+
json.dump(uijson_dict, out_file, indent=4)
216+
217+
return output_uijson
217218

218219

219220
def run_from_outgroup_name(

0 commit comments

Comments
 (0)