Skip to content

Commit

Permalink
[query] make local and remote tmp settable on backend
Browse files Browse the repository at this point in the history
  • Loading branch information
ehigham committed Dec 12, 2024
1 parent 2ff863d commit 8d4ec57
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
10 changes: 10 additions & 0 deletions hail/python/hail/backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,13 @@ def get_flags(self, *flags) -> Mapping[str, str]:
@abc.abstractmethod
def requires_lowering(self):
pass

@property
@abc.abstractmethod
def local_tmpdir(self) -> str:
pass

@property
@abc.abstractmethod
def remote_tmpdir(self) -> str:
pass
22 changes: 20 additions & 2 deletions hail/python/hail/backend/py4j_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def decode_bytearray(encoded):
self._jhc = jhc

self._jbackend = self._hail_package.backend.api.Py4JBackendApi(jbackend)
self._jbackend.pySetLocalTmp(tmpdir)
self._jbackend.pySetRemoteTmp(remote_tmpdir)
self.local_tmpdir = tmpdir
self.remote_tmpdir = tmpdir

self._jhttp_server = self._jbackend.pyHttpServer()
self._backend_server_port: int = self._jhttp_server.port()
Expand Down Expand Up @@ -326,3 +326,21 @@ def stop(self):
self._jhc = None
uninstall_exception_handler()
super().stop()

@property
def local_tmpdir(self) -> str:
return self._local_tmpdir

@local_tmpdir.setter
def local_tmpdir(self, tmpdir) -> str:
self._local_tmpdir = tmpdir
self._jbackend.pySetLocalTmp(tmpdir)

@property
def remote_tmpdir(self) -> str:
return self._remote_tmpdir

@remote_tmpdir.setter
def remote_tmpdir(self, tmpdir) -> str:
self._remote_tmpdir = tmpdir
self._jbackend.pySetRemoteTmp(tmpdir)
1 change: 1 addition & 0 deletions hail/python/hail/backend/service_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def __init__(
self._batch_was_submitted: bool = False
self.disable_progress_bar = disable_progress_bar
self.batch_attributes = batch_attributes
self.local_tmpdir = tmp_dir()
self.remote_tmpdir = remote_tmpdir
self.flags: Dict[str, str] = {}
self._registered_ir_function_names: Set[str] = set()
Expand Down

0 comments on commit 8d4ec57

Please sign in to comment.