Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Refactor nnictl to support listing stopped experiments. #256

Merged
merged 58 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
dc780cd
Merge pull request #1 from Microsoft/master
SparkSnail Sep 14, 2018
86243e7
Merge pull request #2 from Microsoft/master
SparkSnail Sep 14, 2018
3d1e4e9
fix nnictl bug
Sep 14, 2018
6d09780
Merge pull request #4 from Microsoft/master
SparkSnail Sep 17, 2018
0d24158
Merge branch 'master' of https://github.com/SparkSnail/nni
Sep 18, 2018
6d669c6
Merge pull request #6 from Microsoft/master
SparkSnail Sep 19, 2018
af2615d
Merge pull request #8 from Microsoft/master
SparkSnail Sep 20, 2018
f6b7c0a
Merge pull request #9 from Microsoft/master
SparkSnail Sep 24, 2018
a74febc
Merge pull request #10 from Microsoft/master
SparkSnail Sep 25, 2018
334b0a4
Merge pull request #12 from Microsoft/master
SparkSnail Sep 27, 2018
efe93df
Merge pull request #13 from Microsoft/master
SparkSnail Sep 27, 2018
0d9b074
Merge branch 'master' of https://github.com/SparkSnail/nni
Sep 28, 2018
421ad1a
Merge pull request #16 from Microsoft/master
SparkSnail Sep 30, 2018
660a8f8
Merge branch 'master' of https://github.com/SparkSnail/nni
Sep 30, 2018
2b01089
fix install.sh
Sep 30, 2018
951e80e
Merge pull request #17 from Microsoft/master
SparkSnail Oct 1, 2018
90fe674
Merge pull request #18 from Microsoft/master
SparkSnail Oct 7, 2018
2ccf0ed
Merge pull request #19 from Microsoft/master
SparkSnail Oct 8, 2018
77aacee
Merge pull request #20 from Microsoft/master
SparkSnail Oct 8, 2018
9e23dfe
Merge pull request #22 from Microsoft/master
SparkSnail Oct 8, 2018
ca7bbe4
Merge pull request #24 from Microsoft/master
SparkSnail Oct 10, 2018
346badd
add desc for Dockerfile.build.base
Oct 10, 2018
4af27d6
Merge pull request #27 from Microsoft/master
SparkSnail Oct 11, 2018
46a8350
update document for Dockerfile
Oct 11, 2018
4e3697f
Merge pull request #29 from Microsoft/master
SparkSnail Oct 12, 2018
4cd95aa
Merge pull request #30 from Microsoft/master
SparkSnail Oct 15, 2018
405ce45
Merge pull request #31 from Microsoft/master
SparkSnail Oct 15, 2018
c3949e6
Merge pull request #32 from Microsoft/master
SparkSnail Oct 16, 2018
22c78fd
Merge pull request #33 from Microsoft/master
SparkSnail Oct 16, 2018
a870817
update
Oct 16, 2018
b45268c
refactor port detect
Oct 16, 2018
59626ec
update
Oct 16, 2018
31ea28b
Merge pull request #34 from Microsoft/master
SparkSnail Oct 16, 2018
2ca84c5
refactor NNICTLDOC.md
Oct 17, 2018
ab02c93
add document for pai and nnictl
Oct 17, 2018
5ff7b45
add default value for port
Oct 17, 2018
c1e835d
Merge pull request #35 from Microsoft/master
SparkSnail Oct 18, 2018
5ae146d
add exception handling in trial_keeper.py
Oct 18, 2018
1dde461
fix port bug
Oct 18, 2018
fe6a188
Merge pull request #36 from Microsoft/master
SparkSnail Oct 18, 2018
f7a5228
Merge pull request #37 from Microsoft/master
SparkSnail Oct 19, 2018
9fdf6d4
fix resume
Oct 19, 2018
c1285f8
fix nnictl resume and fix nnictl stop
Oct 19, 2018
af0d081
fix document
Oct 19, 2018
7ce8fd8
update
Oct 19, 2018
b29aaed
refactor nnictl
Oct 19, 2018
683833b
update
Oct 19, 2018
6149bf9
update doc
Oct 22, 2018
73bef2f
update
Oct 22, 2018
5c397f6
update nnictl
Oct 23, 2018
2c68171
fix comment
Oct 23, 2018
d0659d6
fix conflict
Oct 23, 2018
e64abbf
Merge branch 'Microsoft-master'
Oct 23, 2018
a70f7e7
Merge pull request #39 from Microsoft/master
SparkSnail Oct 23, 2018
8d14ca9
revert dockerfile
Oct 23, 2018
aeb7c66
update
Oct 23, 2018
a256549
update
Oct 23, 2018
3fb0bca
update
Oct 23, 2018
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
38 changes: 23 additions & 15 deletions docs/NNICTLDOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --experiment, -e| False| |ID of the experiment you want to resume|
| id| False| |The id of the experiment you want to resume|
| --port, -p| False| |Rest port of the experiment you want to resume|



