Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified MachineConfig Pydantic model: Turned the 'create_directories' field from a dict to a list #429

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/murfey/client/tui/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ def on_button_pressed(self, event: Button.Pressed):
instrument_name=self.app._environment.instrument_name,
demo=self.app._environment.demo,
)
for dir in machine_config["create_directories"].values():
for dir in machine_config["create_directories"]:
(visit_dir / dir).mkdir(exist_ok=True)
self.app.install_screen(
LaunchScreen(basepath=visit_dir, add_basepath=True), "launcher"
Expand Down Expand Up @@ -1008,8 +1008,7 @@ def compose(self):
for d in s.glob("*"):
if (
d.is_dir()
and d.name
not in machine_config["create_directories"].values()
and d.name not in machine_config["create_directories"]
):
dest = determine_default_destination(
self.app._visit,
Expand Down Expand Up @@ -1049,7 +1048,7 @@ def compose(self):
instrument_name=self.app._environment.instrument_name,
)
for s, d in self._transfer_routes.items():
if Path(d).name not in machine_config["create_directories"].values():
if Path(d).name not in machine_config["create_directories"]:
bulk.append(Label(f"Copy the source {s} to:"))
bulk.append(
Input(
Expand Down
2 changes: 1 addition & 1 deletion src/murfey/client/watchdir_multigrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _process(self):
first_loop = True
while not self._stopping:
for d in self._basepath.glob("*"):
if d.name in self._machine_config["create_directories"].values():
if d.name in self._machine_config["create_directories"]:
if d.is_dir() and d not in self._seen_dirs:
self.notify(
d,
Expand Down
2 changes: 1 addition & 1 deletion src/murfey/instrument_server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def start_multigrid_watcher(
f"{_get_murfey_url()}/instruments/{sanitise_nonpath(watcher_spec.instrument_name)}/machine",
headers={"Authorization": f"Bearer {tokens[session_id]}"},
).json()
for d in machine_config.get("create_directories", {}).values():
for d in machine_config.get("create_directories", []):
(watcher_spec.source / d).mkdir(exist_ok=True)
watchers[session_id] = MultigridDirWatcher(
watcher_spec.source,
Expand Down
2 changes: 1 addition & 1 deletion src/murfey/util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MachineConfig(BaseModel, extra=Extra.allow): # type: ignore
external_executables_eer: Dict[str, str] = {}
external_environment: Dict[str, str] = {}
rsync_module: str = ""
create_directories: Dict[str, str] = {"atlas": "atlas"}
create_directories: list[str] = ["atlas"]
analyse_created_directories: List[str] = []
gain_reference_directory: Optional[Path] = None
eer_fractionation_file_template: str = ""
Expand Down
Loading