Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion openfold3/core/data/pipelines/preprocessing/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"""Preprocessing pipelines for template data ran before training/evaluation."""

import getpass
import logging
import multiprocessing as mp
import os
Expand Down Expand Up @@ -1602,7 +1603,7 @@ def _prepare_output_directories(self) -> "TemplatePreprocessorSettings":
)

self.output_directory = (
self.output_directory or Path(tempfile.gettempdir()) / "of3_template_data"
self.output_directory or Path(tempfile.gettempdir()) / f"of3_template_data_{getpass.getuser()}"
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line likely exceeds the repo's 88-character limit and will be reformatted by ruff format --check. Please run ruff format or split the path construction across multiple lines.

Suggested change
self.output_directory or Path(tempfile.gettempdir()) / f"of3_template_data_{getpass.getuser()}"
self.output_directory
or Path(tempfile.gettempdir())
/ f"of3_template_data_{getpass.getuser()}"

Copilot uses AI. Check for mistakes.
)
Comment on lines 1605 to 1607
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getpass.getuser() can raise in some environments (e.g., missing passwd entry / unset env vars). The PR description mentions a fallback to os.getuid(), but this call doesn't have one, so this change can still fail at runtime. Consider reusing the same helper/fallback logic used in colabfold_msa_server.py when building the temp directory name here.

Copilot uses AI. Check for mistakes.
base = self.output_directory

Expand Down
11 changes: 10 additions & 1 deletion openfold3/core/data/tools/colabfold_msa_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import getpass
import json
import logging
import os
import random
import shutil
import tarfile
import tempfile


def _get_username() -> str:
"""Get current username for user-specific temp directories."""
try:
return getpass.getuser()
except Exception:
return str(os.getuid()) if hasattr(os, "getuid") else "default"
import time
import warnings
Comment on lines +25 to 32
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import time (and subsequent imports) now appear after _get_username() at module scope. This will trigger Ruff E402/I001 (imports not at top / import block split) and can break CI. Keep all imports together at the top, then define _get_username() below them (or move import time above the helper).

Copilot uses AI. Check for mistakes.
from dataclasses import dataclass, field
Expand Down Expand Up @@ -997,7 +1006,7 @@ class MsaComputationSettings(BaseModel):
server_user_agent: str = "openfold"
server_url: Url = Url("https://api.colabfold.com")
save_mappings: bool = True
msa_output_directory: Path = Path(tempfile.gettempdir()) / "of3_colabfold_msas"
msa_output_directory: Path = Path(tempfile.gettempdir()) / f"of3_colabfold_msas_{_get_username()}"
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment line exceeds the repo's configured 88-character line length (see pyproject.toml), so ruff format --check is likely to fail. Please run ruff format or wrap the expression onto multiple lines.

Suggested change
msa_output_directory: Path = Path(tempfile.gettempdir()) / f"of3_colabfold_msas_{_get_username()}"
msa_output_directory: Path = (
Path(tempfile.gettempdir())
/ f"of3_colabfold_msas_{_get_username()}"
)

Copilot uses AI. Check for mistakes.
cleanup_msa_dir: bool = True

@model_validator(mode="after")
Expand Down
Loading