Skip to content

Commit

Permalink
Make handling of sys/name dependend on config flag (#1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksanderWWW authored May 15, 2024
1 parent b3311f4 commit f9f0b77
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
## [UNRELEASED] neptune 1.10.4
## neptune 1.10.4

### Fixes
- Fixed run not failing in case of an exception if context manager was used ([#1755](https://github.com/neptune-ai/neptune-client/pull/1755))

### Changes
- Make handling of `sys/name` dependent on the client config flag ([#1777](https://github.com/neptune-ai/neptune-client/pull/1777))


## neptune 1.10.3

Expand Down
4 changes: 4 additions & 0 deletions src/neptune/internal/backends/api_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class ClientConfig:
_missing_features: FrozenSet[str]
version_info: VersionInfo
multipart_config: MultipartConfig
sys_name_set_by_backend: bool

def has_feature(self, feature_name: str) -> bool:
return feature_name not in self._missing_features
Expand Down Expand Up @@ -173,12 +174,15 @@ def from_api_response(config) -> "ClientConfig":
missing_features.append(OptionalFeatures.ARTIFACTS_HASH_EXCLUDE_METADATA)
missing_features.append(OptionalFeatures.ARTIFACTS_EXCLUDE_DIRECTORY_FILES)

sys_name_set_by_backend = getattr(config, "sysNameSetByBackend", False)

return ClientConfig(
api_url=config.apiUrl,
display_url=config.applicationUrl,
_missing_features=frozenset(missing_features),
version_info=VersionInfo.build(min_recommended, min_compatible, max_compatible),
multipart_config=multipart_upload_config,
sys_name_set_by_backend=sys_name_set_by_backend,
)


Expand Down
2 changes: 2 additions & 0 deletions src/neptune/internal/backends/hosted_neptune_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def __init__(self, credentials: Credentials, proxies: Optional[Dict[str, str]] =
# create a stub
self.artifacts_client = MissingApiClient(OptionalFeatures.ARTIFACTS)

self.sys_name_set_by_backend = self._client_config.sys_name_set_by_backend

def verify_feature_available(self, feature_name: str):
if not self._client_config.has_feature(feature_name):
raise NeptuneFeatureNotAvailableException(feature_name)
Expand Down
4 changes: 4 additions & 0 deletions src/neptune/metadata_containers/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
ASYNC_LAG_THRESHOLD,
ASYNC_NO_PROGRESS_THRESHOLD,
DEFAULT_FLUSH_PERIOD,
DEFAULT_NAME,
OFFLINE_PROJECT_QUALIFIED_NAME,
)
from neptune.internal.notebooks.notebooks import create_checkpoint
Expand Down Expand Up @@ -484,6 +485,9 @@ def _write_initial_monitoring_attributes(self) -> None:
self[f"{self._monitoring_namespace}/tid"] = str(self._tid)

def _write_initial_attributes(self):
if not getattr(self._backend, "sys_name_set_by_backend", False):
self._name = self._name if self._name is not None else DEFAULT_NAME

if self._name is not None:
self[SYSTEM_NAME_ATTRIBUTE_PATH] = self._name

Expand Down

0 comments on commit f9f0b77

Please sign in to comment.