Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Informative error message when directory is not writeable #752

Closed
wants to merge 3 commits into from

Conversation

art-dsit
Copy link
Contributor

@art-dsit art-dsit commented Oct 24, 2024

This PR contains:

  • New features
  • Changes to dev-tools e.g. CI config / github tooling
  • Docs
  • Bug fixes
  • Code refactor

What is the current behavior? (You can also link to an open issue here)

You get an obscure error message if you try to run inspect in a devcontainer or other CI context without a login session.

What is the new behavior?

You get a better error message.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

@art-dsit
Copy link
Contributor Author

(I need to test this before merging - please hold off)

Copy link
Collaborator

@craigwalton-dsit craigwalton-dsit left a comment

Choose a reason for hiding this comment

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

LGTM, hopefully this will save some time for people!

@@ -5,17 +5,31 @@
from inspect_ai._util.constants import PKG_NAME


def _xdg_error(dir_type: str, dir_name: str) -> str:
return f"""{dir_type} directory {dir_name} is not writeable.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pedantic: consider using dedent() (used elsewhere in inspect_ai) so that the error message isn't indented

x directory x is not writeable.
        This may be because you are running Inspect without a normal login session.
        On Linux, try setting XDG_RUNTIME_DIR to somewhere writeable.
        See also https://github.com/UKGovernmentBEIS/inspect_ai/issues/51.

I.e. the following

def _xdg_error(dir_type: str, dir_name: str) -> str:
    return dedent(f"""\
        {dir_type} directory {dir_name} is not writeable.
        This may be because you are running Inspect without a normal login session.
        On Linux, try setting XDG_RUNTIME_DIR to somewhere writeable.
        See also https://github.com/UKGovernmentBEIS/inspect_ai/issues/51.""")

gives

test directory test is not writeable.
This may be because you are running Inspect without a normal login session.
On Linux, try setting XDG_RUNTIME_DIR to somewhere writeable.
See also https://github.com/UKGovernmentBEIS/inspect_ai/issues/51.

@jjallaire-aisi
Copy link
Collaborator

Closing as we are handling by having a more ironclad fallback in ~/.local: #761

@jjallaire jjallaire deleted the xdg_errors branch November 23, 2024 15:42
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.

3 participants