Skip to content

Commit

Permalink
Merge pull request #642 from KAMONOHASHI/master
Browse files Browse the repository at this point in the history
4.0.2リリースのためのマージ
  • Loading branch information
netresj authored Nov 10, 2022
2 parents 95e029d + 12ba120 commit 09be22b
Show file tree
Hide file tree
Showing 72 changed files with 4,750 additions and 163 deletions.
51 changes: 38 additions & 13 deletions cli/kamonohashi/cli/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from __future__ import print_function, absolute_import, with_statement

import os.path

import click
from kamonohashi.op import rest
import os.path
import posixpath

from kamonohashi.cli import configuration
from kamonohashi.cli import object_storage
from kamonohashi.cli import pprint
from kamonohashi.cli import util
from kamonohashi.op import rest


@click.group()
Expand Down Expand Up @@ -174,29 +174,54 @@ def download_files(id, file_id, destination):
object_storage.download_file(pool_manager, x.url, destination, x.file_name)


@inference.command('list-container-files')
@click.argument('id', type=int)
@click.option('-s', '--source', help='A path to the source root in the container')
def list_container_files(id, source):
"""List files in a container"""
api = rest.InferenceApi(configuration.get_api_client())

def list_entries(path):
result = api.list_inference_container_files(id, path=path, with_url=True)
for x in result.files:
print(posixpath.join(path, x.file_name))
for x in result.dirs:
list_entries(posixpath.join(path, x.dir_name))

source = posixpath.join('/', source or "")
list_entries(source)


@inference.command('download-container-files')
@click.argument('id', type=int)
@click.option('-d', '--destination', type=click.Path(exists=True, file_okay=False), required=True,
help='A path to the output files')
@click.option('-s', '--source', help='A path to the source root in the container')
def download_container_files(id, destination, source):
@click.option('-f', '--file-path', multiple=True, help='A file path in the container [multiple]')
def download_container_files(id, destination, source, file_path):
"""Download files in a container"""
api = rest.InferenceApi(configuration.get_api_client())
pool_manager = api.api_client.rest_client.pool_manager
sep = '/'

def download_entries(path):
result = api.list_inference_container_files(id, path=path, with_url=True)
for x in result.files:
if os.path.isabs(path):
_, tail = os.path.splitdrive(path)
object_storage.download_file(pool_manager, x.url, destination + tail, x.file_name)
else:
object_storage.download_file(pool_manager, x.url, os.path.join(destination, path), x.file_name)
object_storage.download_file(pool_manager, x.url, destination + path, x.file_name)
for x in result.dirs:
download_entries(os.path.join(path, x.dir_name))

source = source if source is not None else '/'
download_entries(source)
download_entries(posixpath.join(path, x.dir_name))

for x in file_path:
head, tail = posixpath.split(x)
head = posixpath.join(sep, head)
result = api.list_inference_container_files(id, path=head, with_url=True)
for y in result.files:
if tail == y.file_name:
object_storage.download_file(pool_manager, y.url, destination + head, y.file_name)

if not (source is None and file_path):
source = posixpath.join(sep, source or "")
download_entries(source)


@inference.command('delete-file')
Expand Down
51 changes: 38 additions & 13 deletions cli/kamonohashi/cli/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

from __future__ import print_function, absolute_import, with_statement

import os.path

import click
from kamonohashi.op import rest
import os.path
import posixpath

from kamonohashi.cli import configuration
from kamonohashi.cli import object_storage
from kamonohashi.cli import pprint
from kamonohashi.cli import util
from kamonohashi.op import rest


@click.group()
Expand Down Expand Up @@ -177,29 +177,54 @@ def download_files(id, file_id, destination):
object_storage.download_file(pool_manager, x.url, destination, x.file_name)


@training.command('list-container-files')
@click.argument('id', type=int)
@click.option('-s', '--source', help='A path to the source root in the container')
def list_container_files(id, source):
"""List files in a container"""
api = rest.TrainingApi(configuration.get_api_client())

def list_entries(path):
result = api.list_training_container_files(id, path=path, with_url=True)
for x in result.files:
print(posixpath.join(path, x.file_name))
for x in result.dirs:
list_entries(posixpath.join(path, x.dir_name))

source = posixpath.join('/', source or "")
list_entries(source)


@training.command('download-container-files')
@click.argument('id', type=int)
@click.option('-d', '--destination', type=click.Path(exists=True, file_okay=False), required=True,
help='A path to the output files')
@click.option('-s', '--source', help='A path to the source root in the container')
def download_container_files(id, destination, source):
@click.option('-f', '--file-path', multiple=True, help='A file path in the container [multiple]')
def download_container_files(id, destination, source, file_path):
"""Download files in a container"""
api = rest.TrainingApi(configuration.get_api_client())
pool_manager = api.api_client.rest_client.pool_manager
sep = '/'

def download_entries(path):
result = api.list_training_container_files(id, path=path, with_url=True)
for x in result.files:
if os.path.isabs(path):
_, tail = os.path.splitdrive(path)
object_storage.download_file(pool_manager, x.url, destination + tail, x.file_name)
else:
object_storage.download_file(pool_manager, x.url, os.path.join(destination, path), x.file_name)
object_storage.download_file(pool_manager, x.url, destination + path, x.file_name)
for x in result.dirs:
download_entries(os.path.join(path, x.dir_name))

source = source if source is not None else '/'
download_entries(source)
download_entries(posixpath.join(path, x.dir_name))

for x in file_path:
head, tail = posixpath.split(x)
head = posixpath.join(sep, head)
result = api.list_training_container_files(id, path=head, with_url=True)
for y in result.files:
if tail == y.file_name:
object_storage.download_file(pool_manager, y.url, destination + head, y.file_name)

