Skip to content

Commit

Permalink
refactor: remove unused hub environment variables (#5067)
Browse files Browse the repository at this point in the history
  • Loading branch information
alaeddine-13 committed Aug 16, 2022
1 parent 442a86c commit c1c500a
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 44 deletions.
2 changes: 0 additions & 2 deletions docs/envs/index.md
Expand Up @@ -61,8 +61,6 @@ The following environment variables are used internally in Jina:
| `JINA_GRPC_RECV_BYTES` | Set by the grpc service to keep track of the received bytes |
| `JINA_GRPC_SEND_BYTES` | Set by the grpc service to keep track of the sent bytes |
| `JINA_HUBBLE_REGISTRY` | Set it to point to a different Jina Hub registry |
| `JINA_HUB_CACHE_DIR` | The directory where hub will cache its executors inside JINA_HUB_ROOT |
| `JINA_HUB_ROOT` | The base directory for HubIO to store and read files |
| `JINA_LOG_CONFIG` | The configuration used for the logger |
| `JINA_LOG_LEVEL` | The logging level used: INFO, DEBUG, WARNING |
| `JINA_LOG_NO_COLOR` | If set, disables color from rich console |
Expand Down
18 changes: 0 additions & 18 deletions docs/fundamentals/executor/hub/index.md
Expand Up @@ -46,24 +46,6 @@ The Hub architecture looks like the following:
:align: center
```

## Environment Variables

A list of environment variables which takes effects during Jina Hub operations. e.g. `jina hub push`

### `JINA_HUB_ROOT`

**Define the place where the Executor package cache lives.** Default value is `~/.jina/hub-packages`

````{admonition} Hint
:class: hint
You don't have permissions to create a directory in the home folder sometime. This is the right time to change the value.
````

### `JINA_HUB_CACHE_DIR`

**Define the place where the cache is stored during the downloading.** The cache will be deleted after downloading. Default value is `${JINA_HUB_ROOT}/.cache`.


```{toctree}
:hidden:
Expand Down
4 changes: 1 addition & 3 deletions docs/fundamentals/gateway/index.md
Expand Up @@ -347,9 +347,7 @@ The error-free output below signifies a correctly running Gateway:
"JINA_GRPC_RECV_BYTES": "(unset)",
"JINA_GRPC_SEND_BYTES": "(unset)",
"JINA_HUBBLE_REGISTRY": "(unset)",
"JINA_HUB_CACHE_DIR": "(unset)",
"JINA_HUB_NO_IMAGE_REBUILD": "(unset)",
"JINA_HUB_ROOT": "(unset)",
"JINA_LOCKS_ROOT": "(unset)",
"JINA_LOG_CONFIG": "(unset)",
"JINA_LOG_LEVEL": "(unset)",
Expand All @@ -374,7 +372,7 @@ curl http://localhost:12345/status
```

```json
{"jina":{"jina":"######","docarray":"######","jina-proto":"######","jina-vcs-tag":"(unset)","protobuf":"######","proto-backend":"######","grpcio":"######","pyyaml":"######","python":"######","platform":"######","platform-release":"######","platform-version":"######","architecture":"######","processor":"######","uid":"######","session-id":"######","uptime":"######","ci-vendor":"(unset)"},"envs":{"JINA_AUTH_TOKEN":"(unset)","JINA_DEFAULT_HOST":"(unset)","JINA_DEFAULT_TIMEOUT_CTRL":"(unset)","JINA_DEFAULT_WORKSPACE_BASE":"######","JINA_DEPLOYMENT_NAME":"(unset)","JINA_DISABLE_UVLOOP":"(unset)","JINA_EARLY_STOP":"(unset)","JINA_FULL_CLI":"(unset)","JINA_GATEWAY_IMAGE":"(unset)","JINA_GRPC_RECV_BYTES":"(unset)","JINA_GRPC_SEND_BYTES":"(unset)","JINA_HUBBLE_REGISTRY":"(unset)","JINA_HUB_CACHE_DIR":"(unset)","JINA_HUB_NO_IMAGE_REBUILD":"(unset)","JINA_HUB_ROOT":"(unset)","JINA_LOG_CONFIG":"(unset)","JINA_LOG_LEVEL":"(unset)","JINA_LOG_NO_COLOR":"(unset)","JINA_MP_START_METHOD":"(unset)","JINA_RANDOM_PORT_MAX":"(unset)","JINA_RANDOM_PORT_MIN":"(unset)","JINA_DISABLE_HEALTHCHECK_LOGS":"(unset)","JINA_LOCKS_ROOT":"(unset)"}}
{"jina":{"jina":"######","docarray":"######","jina-proto":"######","jina-vcs-tag":"(unset)","protobuf":"######","proto-backend":"######","grpcio":"######","pyyaml":"######","python":"######","platform":"######","platform-release":"######","platform-version":"######","architecture":"######","processor":"######","uid":"######","session-id":"######","uptime":"######","ci-vendor":"(unset)"},"envs":{"JINA_AUTH_TOKEN":"(unset)","JINA_DEFAULT_HOST":"(unset)","JINA_DEFAULT_TIMEOUT_CTRL":"(unset)","JINA_DEFAULT_WORKSPACE_BASE":"######","JINA_DEPLOYMENT_NAME":"(unset)","JINA_DISABLE_UVLOOP":"(unset)","JINA_EARLY_STOP":"(unset)","JINA_FULL_CLI":"(unset)","JINA_GATEWAY_IMAGE":"(unset)","JINA_GRPC_RECV_BYTES":"(unset)","JINA_GRPC_SEND_BYTES":"(unset)","JINA_HUBBLE_REGISTRY":"(unset)","JINA_HUB_NO_IMAGE_REBUILD":"(unset)","JINA_LOG_CONFIG":"(unset)","JINA_LOG_LEVEL":"(unset)","JINA_LOG_NO_COLOR":"(unset)","JINA_MP_START_METHOD":"(unset)","JINA_RANDOM_PORT_MAX":"(unset)","JINA_RANDOM_PORT_MIN":"(unset)","JINA_DISABLE_HEALTHCHECK_LOGS":"(unset)","JINA_LOCKS_ROOT":"(unset)"}}
```

(server-compress)=
Expand Down
2 changes: 0 additions & 2 deletions jina/__init__.py
Expand Up @@ -97,9 +97,7 @@ def _warning_on_one_line(message, category, filename, lineno, *args, **kwargs):
'JINA_GRPC_RECV_BYTES',
'JINA_GRPC_SEND_BYTES',
'JINA_HUBBLE_REGISTRY',
'JINA_HUB_CACHE_DIR',
'JINA_HUB_NO_IMAGE_REBUILD',
'JINA_HUB_ROOT',
'JINA_LOG_CONFIG',
'JINA_LOG_LEVEL',
'JINA_LOG_NO_COLOR',
Expand Down
9 changes: 0 additions & 9 deletions tests/conftest.py
Expand Up @@ -54,15 +54,6 @@ def random_port():
return random_port


@pytest.fixture(scope='function')
def test_envs(tmpdir):
os.environ['JINA_HUB_ROOT'] = str(tmpdir)
os.environ['JINA_HUB_CACHE_DIR'] = str(tmpdir)
yield None
del os.environ['JINA_HUB_ROOT']
del os.environ['JINA_HUB_CACHE_DIR']


@pytest.fixture(autouse=True)
def test_log_level(monkeypatch):
monkeypatch.setenv('JINA_LOG_LEVEL', 'DEBUG')
Expand Down
8 changes: 3 additions & 5 deletions tests/integration/hub_usage/test_hub_usage.py
Expand Up @@ -49,11 +49,9 @@ def test_use_from_local_dir_flow_level():


@pytest.fixture
def local_hub_executor(tmpdir, test_envs):
def local_hub_executor(tmpdir):
from jina.hubble import HubExecutor, helper, hubapi

hubapi._hub_root = Path(os.environ.get('JINA_HUB_ROOT'))

pkg_path = Path(__file__).parent / 'dummyhub'
stream_data = helper.archive_package(pkg_path)
with open(tmpdir / 'dummy_test.zip', 'wb') as temp_zip_file:
Expand All @@ -65,7 +63,7 @@ def local_hub_executor(tmpdir, test_envs):


def test_use_from_local_hub_deployment_level(
test_envs, mocker, monkeypatch, local_hub_executor
mocker, monkeypatch, local_hub_executor
):
from jina.hubble.hubio import HubExecutor, HubIO

Expand Down Expand Up @@ -100,7 +98,7 @@ def _mock_fetch(


def test_use_from_local_hub_flow_level(
test_envs, mocker, monkeypatch, local_hub_executor
mocker, monkeypatch, local_hub_executor
):
from jina.hubble.hubio import HubExecutor, HubIO

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/hubble/test_hubapi.py
Expand Up @@ -20,7 +20,7 @@ def test_executor():


@pytest.mark.parametrize('install_deps', [True, False])
def test_install_local(test_envs, executor_zip_file, test_executor, install_deps):
def test_install_local(executor_zip_file, test_executor, install_deps):
assert not hubapi.exist_local(test_executor.uuid, test_executor.tag)
hubapi.install_local(executor_zip_file, test_executor, install_deps=install_deps)
assert hubapi.exist_local(test_executor.uuid, test_executor.tag)
Expand All @@ -35,7 +35,7 @@ def test_install_local(test_envs, executor_zip_file, test_executor, install_deps
assert not hubapi.exist_local(test_executor.uuid, test_executor.tag)


def test_load_dump_secret(test_envs):
def test_load_dump_secret():
import tempfile

uuid8 = 'hello'
Expand All @@ -47,7 +47,7 @@ def test_load_dump_secret(test_envs):
assert new_secret == secret


def test_load_dump_secret_existing_encryption_key(test_envs):
def test_load_dump_secret_existing_encryption_key():
import tempfile

uuid8 = 'hello'
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/hubble/test_hubio.py
Expand Up @@ -572,7 +572,7 @@ def status_code(self):

@pytest.mark.parametrize('executor_name', ['alias_dummy', None])
@pytest.mark.parametrize('build_env', [['DOWNLOAD', 'DOMAIN'], None])
def test_pull(test_envs, mocker, monkeypatch, executor_name, build_env):
def test_pull(mocker, monkeypatch, executor_name, build_env):
mock = mocker.Mock()

def _mock_fetch(
Expand Down Expand Up @@ -644,7 +644,7 @@ def pull(self, repository: str, stream: bool = True, decode: bool = True):
yield {}


def test_offline_pull(test_envs, mocker, monkeypatch, tmpfile):
def test_offline_pull(mocker, monkeypatch, tmpfile):
mock = mocker.Mock()

fail_meta_fetch = True
Expand Down

0 comments on commit c1c500a

Please sign in to comment.