Skip to content

Commit

Permalink
Merge pull request #1465 from neptune-ai/cli-review
Browse files Browse the repository at this point in the history
cli and docstrings language review
  • Loading branch information
normandy7 authored Sep 18, 2023
2 parents 8ed3918 + 02a8f55 commit ee0f099
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 102 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
- Added support for `airflow` integration ([#1466](https://github.com/neptune-ai/neptune-client/pull/1466))

### Changes
- Add handling of project limits [#1456](https://github.com/neptune-ai/neptune-client/pull/1456)
- Add handling of project limits ([#1456](https://github.com/neptune-ai/neptune-client/pull/1456))
- Language and style improvements ([#1465](https://github.com/neptune-ai/neptune-client/pull/1465))

### Fixes
- Fix exception handling in `ApiMethodWrapper.handle_neptune_http_errors` ([#1469](https://github.com/neptune-ai/neptune-client/pull/1469))
Expand Down
4 changes: 2 additions & 2 deletions src/neptune/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#
"""Log and organize all your ML model metadata with neptune.ai.
There are four kinds of Neptune object: run, model, model version, and project.
These help you track, store, and visualize metadata related to your model-training experiments.
There are four kinds of Neptune objects: run, model, model version, and project.
They help you track, store, and visualize metadata related to your model-training experiments.
The package contains the functions and constructors needed to initialize the objects.
You can either create new objects or connect to existing ones (to, for example, fetch or add more metadata).
Expand Down
2 changes: 1 addition & 1 deletion src/neptune/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ def main():
try:
loaded_plugin = entry_point.load()
except Exception as e:
warnings.warn(f"Failed loading neptune plug-in `{name}` with exception: {e}")
warnings.warn(f"Failed to load neptune plug-in `{name}` with exception: {e}")
main.add_command(loaded_plugin, name)
2 changes: 1 addition & 1 deletion src/neptune/cli/clear.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def clear(self, path: Path, force: bool = False, clear_eventual: bool = True):
@staticmethod
def remove_sync_containers(path: Path):
"""
Function can remove SYNC_DIRECTORY safely, Neptune client stores only files to upload in this location.
Function can remove SYNC_DIRECTORY safely, Neptune client only stores files to upload in this location.
"""
shutil.rmtree(path / SYNC_DIRECTORY, ignore_errors=True)

Expand Down
10 changes: 5 additions & 5 deletions src/neptune/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
def status(path: Path) -> None:
"""List synchronized and unsynchronized objects in the given directory. Trashed objects are not listed.
Neptune stores object data on disk in '.neptune' directories. In case an object executes offline
or network is unavailable as the object executes, object data can be synchronized
Neptune stores object data on disk in the '.neptune' directory. If an object executes offline
or if the network is unavailable as the object executes, the object data can be synchronized
with the server with this command line utility.
Examples:
Expand Down Expand Up @@ -100,10 +100,10 @@ def sync(
project_name: Optional[str],
offline_only: Optional[bool],
):
"""Synchronizes objects with unsent data with the server.
"""Synchronizes objects with unsent data to the server.
Neptune stores object data on disk in '.neptune' directories. In case an object executes offline
or network is unavailable as the run executes, object data can be synchronized
Neptune stores object data on disk in the '.neptune' directory. If an object executes offline
or if the network is unavailable as the run executes, the object data can be synchronized
with the server with this command line utility.
You can list unsynchronized runs with `neptune status`
Expand Down
4 changes: 2 additions & 2 deletions src/neptune/cli/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
from neptune.internal.utils.logger import logger

offline_run_explainer = """
Runs which execute offline are not created on the server and they are not assigned to projects;
Runs that execute offline are not created on the server and are not assigned to projects;
instead, they are identified by UUIDs like the ones above.
When synchronizing offline runs, please specify the workspace and project using the "--project"
When synchronizing offline runs, specify the workspace and project using the "--project"
flag. Alternatively, you can set the environment variable
{} to the target workspace/project. See the examples below.
""".format(
Expand Down
4 changes: 2 additions & 2 deletions src/neptune/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_metadata_container(

_project_name_missing_message = (
"Project name not provided. Could not synchronize offline runs."
" To synchronize offline run, specify the project name with the --project flag"
" To synchronize an offline run, specify the project name with the --project flag"
f" or by setting the {PROJECT_ENV_NAME} environment variable."
)

Expand Down Expand Up @@ -113,7 +113,7 @@ def is_container_synced_and_remove_junk(experiment_path: Path) -> bool:

def _is_execution_synced_and_remove_junk(execution_path: Path) -> bool:
"""
The DiskQueue.close() method remove junk metadata from disk when queue is empty.
The DiskQueue.close() method removes junk metadata from the disk when the queue is empty.
"""
with DiskQueue(execution_path, lambda x: x.to_dict(), Operation.from_dict, threading.RLock()) as disk_queue:
return disk_queue.is_empty()
Expand Down
6 changes: 3 additions & 3 deletions src/neptune/common/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self):
There are two options to add it:
- specify it in your code
- set as an environment variable in your operating system.
- set it as an environment variable in your operating system.
{h2}CODE{end}
Pass the token to the {bold}init_run(){end} function via the {bold}api_token{end} argument:
Expand Down Expand Up @@ -183,7 +183,7 @@ def __init__(self):
- {correct}WORKSPACE_NAME{end}: can be your username or your organization name
- {correct}PROJECT_NAME{end}: the name specified for the project
- Ask your organization administrator to grant you necessary privileges to the project.
- Ask your organization administrator to grant you the necessary privileges to the project.
{correct}Need help?{end}-> https://docs.neptune.ai/getting_help
"""
Expand All @@ -207,7 +207,7 @@ def __init__(self, msg=None):
- {correct}WORKSPACE_NAME{end}: can be your username or your organization name
- {correct}PROJECT_NAME{end}: the name specified for the project
- Ask your organization administrator to grant you necessary privileges to the project.
- Ask your organization administrator to grant you the necessary privileges to the project.
{correct}Need help?{end}-> https://docs.neptune.ai/getting_help
"""
Expand Down
4 changes: 2 additions & 2 deletions src/neptune/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def validate_notebook_path(path):


def assure_directory_exists(destination_dir):
"""Check if `destination_dir` DIRECTORY exists, or creates one"""
"""Checks if `destination_dir` DIRECTORY exists, or creates one"""
if not destination_dir:
destination_dir = os.getcwd()

Expand Down Expand Up @@ -159,7 +159,7 @@ def update_session_proxies(session, proxies):
def get_git_info(repo_path=None):
"""Retrieve information about git repository.
If attempt fails, ``None`` will be returned.
If the attempt fails, ``None`` will be returned.
Args:
repo_path (:obj:`str`, optional, default is ``None``):
Expand Down
4 changes: 2 additions & 2 deletions src/neptune/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self, field_path):
The field "{field_path}" was not found.
There are two possible reasons:
- There is a typo in a path. Double-check your code for typos.
- There is a typo in the path. Double-check your code for typos.
- You are fetching a field that another process created, but the local representation is not synchronized.
If you are sending metadata from multiple processes at the same time, synchronize the local representation before fetching values:
{python}run.sync(){end}
Expand Down Expand Up @@ -365,7 +365,7 @@ def __init__(
{end}
The Neptune client couldn't find your project name.
{available_projects_message}{available_workspaces_message}
There are two options two add it:
There are two options to add it:
- specify it in your code
- set an environment variable in your operating system.
Expand Down
Loading

0 comments on commit ee0f099

Please sign in to comment.