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

[feat] Rename class Object to Record and aim up to aim ui #2923

Merged
merged 4 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflow_files/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ RUN python -m pip install aim==$AIM_VERSION
WORKDIR /opt/aim
RUN aim init
ENTRYPOINT ["aim"]
CMD ["up"]
CMD ["ui"]
4 changes: 2 additions & 2 deletions docs/source/understanding/running_aim_with_profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Aim comes with profiling feature which is logging all api requests to the backend into a directory inside your
repository. We use [pyinstrument](https://pyinstrument.readthedocs.io/en/latest/) as underlying profiler. To toggle
profiling, run `aim up` with `--profiler` flag.
profiling, run `aim ui` with `--profiler` flag.

`$ aim up --profiler`
`$ aim ui --profiler`

This will instruct backend to create a new directory inside your repository (`.aim/profler`). On every api call,
profiler will create an `.html` file containing whole run trace of that api. Basically you can navigate into that
Expand Down
8 changes: 4 additions & 4 deletions docs/source/using/sagemaker_notebook_ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ run['hparams'] = {

In order to run Aim UI from a terminal, execute the following command:
```shell
$ aim up --base-path=/proxy/absolute/<your-port>/aim-sage
$ aim ui --base-path=/proxy/absolute/<your-port>/aim-sage
```

After running this command you will be able to open `<sagemker_instance>/proxy/absolute/<your-port>/aim-sage/` in your browser.
The default port is `43800`.

It is possible to set `__AIM_PROXY_URL__` env variable, and `aim up` command will print out the generated url for Aim UI.
It is possible to set `__AIM_PROXY_URL__` env variable, and `aim ui` command will print out the generated url for Aim UI.

To find your proxy url, just copy your SageMaker URL and remove `/lab` postfix.

Expand All @@ -67,10 +67,10 @@ To find your proxy url, just copy your SageMaker URL and remove `/lab` postfix.
%load_ext aim
```

2. Run `%aim up` command to open Aim UI in the notebook:
2. Run `%aim ui` command to open Aim UI in the notebook:

```jupyter
%aim up --proxy-url=https://<instance>.notebook.<region>.sagemaker.aws
%aim ui --proxy-url=https://<instance>.notebook.<region>.sagemaker.aws
```

Will load the Aim UI in the notebook cell.
Expand Down
8 changes: 4 additions & 4 deletions pkgs/aimstack/asp/models/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from typing import Optional, Tuple

from aim._core.storage.hashing import hash_auto
from aim import Object, Sequence
from aim import Record, Sequence
from aimstack.asp.models.objects.text import Text


@Object.alias('aim.LogLine')
@Record.alias('aim.LogLine')
class LogLine(Text):
AIM_NAME = 'aim.LogLine'

Expand All @@ -18,8 +18,8 @@ class LogStream(Sequence[LogLine]):
...


@Object.alias('aim.LogRecord')
class LogRecord(Object):
@Record.alias('aim.LogRecord')
class LogRecord(Record):
AIM_NAME = 'aim.LogRecord'

def __init__(self,
Expand Down
6 changes: 3 additions & 3 deletions pkgs/aimstack/asp/models/objects/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import os.path

from aim._sdk.num_utils import inst_has_typename
from aim import Object
from aim import Record
from aim._sdk.blob import BLOB

from .io import wavfile

logger = logging.getLogger(__name__)


@Object.alias('aim.Audio')
class Audio(Object):
@Record.alias('aim.Audio')
class Audio(Record):
"""Audio object used to store audio objects in Aim repository..

Currently, audio formats are limited to mp3, wav, flac
Expand Down
6 changes: 3 additions & 3 deletions pkgs/aimstack/asp/models/objects/distribution.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import numpy as np

from aim import Object
from aim import Record
from aim._sdk.blob import BLOB


@Object.alias('aim.Distribution')
class Distribution(Object):
@Record.alias('aim.Distribution')
class Distribution(Record):
"""Distribution object used to store distribution objects in Aim repository.

Args:
Expand Down
10 changes: 5 additions & 5 deletions pkgs/aimstack/asp/models/objects/figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import logging
import os.path

from aim import Object
from aim import Record
from aim._sdk.num_utils import inst_has_typename
from aim._sdk.blob import BLOB


logger = logging.getLogger(__name__)


@Object.alias('aim.Figure')
class Figure(Object):
@Record.alias('aim.Figure')
class Figure(Record):
"""
Figure object can be used for storing Plotly or Matplotlib figures into Aim repository.
Core functionality is based on Plotly.
Expand Down Expand Up @@ -86,8 +86,8 @@ def to_plotly_figure(self):
return from_json(self.data)


@Object.alias('aim.Figure3d')
class Figure3D(Object):
@Record.alias('aim.Figure3d')
class Figure3D(Record):
"""Figure3D object used to store 3-dimensional objects in Aim repository..

Currently, 3D figure formats are limited to stl and obj
Expand Down
6 changes: 3 additions & 3 deletions pkgs/aimstack/asp/models/objects/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import numpy as np

from aim._sdk.num_utils import inst_has_typename
from aim import Object
from aim import Record
from aim._sdk.blob import BLOB

logger = logging.getLogger(__name__)


@Object.alias('aim.Image')
class Image(Object):
@Record.alias('aim.Image')
class Image(Record):
"""Image object used to store image objects in Aim repository...

Args:
Expand Down
6 changes: 3 additions & 3 deletions pkgs/aimstack/asp/models/objects/text.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from aim import Object
from aim import Record
from aim._sdk.blob import BLOB


@Object.alias('aim.Text')
class Text(Object):
@Record.alias('aim.Text')
class Text(Record):
"""Text object used to store text objects in Aim repository.

Args:
Expand Down
2 changes: 1 addition & 1 deletion pkgs/aimstack/docs/boards/sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@

ui.board_link('sdk/container.py', 'Container API reference')
ui.board_link('sdk/sequence.py', 'Sequence API reference')
ui.board_link('sdk/object.py', 'Object API reference')
ui.board_link('sdk/record.py', 'Object API reference')
6 changes: 3 additions & 3 deletions pkgs/aimstack/ml/models/deeplake_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from deeplake.util.exceptions import ReadOnlyModeError

from aim._sdk.object import Object
from aim._sdk.record import Record

logger = logging.getLogger(__name__)

Expand All @@ -16,8 +16,8 @@ class ViewOnUncommittedDatasetWarning(UserWarning):
pass


@Object.alias('deeplake.Dataset')
class DeeplakeDataset(Object):
@Record.alias('deeplake.Dataset')
class DeeplakeDataset(Record):
"""
Track Activeloop Deeplake Dataset with versioning.

Expand Down
6 changes: 3 additions & 3 deletions pkgs/aimstack/ml/models/dvc_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
import yaml

from aim._sdk.object import Object
from aim._sdk.record import Record

try:
from dvc.repo import Repo
Expand All @@ -11,8 +11,8 @@
raise ImportError("module dvc could not be imported")


@Object.alias('dvc.Metadata')
class DvcData(Object):
@Record.alias('dvc.Metadata')
class DvcData(Record):
"""
Wrapper over DVC's LIST interface.
Find DVC tracked files and stores the list into aim storage.
Expand Down
6 changes: 3 additions & 3 deletions pkgs/aimstack/ml/models/hf_datasets_metadata.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from datasets import Dataset, DatasetDict
from logging import getLogger

from aim._sdk.object import Object
from aim._sdk.record import Record

logger = getLogger(__name__)


@Object.alias("hf_datasets.Metadata")
class HFDataset(Object):
@Record.alias("hf_datasets.Metadata")
class HFDataset(Record):
AIM_NAME = "hf_datasets.Metadata"
DEFAULT_KEY = "train"

Expand Down
6 changes: 3 additions & 3 deletions pkgs/aimstack/ml/models/hub_dataset.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from aim._sdk.object import Object
from aim._sdk.record import Record
import hub


@Object.alias('hub.Dataset')
class HubDataset(Object):
@Record.alias('hub.Dataset')
class HubDataset(Record):
AIM_NAME = 'hub.Dataset'

def __init__(self, dataset: hub.Dataset):
Expand Down
5 changes: 3 additions & 2 deletions src/aimcore/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from aimcore.cli.init import commands as init_commands
from aimcore.cli.version import commands as version_commands
from aimcore.cli.up import commands as up_commands
from aimcore.cli.ui import commands as ui_commands
from aimcore.cli.server import commands as server_commands
from aimcore.cli.telemetry import commands as telemetry_commands
from aimcore.cli.package import commands as package_commands
Expand All @@ -19,7 +19,8 @@ def cli_entry_point():

cli_entry_point.add_command(init_commands.init)
cli_entry_point.add_command(version_commands.version)
cli_entry_point.add_command(up_commands.up)
cli_entry_point.add_command(ui_commands.ui)
cli_entry_point.add_command(ui_commands.up)
cli_entry_point.add_command(server_commands.server)
cli_entry_point.add_command(telemetry_commands.telemetry)
cli_entry_point.add_command(package_commands.package)
Expand Down
File renamed without changes.
14 changes: 11 additions & 3 deletions src/aimcore/cli/up/commands.py → src/aimcore/cli/ui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import click

from aimcore.cli.utils import set_log_level
from aimcore.cli.up.utils import build_db_upgrade_command, build_uvicorn_command, get_free_port_num
from aimcore.cli.ui.utils import build_db_upgrade_command, build_uvicorn_command, get_free_port_num
from aimcore.web.configs import (
AIM_UI_BASE_PATH,
AIM_UI_DEFAULT_HOST,
Expand All @@ -22,7 +22,7 @@
from aim._ext.tracking import analytics


@click.command('up')
@click.command('ui')
@click.option('-h', '--host', default=AIM_UI_DEFAULT_HOST, type=str)
@click.option('-p', '--port', default=AIM_UI_DEFAULT_PORT, type=int)
@click.option('-w', '--workers', default=1, type=int)
Expand All @@ -48,12 +48,15 @@
@click.option('--profiler', is_flag=True, default=False)
@click.option('--log-level', required=False, default='', type=str)
@click.option('-y', '--yes', is_flag=True, help='Automatically confirm prompt')
def up(dev, host, port, workers, uds,
def ui(dev, host, port, workers, uds,
repo,
package,
ssl_keyfile, ssl_certfile,
base_path,
profiler, log_level, yes):
"""
Start Aim UI with the --repo repository.
"""
if dev:
os.environ[AIM_ENV_MODE_KEY] = 'dev'
log_level = log_level or 'debug'
Expand Down Expand Up @@ -126,3 +129,8 @@ def up(dev, host, port, workers, uds,
except ShellCommandException:
click.echo('Failed to run Aim UI. Please see the logs above for details.')
return


@click.command('up', context_settings={'ignore_unknown_options': True, 'allow_extra_args': True}, hidden=True)
def up(**kwargs):
click.secho('Command `aim up` has been removed. Use `aim ui` instead.', fg='yellow')
File renamed without changes.
6 changes: 3 additions & 3 deletions src/python/aim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import aimrocks

from .object import Object
from .record import Record
from .sequence import Sequence
from .container import Container
from .repo import Repo
Expand All @@ -11,8 +11,8 @@
from aim._ext.tracking import analytics
from aim._sdk.package_utils import register_aimstack_packages, register_package

__all__ = ['Object', 'Sequence', 'Container', 'Repo', 'register_package']
__aim_types__ = [Sequence, Container, Object]
__all__ = ['Record', 'Sequence', 'Container', 'Repo', 'register_package']
__aim_types__ = [Sequence, Container, Record]

# python_version_deprecation_check()
analytics.track_install_event()
Expand Down
4 changes: 2 additions & 2 deletions src/python/aim/_ext/notebook/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def check_startup_success():
args_list.append(p + '=' + args[p])

child_process = subprocess.Popen(
['aim', 'up'] + args_list + ['-y'],
['aim', 'ui'] + args_list + ['-y'],
stderr=subprocess.PIPE,
stdout=subprocess.PIPE
)
# Runs `aim up <args>` command
# Runs `aim ui <args>` command
info = {
'port': args['--port'],
'host': 'http://' + args['--host']
Expand Down
8 changes: 4 additions & 4 deletions src/python/aim/_ext/notebook/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ def display_notebook(host, port, display, proxy_url=None):
display.update(iframe)


def up(options, context):
def ui(options, context):
"""
Calls to run `aim up` command width corresponding arguments
Calls to run `aim ui` command width corresponding arguments
Handles the result of the command
Renders the <iframe> tag for the notebook and message for the shell users
The <iframe> renders width the corresponding way for different execution contexts (mainly for notebooks)
Expand Down Expand Up @@ -173,7 +173,7 @@ def up(options, context):
port = result.info["port"]
host = result.info["host"]

# successful exec of aim up command
# successful exec of aim ui command
if context == _COLAB_EXEC_CONTEXT:
display_colab(port, display)
return
Expand All @@ -197,7 +197,7 @@ def version(options, context):
# Those are aim magic function available commands
# It is possible to add commands outside aim cli
handlers = {
'up': up,
'ui': ui,
'version': version
}

Expand Down
Loading
Loading