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

Commit

Permalink
fix nnictl experiment delete (delete log folder in ~/.local/nnictl) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JunweiSUN authored Aug 19, 2020
1 parent bbb9137 commit 593d2d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/nni_cmd/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

import os
import json
import shutil
from .constants import NNICTL_HOME_DIR
from .command_utils import print_error

class Config:
'''a util class to load and save config'''
Expand Down Expand Up @@ -77,7 +79,13 @@ def update_experiment(self, expId, key, value):
def remove_experiment(self, expId):
'''remove an experiment by id'''
if expId in self.experiments:
self.experiments.pop(expId)
fileName = self.experiments.pop(expId).get('fileName')
if fileName:
logPath = os.path.join(NNICTL_HOME_DIR, fileName)
try:
shutil.rmtree(logPath)
except FileNotFoundError:
print_error('{0} does not exist.'.format(logPath))
self.write_file()

def get_all_experiments(self):
Expand Down

0 comments on commit 593d2d2

Please sign in to comment.