if not (source is None and file_path):
source = posixpath.join(sep, source or "")
download_entries(source)


@training.command('delete-file')
Expand Down
50 changes: 31 additions & 19 deletions release-tools/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# リリース手順
## リリースするソースコードの指定
* GitHubでバージョン名リリースを作成(テストが終わるまでプレリリース)
* 例: 1.0.1
* git fetch upstream && git merge upstream/(バージョンブランチ) を実行
* 例: git merge upstream/1.0
## コンテナのビルド & リリース
* build-docker/build.shの実行
* docker loginでDockerHubにログイン
* build-docker/push.shの実行
## Python Packageのビルド & リリース
* build-pypi/setup.sh build の実行
* PyPiにログイン
* build-pypi/setup.sh test-upload の実行
* pip installの確認
* build-pypi/setup.sh master-upload の実行

# developリリース
* tagをつけずに`build-docker/build.sh`を実行するとdevelopタグでコンテナが作られる
# リリース手順

## リリースするソースコードの指定

- GitHub でバージョン名リリースを作成(テストが終わるまでプレリリース)
- 例: 1.0.1
- git fetch upstream && git merge upstream/(バージョンブランチ) を実行
- 例: git merge upstream/1.0

## コンテナのビルド & リリース

- build-docker/build.sh の実行
- docker login で DockerHub にログイン
- build-docker/push.sh の実行

## Python Package のビルド & リリース

- build-pypi/setup.sh build の実行
- PyPi にログイン
- build-pypi/setup.sh test-upload の実行
- pip install の確認
- build-pypi/setup.sh master-upload の実行

# develop リリース

- tag をつけずに`build-docker/build.sh`を実行すると develop タグでコンテナが作られる

# Notebook Image のビルド & リリース

ノートブック機能のデフォルトイメージを作成するための Dockerfile が`build-notebook-image`に配置されている。
毎回のリリースごとには実施せず、Python のマイナーバージョンのサポート終了や、コンテナ内で利用するパッケージに破壊的な変更が入った場合等にリリースを行う。
5 changes: 5 additions & 0 deletions release-tools/build-notebook-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM tensorflow/tensorflow:2.9.0-gpu

RUN pip install --upgrade pip \
&& pip install jupyterlab \
&& pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public class AccountOutputModel
/// </summary>
public string UserName { get; set; }

/// <summary>
/// ログインユーザ表示名
/// </summary>
public string UserDisplayName { get; set; }

/// <summary>
/// パスワード変更が可能か
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;

namespace Nssol.Platypus.ApiModels.AccountApiModels
{
public class DisplayNameInputModel
{
/// <summary>
/// ユーザ表示名
/// </summary>
public string DisplayName { get; set; }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ public DetailsOutputModel(Data data) : base(data)
FileNames = data.DataProperties?.Select(p => p.Key);
}

/// <summary>
/// 登録者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }

/// <summary>
/// データファイル名リスト
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public IndexOutputModel(Models.CustomModels.DataIndex data) : base()
DisplayId = data.DisplayId;
Name = data.Name;
Memo = data.Memo;
DisplayNameCreatedBy = data.DisplayNameCreatedBy;
IsRaw = data.ParentDataId == null;
ParentDataId = data.ParentDataId;
ParentDataName = data.ParentDataName;
Expand All @@ -50,6 +51,11 @@ public IndexOutputModel(Models.CustomModels.DataIndex data) : base()
/// </summary>
public long? DisplayId { get; set; }

/// <summary>
/// 登録者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }

/// <summary>
/// 名前
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ public DetailsOutputModel(DataSet dataSet) : base(dataSet)
{
}

/// <summary>
/// 登録者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }

/// <summary>
/// データセットのエントリ。キーにデータ種別、値にデータ情報集合を持つ。
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public InferenceDetailsOutputModel(InferenceHistory history) : base(history)
/// </summary>
public string StartedAt { get; set; }

/// <summary>
/// 登録者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }

/// <summary>
/// コンテナが実行されたノード名
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public DetailsOutputModel(NotebookHistory history) : base(history)
EntryPoint = history.EntryPoint;
}

/// <summary>
/// 登録者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }

/// <summary>
/// コンテナ名になる一意識別文字列
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public ContainerDetailsForTenantOutputModel(ContainerDetailsInfo info)
/// </summary>
public string CreatedBy { get; set; }

/// <summary>
/// 実行者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }

/// <summary>
/// コンテナ種別
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,12 @@ public ContainerDetailsOutputModel(ContainerDetailsInfo info) : base(info)
/// 表示名
/// </summary>
public string DisplayName { get; set; }

/// <summary>
/// 登録者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public DetailsOutputModel(TrainingHistory history) : base(history)
/// </summary>
public string CompletedAt { get; set; }

/// <summary>
/// 登録者表示名
/// </summary>
public string DisplayNameCreatedBy { get; set; }

/// <summary>
/// 開始日時
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public class CreateInputModel
[Controllers.Util.CustomValidation(Controllers.Util.CustomValidationType.Email)]
public string Name { get; set; }

/// <summary>
/// 表示名
/// </summary>
public string DisplayName { get; set; }

/// <summary>
/// パスワード
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public IndexForAdminOutputModel(User user) : base(user)
{
Id = user.Id;
Name = user.Name;
DisplayName = user.DisplayName;
ServiceType = user.ServiceType;
}

Expand All @@ -24,6 +25,11 @@ public IndexForAdminOutputModel(User user) : base(user)
/// </summary>
public string Name { get; set; }

/// <summary>
/// 表示名
/// </summary>
public string DisplayName { get; set; }

/// <summary>
/// 認証サービス種別
/// </summary>
Expand Down
Loading

0 comments on commit 09be22b

Please sign in to comment.