示例#1
0
    def log_batch(self, run_id, metrics=(), params=(), tags=()):
        """
        Log multiple metrics, params, and/or tags.

        :param run_id: String ID of the run
        :param metrics: If provided, List of Metric(key, value, timestamp) instances.
        :param params: If provided, List of Param(key, value) instances.
        :param tags: If provided, List of RunTag(key, value) instances.

        Raises an MlflowException if any errors occur.
        :return: None
        """
        if len(metrics) == 0 and len(params) == 0 and len(tags) == 0:
            return
        if len(params) > 1:
            _validate_param_keys_unique(params)
        for metric in metrics:
            _validate_metric(metric.key, metric.value, metric.timestamp,
                             metric.step)
        for param in params:
            _validate_param_name(param.key)
        for tag in tags:
            _validate_tag_name(tag.key)
        self.store.log_batch(run_id=run_id,
                             metrics=metrics,
                             params=params,
                             tags=tags)
示例#2
0
 def log_batch(self, run_id, metrics, params, tags):
     _validate_run_id(run_id)
     _validate_batch_log_data(metrics, params, tags)
     _validate_batch_log_limits(metrics, params, tags)
     _validate_param_keys_unique(params)
     run_info = self._get_run_info(run_id)
     check_run_is_active(run_info)
     try:
         for param in params:
             self._log_run_param(run_info, param)
         for metric in metrics:
             self._log_run_metric(run_info, metric)
         for tag in tags:
             self._set_run_tag(run_info, tag)
     except Exception as e:
         raise MlflowException(e, INTERNAL_ERROR)