Esempio n. 1
0
def get_classifier_training_job_from_model(classifier_training_job_model):
    """Gets a classifier training job domain object from a classifier
    training job model.

    Args:
        classifier_training_job_model: ClassifierTrainingJobModel. Classifier
            training job instance in datastore.

    Returns:
        classifier_training_job: ClassifierTrainingJob. Domain object for the
            classifier training job.
    """
    classifier_data = fs_services.read_classifier_data(
        classifier_training_job_model.exp_id, classifier_training_job_model.id)
    return classifier_domain.ClassifierTrainingJob(
        classifier_training_job_model.id,
        classifier_training_job_model.algorithm_id,
        classifier_training_job_model.interaction_id,
        classifier_training_job_model.exp_id,
        classifier_training_job_model.exp_version,
        classifier_training_job_model.next_scheduled_check_time,
        classifier_training_job_model.state_name,
        classifier_training_job_model.status,
        classifier_training_job_model.training_data, classifier_data,
        classifier_training_job_model.data_schema_version)
Esempio n. 2
0
 def test_save_and_get_classifier_data(self):
     """Test that classifier data is stored and retrieved correctly."""
     fs_services.save_classifier_data('exp_id', 'job_id',
                                      self.classifier_data)
     classifier_data = fs_services.read_classifier_data('exp_id', 'job_id')
     self.assertEqual(classifier_data, self.classifier_data)