Expand Down Expand Up @@ -87,8 +88,8 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| id| False| |ID of the experiment you want to set|
| --filename, -f| True| |the file storing your new search space|
| --id, -i| False| |ID of the experiment you want to set|

* __nnictl update concurrency__
* Description
Expand All @@ -103,8 +104,8 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| id| False| |ID of the experiment you want to set|
| --value, -v| True| |the number of allowed concurrent trials|
| --id, -i| False| |ID of the experiment you want to set|

* __nnictl update duration__
* Description
Expand All @@ -119,8 +120,8 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --value, -v| True| |the experiment duration will be NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days.|
| --id, -i| False| |ID of the experiment you want to set|
| id| False| |ID of the experiment you want to set|
| --value, -v| True| |the experiment duration will be NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days.|


* __nnictl trial__
Expand All @@ -137,7 +138,7 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --id, -i| False| |ID of the experiment you want to set|
| id| False| |ID of the experiment you want to set|

* __nnictl trial kill__
* Description
Expand All @@ -151,9 +152,8 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| id| False| |ID of the experiment you want to set|
| --trialid, -t| True| |ID of the trial you want to kill.|
| --id, -i| False| |ID of the experiment you want to set|




Expand All @@ -171,7 +171,7 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --id, -i| False| |ID of the experiment you want to set|
| id| False| |ID of the experiment you want to set|


* __nnictl experiment status__
Expand All @@ -186,17 +186,23 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --id, -i| False| |ID of the experiment you want to set|
| id| False| |ID of the experiment you want to set|


* __nnictl experiment list__
* Description

Show the id and start time of all running experiments.
Show the information of all the (running) experiments.
* Usage

nnictl experiment list

Options:

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| all| False| False|Show all of experiments, including stopped experiments.|



* __nnictl config show__
Expand All @@ -223,10 +229,11 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| id| False| |ID of the experiment you want to set|
| --head, -h| False| |show head lines of stdout|
| --tail, -t| False| |show tail lines of stdout|
| --path, -p| False| |show the path of stdout file|
| --id, -i| False| |ID of the experiment you want to set|


* __nnictl log stderr__
* Description
Expand All @@ -241,10 +248,11 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| id| False| |ID of the experiment you want to set|
| --head, -h| False| |show head lines of stderr|
| --tail, -t| False| |show tail lines of stderr|
| --path, -p| False| |show the path of stderr file|
| --id, -i| False| |ID of the experiment you want to set|


* __nnictl log trial__
* Description
Expand All @@ -259,7 +267,7 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --id, -I| False| |the id of trial|
| id| False| |the id of trial|


### Manage webui
Expand All @@ -276,4 +284,4 @@ nnictl webui

| Name, shorthand | Required|Default | Description |
| ------ | ------ | ------ |------ |
| --id, -i| False| |ID of the experiment you want to set|
| id| False| |ID of the experiment you want to set|
21 changes: 17 additions & 4 deletions tools/nnicmd/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

class Config:
'''a util class to load and save config'''
def __init__(self, port):
config_path = os.path.join(NNICTL_HOME_DIR, str(port))
def __init__(self, file_path):
config_path = os.path.join(NNICTL_HOME_DIR, str(file_path))
os.makedirs(config_path, exist_ok=True)
self.config_file = os.path.join(config_path, '.config')
self.config = self.read_file()
Expand Down Expand Up @@ -73,11 +73,24 @@ def __init__(self):
self.experiment_file = os.path.join(NNICTL_HOME_DIR, '.experiment')
self.experiments = self.read_file()

def add_experiment(self, id, port, time):
def add_experiment(self, id, port, time, file_name):
'''set {key:value} paris to self.experiment'''
self.experiments[id] = [port, time]
self.experiments[id] = {}
self.experiments[id]['port'] = port
self.experiments[id]['startTime'] = time
self.experiments[id]['endTime'] = 'N/A'
self.experiments[id]['status'] = 'running'
self.experiments[id]['fileName'] = file_name
self.write_file()

def update_experiment(self, id, key, value):
'''Update experiment'''
if id not in self.experiments:
return False
self.experiments[id][key] = value
self.write_file()
return True

def remove_experiment(self, id):
'''remove an experiment by id'''
if id in self.experiments:
Expand Down
4 changes: 3 additions & 1 deletion tools/nnicmd/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@
EXPERIMENT_START_FAILED_INFO = 'There is an experiment running in the port %d, please stop it first or set another port!\n' \
'You could use \'nnictl stop --port [PORT]\' command to stop an experiment!\nOr you could use \'nnictl create --config [CONFIG_PATH] --port [PORT]\' to set port!\n'

EXPERIMENT_ID_INFO = '-----------------------------------------------------------------------\n' \
EXPERIMENT_INFORMATION_FORMAT = '-----------------------------------------------------------------------\n' \
' Experiment information\n' \
'%s\n' \
'-----------------------------------------------------------------------\n'

EXPERIMENT_DETAIL_FORMAT = 'Id: %s Status: %s StartTime: %s EndTime: %s \n'

PACKAGE_REQUIREMENTS = {
'SMAC': 'smac_tuner'
}
Expand Down
Loading