Skip to content

Commit bc3cb4f

Browse files
authored
Allow the URL of the server hosting the rsync daemon to be separately configured (#419)
Currently the server hosting the rsync daemon used for transfer is always assumed to be the same as that hosting the Murfey server. It is possible that these would be two different hosts which would then require two URLs. Here an rsync_url configuration option is added. If left at its default value of "" the Murfey server URL will be used, otherwise the configured value is used.
1 parent befc71b commit bc3cb4f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/murfey/client/multigrid_control.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class MultigridController:
3131
instrument_name: str
3232
session_id: int
3333
murfey_url: str = "http://localhost:8000"
34+
rsync_url: str = ""
3435
demo: bool = False
3536
processing_enabled: bool = True
3637
do_transfer: bool = True
@@ -57,6 +58,7 @@ def __post_init__(self):
5758
machine_data = requests.get(
5859
f"{self.murfey_url}/instruments/{self.instrument_name}/machine"
5960
).json()
61+
self.rsync_url = machine_data.get("rsync_url", "")
6062
self._environment = MurfeyInstanceEnvironment(
6163
url=urlparse(self.murfey_url, allow_fragments=False),
6264
client_id=0,
@@ -209,7 +211,11 @@ def _start_rsyncer(
209211
self.rsync_processes[source] = RSyncer(
210212
source,
211213
basepath_remote=Path(destination),
212-
server_url=self._environment.url,
214+
server_url=(
215+
urlparse(self.rsync_url)
216+
if self.rsync_url
217+
else self._environment.url
218+
),
213219
stop_callback=self._rsyncer_stopped,
214220
do_transfer=self.do_transfer,
215221
remove_files=remove_files,

src/murfey/client/tui/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def _start_rsyncer_multigrid(
187187
remove_files=remove_files,
188188
limited=limited,
189189
transfer=machine_data.get("data_transfer_enabled", True),
190+
rsync_url=machine_data.get("rsync_url", ""),
190191
)
191192

192193
def _start_rsyncer(
@@ -199,6 +200,7 @@ def _start_rsyncer(
199200
remove_files: bool = False,
200201
limited: bool = False,
201202
transfer: bool = True,
203+
rsync_url: str = "",
202204
):
203205
log.info(f"starting rsyncer: {source}")
204206
if self._environment:
@@ -226,7 +228,7 @@ def _start_rsyncer(
226228
self.rsync_processes[source] = RSyncer(
227229
source,
228230
basepath_remote=Path(destination),
229-
server_url=self._url,
231+
server_url=urlparse(rsync_url) if rsync_url else self._url,
230232
# local=self._environment.demo,
231233
status_bar=self._statusbar,
232234
do_transfer=self._do_transfer,

src/murfey/util/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class MachineConfig(BaseModel, extra=Extra.allow): # type: ignore
6666
instrument_server_url: str = "http://localhost:8001"
6767
frontend_url: str = "http://localhost:3000"
6868
murfey_url: str = "http://localhost:8000"
69+
rsync_url: str = ""
6970

7071
security_configuration_path: Optional[Path] = None
7172
auth_url: str = ""

0 commit comments

Comments
 (0)