Skip to content

Commit

Permalink
[Logging architecture refactor] Remove unused metrics related code in…
Browse files Browse the repository at this point in the history
… nni trial_tools, support kubeflow mode for logging architecture refactor (microsoft#551)

* Remove unused metrics related code in nni trial_tools, support kubeflow mode for logging architecture refactor
  • Loading branch information
yds05 authored Jan 2, 2019
1 parent ce1bc48 commit 37354df
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 136 deletions.
4 changes: 2 additions & 2 deletions src/sdk/pynni/nni/platform/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
os.makedirs(_outputdir)

_nni_platform = os.environ['NNI_PLATFORM']
if _nni_platform != 'pai':
if _nni_platform not in ['pai', 'kubeflow']:
_log_file_path = os.path.join(_outputdir, 'trial.log')
init_logger(_log_file_path)

Expand Down Expand Up @@ -77,7 +77,7 @@ def get_next_parameter():
return params

def send_metric(string):
if _nni_platform == 'pai':
if _nni_platform in ['pai', 'kubeflow']:
data = (string).encode('utf8')
assert len(data) < 1000000, 'Metric too long'
print('NNISDK_ME%s' % (data))
Expand Down
5 changes: 1 addition & 4 deletions tools/nni_trial_tool/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@

STDERR_FULL_PATH = os.path.join(LOG_DIR, 'stderr')

UPDATE_METRICS_API = '/update-metrics'

STDOUT_API = '/stdout'
NNI_SYS_DIR = os.environ['NNI_SYS_DIR']
NNI_TRIAL_JOB_ID = os.environ['NNI_TRIAL_JOB_ID']
NNI_EXP_ID = os.environ['NNI_EXP_ID']

NNI_EXP_ID = os.environ['NNI_EXP_ID']
122 changes: 0 additions & 122 deletions tools/nni_trial_tool/metrics_reader.py

This file was deleted.

4 changes: 1 addition & 3 deletions tools/nni_trial_tool/trial_keeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from .constants import HOME_DIR, LOG_DIR, NNI_PLATFORM, STDOUT_FULL_PATH, STDERR_FULL_PATH
from .hdfsClientUtility import copyDirectoryToHdfs, copyHdfsDirectoryToLocal
from .log_utils import LogType, nni_log, RemoteLogger, PipeLogReader, StdOutputType
from .metrics_reader import read_experiment_metrics

logger = logging.getLogger('trial_keeper')

Expand Down Expand Up @@ -65,8 +64,7 @@ def main_loop(args):

while True:
retCode = process.poll()
## Read experiment metrics, to avoid missing metrics
#read_experiment_metrics(args.nnimanager_ip, args.nnimanager_port)
# child worker process exits and all stdout data is read
if retCode is not None and log_pipe_stdout.is_read_completed == True:
nni_log(LogType.Info, 'subprocess terminated. Exit code is {}. Quit'.format(retCode))
if args.pai_hdfs_output_dir is not None:
Expand Down
6 changes: 1 addition & 5 deletions tools/nni_trial_tool/url_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from .constants import API_ROOT_URL, BASE_URL, UPDATE_METRICS_API, STDOUT_API, NNI_TRIAL_JOB_ID, NNI_EXP_ID

def gen_update_metrics_url(ip, port):
'''Generate update trial metrics url'''
return '{0}:{1}{2}{3}/{4}/{5}'.format(BASE_URL.format(ip), port, API_ROOT_URL, UPDATE_METRICS_API, NNI_EXP_ID, NNI_TRIAL_JOB_ID)
from .constants import API_ROOT_URL, BASE_URL, STDOUT_API, NNI_TRIAL_JOB_ID, NNI_EXP_ID

def gen_send_stdout_url(ip, port):
'''Generate send stdout url'''
Expand Down

0 comments on commit 37354df

Please sign in to comment.