Skip to content

Commit

Permalink
Merge branch 'master' into dev/model-registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Kasprzyk committed Mar 8, 2022
2 parents 7566470 + 64c1e63 commit 519d850
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
# Both integration tests and E2E
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
max-parallel: 4
matrix:
Expand Down Expand Up @@ -85,7 +86,7 @@ jobs:
fields: repo,message,commit,author,eventName,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()
if: job.status != 'success'

publish:
needs: [lint, test]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:

integration:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest]
Expand Down
53 changes: 48 additions & 5 deletions neptune/api_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,55 @@ class NeptuneApiException(NeptuneException):
pass


class SSLError(NeptuneException):
class NeptuneSSLVerificationError(NeptuneException):
def __init__(self):
super(SSLError, self).__init__(
"SSL certificate validation failed. Set NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE "
"environment variable to accept self-signed certificates."
)
message = """
{h1}
----NeptuneSSLVerificationError-----------------------------------------------------------------------
{end}
Neptune client was unable to verify your SSL Certificate.
{bold}What could go wrong?{end}
- You are behind a proxy that inspects traffic to Neptune servers.
- Contact your network administrator
- Your on-prem installation's SSL/TLS certificate is not recognized due to a custom Certificate Authority (CA).
- To check run the following command in terminal:
{bash}curl https://<your_domain>/api/backend/echo {end}
- Where <your_domain> is the address that you use to access Neptune UI i.e. abc.com
- Contact your network administrator if you get the following output:
{fail}"curl: (60) server certificate verification failed..."{end}
- Your machine software is not up-to-date.
- Minimal OS requirements:
- Windows >= XP SP3
- macOS >= 10.12.1
- Ubuntu >= 12.04
- Debian >= 8
{bold}What can I do?{end}
You can manually configure Neptune to skip all SSL checks. To do that
set the NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE environment variable to 'TRUE'.
{bold}Note that might mean your connection is less secure{end}.
Linux/Unix
In your terminal run:
{bash}export NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE='TRUE'{end}
Windows
In your terminal run:
{bash}set NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE='TRUE'{end}
Jupyter notebook
In your code cell:
{bash}%env NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE='TRUE'{end}
You may also want to check the following docs pages:
- https://docs.neptune.ai/api-reference/environment-variables#neptune_allow_self_signed_certificate
{correct}Need help?{end}-> https://docs.neptune.ai/getting-started/getting-help
"""
super().__init__(message.format(**STYLES))


class ConnectionLost(NeptuneApiException):
Expand Down
53 changes: 48 additions & 5 deletions neptune/new/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,12 +686,55 @@ def __init__(self, host):
super().__init__(message.format(host=host, **STYLES))


class SSLError(NeptuneException):
class NeptuneSSLVerificationError(NeptuneException):
def __init__(self):
super().__init__(
"SSL certificate validation failed. Set NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE "
"environment variable to accept self-signed certificates."
)
message = """
{h1}
----NeptuneSSLVerificationError-----------------------------------------------------------------------
{end}
Neptune client was unable to verify your SSL Certificate.
{bold}What could go wrong?{end}
- You are behind a proxy that inspects traffic to Neptune servers.
- Contact your network administrator
- Your on-prem installation's SSL/TLS certificate is not recognized due to a custom Certificate Authority (CA).
- To check run the following command in terminal:
{bash}curl https://<your_domain>/api/backend/echo {end}
- Where <your_domain> is the address that you use to access Neptune UI i.e. abc.com
- Contact your network administrator if you get the following output:
{fail}"curl: (60) server certificate verification failed..."{end}
- Your machine software is not up-to-date.
- Minimal OS requirements:
- Windows >= XP SP3
- macOS >= 10.12.1
- Ubuntu >= 12.04
- Debian >= 8
{bold}What can I do?{end}
You can manually configure Neptune to skip all SSL checks. To do that
set the NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE environment variable to 'TRUE'.
{bold}Note that might mean your connection is less secure{end}.
Linux/Unix
In your terminal run:
{bash}export NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE='TRUE'{end}
Windows
In your terminal run:
{bash}set NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE='TRUE'{end}
Jupyter notebook
In your code cell:
{bash}%env NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE='TRUE'{end}
You may also want to check the following docs pages:
- https://docs.neptune.ai/api-reference/environment-variables#neptune_allow_self_signed_certificate
{correct}Need help?{end}-> https://docs.neptune.ai/getting-started/getting-help
"""
super().__init__(message.format(**STYLES))


class NeptuneConnectionLostException(NeptuneException):
Expand Down
4 changes: 2 additions & 2 deletions neptune/new/internal/backends/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
NEPTUNE_ALLOW_SELF_SIGNED_CERTIFICATE,
)
from neptune.new.exceptions import (
SSLError,
NeptuneSSLVerificationError,
NeptuneConnectionLostException,
Unauthorized,
Forbidden,
Expand Down Expand Up @@ -105,7 +105,7 @@ def wrapper(*args, **kwargs):
raise NeptuneInvalidApiTokenException()
raise
except requests.exceptions.SSLError as e:
raise SSLError() from e
raise NeptuneSSLVerificationError() from e
except (
BravadoConnectionError,
BravadoTimeoutError,
Expand Down
4 changes: 2 additions & 2 deletions neptune/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
from neptune.api_exceptions import (
ConnectionLost,
Forbidden,
SSLError,
NeptuneSSLVerificationError,
ServerError,
Unauthorized,
)
Expand Down Expand Up @@ -297,7 +297,7 @@ def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except requests.exceptions.SSLError:
raise SSLError()
raise NeptuneSSLVerificationError()
except HTTPBadRequest as e:
if parse_error_type(e) == MIGRATION_FINISHED:
raise ProjectMigratedToNewStructure()
Expand Down
6 changes: 3 additions & 3 deletions tests/neptune/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from neptune.api_exceptions import PathInExperimentNotFound
from neptune.api_exceptions import PathInProjectNotFound
from neptune.api_exceptions import ProjectNotFound
from neptune.api_exceptions import SSLError
from neptune.api_exceptions import NeptuneSSLVerificationError
from neptune.api_exceptions import ServerError
from neptune.api_exceptions import StorageLimitReached
from neptune.api_exceptions import Unauthorized
Expand Down Expand Up @@ -287,7 +287,7 @@
from neptune.new.exceptions import ProjectNotFound
from neptune.new.exceptions import RunNotFound
from neptune.new.exceptions import RunUUIDNotFound
from neptune.new.exceptions import SSLError
from neptune.new.exceptions import NeptuneSSLVerificationError
from neptune.new.exceptions import Unauthorized
from neptune.new.exceptions import UnsupportedClientVersion
from neptune.new.exceptions import Version
Expand Down Expand Up @@ -469,7 +469,7 @@
from neptune.utils import NotADirectory
from neptune.utils import NotAFile
from neptune.utils import ProjectMigratedToNewStructure
from neptune.utils import SSLError
from neptune.utils import NeptuneSSLVerificationError
from neptune.utils import ServerError
from neptune.utils import Unauthorized

Expand Down

0 comments on commit 519d850

Please sign in to comment.