Esempio n. 1
0
 def testMetric(self):
     track.init(trial_name="test_log")
     session = track.get_session()
     for i in range(5):
         track.log(test=i)
     result_path = os.path.join(session.logdir, EXPR_RESULT_FILE)
     self.assertTrue(_check_json_val(result_path, "test", i))
Esempio n. 2
0
    def testLocalMetrics(self):
        """Checks that metric state is updated correctly."""
        track.init(trial_name="test_logs")
        session = track.get_session()
        self.assertEqual(set(session.trial_config.keys()), {"trial_id"})

        result_path = os.path.join(session.logdir, EXPR_RESULT_FILE)
        track.log(test=1)
        self.assertTrue(_check_json_val(result_path, "test", 1))
        track.log(iteration=1, test=2)
        self.assertTrue(_check_json_val(result_path, "test", 2))
Esempio n. 3
0
    def testLogCreation(self):
        """Checks that track.init() starts logger and creates log files."""
        track.init(trial_name="test_init")
        session = track.get_session()
        self.assertTrue(session is not None)

        self.assertTrue(os.path.isdir(session.logdir))

        params_path = os.path.join(session.logdir, EXPR_PARAM_FILE)
        result_path = os.path.join(session.logdir, EXPR_RESULT_FILE)

        self.assertTrue(os.path.exists(params_path))
        self.assertTrue(os.path.exists(result_path))
        self.assertTrue(session.logdir == track.trial_dir())