コード例 #1
0
    def test_status_mappings(self):
        # test enum to string mappings
        self.assertEqual("RUNNING", RunStatus.to_string(RunStatus.RUNNING))
        self.assertEqual(RunStatus.RUNNING, RunStatus.from_string("RUNNING"))

        self.assertEqual("SCHEDULED", RunStatus.to_string(RunStatus.SCHEDULED))
        self.assertEqual(RunStatus.SCHEDULED,
                         RunStatus.from_string("SCHEDULED"))

        self.assertEqual("FINISHED", RunStatus.to_string(RunStatus.FINISHED))
        self.assertEqual(RunStatus.FINISHED, RunStatus.from_string("FINISHED"))

        self.assertEqual("FAILED", RunStatus.to_string(RunStatus.FAILED))
        self.assertEqual(RunStatus.FAILED, RunStatus.from_string("FAILED"))

        self.assertEqual("KILLED", RunStatus.to_string(RunStatus.KILLED))
        self.assertEqual(RunStatus.KILLED, RunStatus.from_string("KILLED"))

        with self.assertRaises(Exception) as e:
            RunStatus.to_string(-120)
        self.assertIn("Could not get string corresponding to run status -120",
                      str(e.exception))

        with self.assertRaises(Exception) as e:
            RunStatus.from_string("the IMPOSSIBLE status string")
        self.assertIn(
            "Could not get run status corresponding to string the IMPO",
            str(e.exception))
コード例 #2
0
    def set_terminated(self, run_id, status=None, end_time=None):
        """Set a run's status to terminated.

        :param status: A string value of :py:class:`mlflow.entities.RunStatus`.
                       Defaults to "FINISHED".
        :param end_time: If not provided, defaults to the current time."""
        end_time = end_time if end_time else int(time.time() * 1000)
        status = status if status else RunStatus.to_string(RunStatus.FINISHED)
        self.store.update_run_info(run_id,
                                   run_status=RunStatus.from_string(status),
                                   end_time=end_time)
コード例 #3
0
ファイル: file_store.py プロジェクト: iPieter/kiwi
def _make_persisted_run_info_dict(run_info):
    # 'tags' was moved from RunInfo to RunData, so we must keep storing it in the meta.yaml for
    # old mlflow versions to read
    run_info_dict = dict(run_info)
    run_info_dict['tags'] = []
    run_info_dict['name'] = ''
    if 'status' in run_info_dict:
        # 'status' is stored as an integer enum in meta file, but RunInfo.status field is a string.
        # Convert from string to enum/int before storing.
        run_info_dict['status'] = RunStatus.from_string(run_info.status)
    else:
        run_info_dict['status'] = RunStatus.RUNNING
    run_info_dict['source_type'] = SourceType.LOCAL
    run_info_dict['source_name'] = ''
    run_info_dict['entry_point_name'] = ''
    run_info_dict['source_version'] = ''
    return run_info_dict
コード例 #4
0
def validate_exit_status(status_str, expected):
    assert RunStatus.from_string(status_str) == expected