def _cleanup(tb_hdfs_path): """ Args: tb_hdfs_path: Returns: """ handle = hopshdfs.get() if not tb_hdfs_path == None and not tb_hdfs_path == '' and handle.exists(tb_hdfs_path): handle.delete(tb_hdfs_path) hopshdfs._kill_logger()
def end(metric=None): """ End a custom Experiment previously registered with *begin* and register a metric to associate with it. Args: :metric: The metric to associate with the Experiment """ global running global experiment_json global elastic_id global driver_tensorboard_hdfs_path global app_id if not running: raise RuntimeError( "An experiment is not running. Did you forget to call experiment.end()?" ) try: if metric: experiment_json = util._finalize_experiment( experiment_json, None, str(metric)) util._put_elastic(hopshdfs.project_name(), app_id, elastic_id, experiment_json) else: experiment_json = util._finalize_experiment( experiment_json, None, None) util._put_elastic(hopshdfs.project_name(), app_id, elastic_id, experiment_json) except: _exception_handler() raise finally: elastic_id += 1 running = False handle = hopshdfs.get() if tensorboard.tb_pid != 0: subprocess.Popen(["kill", str(tensorboard.tb_pid)]) if tensorboard.local_logdir_bool: local_tb = tensorboard.local_logdir_path util._store_local_tensorboard(local_tb, tensorboard.events_logdir) if not tensorboard.endpoint == None and not tensorboard.endpoint == '' \ and handle.exists(tensorboard.endpoint): handle.delete(tensorboard.endpoint) hopshdfs._kill_logger()