def load(cls, file_name): config = deserialize_config(file_name) skil_server = Skil.from_config() experiment = get_experiment_by_id(skil_server, config['experiment_id']) result = Model(model_id=config['model_id'], experiment=experiment, create=False) result.name = config['model_name'] return result
def test_experiment_yaml_serde(Skil): file_name = "./mock.yml" serialize_config(MOCK_CONFIG, file_name, 'yaml') config = deserialize_config(file_name) assert config == MOCK_CONFIG exp = Experiment.load(file_name, Skil()) assert exp.id == 'foo' os.remove(file_name)
def test_failed_serde(Skil): file_name = "./mock.fail" with pytest.raises(Exception): serialize_config(MOCK_CONFIG, file_name, 'foo') with open(file_name, 'w') as f: f.write('foobar') with pytest.raises(Exception): conf = deserialize_config(file_name) os.remove(file_name)
def load(cls, file_name): config = deserialize_config(file_name) skil_server = Skil.from_config() experiment = get_experiment_by_id(skil_server, config['experiment_id']) transform_type = config['transform_type'] result = Transform(transform_id=config['transform_id'], transform_type=transform_type, experiment=experiment, create=False) result.name = config['transform_name'] return result
def load(cls, file_name): config = deserialize_config(file_name) skil_server = skil.Skil.from_config() experiment = skil.experiments.get_experiment_by_id( skil_server, config['experiment_id']) model = skil.Model(model_id=config['model_id'], experiment=experiment, create=False) model.name = config['model_name'] deployment = skil.get_deployment_by_id(skil, config['deployment_id']) model_entity = skil_client.ModelEntity(id=config['model_entity_id']) return Service(skil=skil_server, model=model, deployment=deployment, model_entity=model_entity)