Skip to content

Commit 7e294ea

Browse files
authored
Merge pull request #85 from lsst-sqre/tickets/DM-51350
tickets/DM-51350: use homedir schema in scratch path
2 parents 6e37eca + 6aff540 commit 7e294ea

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- Delete the sections that don't apply -->
2+
3+
### New features
4+
5+
- Detect HOMEDIR_SCHEMA for scratch-path calculation
6+
7+
### Bug fixes
8+
9+
- If writing token or increasing log depth fails, continue but warn user on startup

src/lsst/rsp/startup/services/labrunner/labrunner.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ def _check_user_scratch_subdir(self, path: Path) -> Path | None:
195195
if not user:
196196
self._logger.warning("Could not determine user from environment")
197197
return None
198+
schema = self._env.get("HOMEDIR_SCHEMA", "username")
198199
user_scratch_path = scratch_path / user / path
200+
# This is pretty ad-hoc, but USDF uses the first letter in the
201+
# username for both home and scratch
202+
if schema == "initialThenUsername":
203+
user_scratch_path = scratch_path / user[0] / user / path
199204
try:
200205
user_scratch_path.mkdir(parents=True, exist_ok=True, mode=0o700)
201206
except OSError as exc:
@@ -651,8 +656,13 @@ def _launch(self) -> None:
651656

652657
def _modify_interactive_settings(self) -> None:
653658
self._logger.debug("Modifying interactive settings if needed")
654-
self._manage_access_token()
655-
self._increase_log_limit()
659+
# These both write files; if either fails, start up but warn
660+
# the user their experience is likely to be bad.
661+
try:
662+
self._manage_access_token()
663+
self._increase_log_limit()
664+
except OSError as exc:
665+
self._set_abnormal_startup(exc)
656666

657667
def _increase_log_limit(self) -> None:
658668
self._logger.debug("Increasing log limit if needed")

0 commit comments

Comments
 (0)