Skip to content

Commit

Permalink
Clearer scratch paths (#1100)
Browse files Browse the repository at this point in the history
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
Andrew-S-Rosen and deepsource-autofix[bot] committed Oct 25, 2023
1 parent 50c6b50 commit 314a280
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [0.3.9]

### Changed

- Changed prefix of scratch directories to have the datetime in it for easier debugging

### Fixed

- DFTB+ recipes now won't crash when `kpts=None` for structures with PBCs
Expand Down
6 changes: 5 additions & 1 deletion src/quacc/runners/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import os
from datetime import datetime
from pathlib import Path
from shutil import rmtree
from tempfile import mkdtemp
Expand Down Expand Up @@ -265,7 +266,10 @@ def _calc_setup(
)

# Create a tmpdir for the calculation within the scratch_dir
tmpdir = Path(mkdtemp(prefix="quacc-tmp-", dir=SETTINGS.SCRATCH_DIR)).resolve()
time_now = datetime.utcnow().strftime("%Y-%m-%d-%H-%M-%S-%f")
tmpdir = Path(
mkdtemp(prefix=f"quacc-tmp-{time_now}-", dir=SETTINGS.SCRATCH_DIR)
).resolve()

# Create a symlink to the tmpdir in the results_dir
if os.name != "nt" and SETTINGS.SCRATCH_DIR != SETTINGS.RESULTS_DIR:
Expand Down

0 comments on commit 314a280

Please sign in to comment.