Skip to content

UV cache dir misplaced #1455

@dan-fernandes

Description

@dan-fernandes

UV requires a cache, which is currently set to build in the scratch directory. As the scratch directory is almost always in on a separate filesystem to the container (ie. either in a PVC or on the shared filesystem) UV needs to make network calls to access said cache. This is inefficient, and likely the cause of the weird Failed to hardlink messages on scratch install:

...
2026-03-24 14:10:44,013     INFO blueapi.cli.scratch Installing /workspace/dodal
Using Python 3.11.15 environment at: /app/.venv
Resolved 1 package in 4.31s
   Building dls-dodal @ file:///workspace/dodal
      Built dls-dodal @ file:///workspace/dodal
Prepared 1 package in 920ms
Uninstalled 1 package in 8ms
warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 1 package in 10ms
 - dls-dodal==2.2.0
 + dls-dodal==2.2.1.dev4+g664403bb7 (from file:///workspace/dodal)
2026-03-24 14:10:49,840     INFO blueapi.cli.scratch Cloning https://github.com/bluesky/ophyd-async.git
...

Deployment would probably be faster if the UV cache was inside the actual container. However, we want each PVC to be re-usable (ie. if I update BlueAPI from 1.12.1->1.12.2, I want the 1.12.1 PV to stick around so I can re-use it.)

Acceptance Criteria

  • Conclude whether the UV cache dir can be moved into a directory inside the container
  • If the UV cache is moved from PVs / the shared filesystem, ensure that PVs are still reusable
  • Either implement the change, or note and justify outcome in this ticket

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency filedeploymentStuff related to running in production containerhelm chartonboardingGood for newcomerspriority low

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions