Skip to content

Fall back to USERNAME env var in Singularity scratch path - #459

Closed
shitcoinsherpa wants to merge 1 commit into
NousResearch:mainfrom
shitcoinsherpa:fix/singularity-username-env
Closed

Fall back to USERNAME env var in Singularity scratch path#459
shitcoinsherpa wants to merge 1 commit into
NousResearch:mainfrom
shitcoinsherpa:fix/singularity-username-env

Conversation

@shitcoinsherpa

Copy link
Copy Markdown
Contributor

Problem

The Singularity environment uses os.getenv("USER", "hermes") to build the scratch directory path under /scratch. On Windows, the username is stored in USERNAME, not USER, so this always falls back to the hardcoded "hermes" default.

Fix

Chain the fallback: os.getenv("USER", os.getenv("USERNAME", "hermes")). This picks up the correct username on both Unix and Windows, and still falls back to "hermes" if neither is set.

One-line change.

Windows sets USERNAME instead of USER. Without this fallback, the
scratch directory path defaults to "hermes" instead of the actual
username when running on Windows.
@teknium1

Copy link
Copy Markdown
Contributor

Closing this — Singularity/Apptainer is a Linux/HPC container technology and won't be run on Windows. The /scratch path check (Path("/scratch").exists()) is also a Unix HPC convention, so this code path would never be reached on a system where USERNAME is set but USER isn't. Thanks for the contribution though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants