Ejemplo n.º 1
0
def test_get_config_override_profile():
    config = DatabricksConfig.from_token("yo", "lo")
    update_and_persist_config(TEST_PROFILE, config)
    try:
        provider = ProfileConfigProvider(TEST_PROFILE)
        set_config_provider(provider)
        config = get_config()
        assert config.host == "yo"
        assert config.token == "lo"
    finally:
        set_config_provider(None)
Ejemplo n.º 2
0
def test_get_config_override_custom():
    class TestConfigProvider(DatabricksConfigProvider):
        def get_config(self):
            return DatabricksConfig.from_token("Override", "Token!")

    try:
        provider = TestConfigProvider()
        set_config_provider(provider)
        config = get_config()
        assert config.host == "Override"
        assert config.token == "Token!"
    finally:
        set_config_provider(None)
Ejemplo n.º 3
0
def test_get_config_bad_override():
    with pytest.raises(Exception):
        set_config_provider("NotAConfigProvider")
Ejemplo n.º 4
0
# MAGIC 
# MAGIC Now train a binary classifier (using random forests) for predciting the target condition. We use MLFlow for tracking and registering the model, and use hyperopt for distributed hyper parameter tuning.

# COMMAND ----------

# DBTITLE 0,Temp fix for mlflow error message through load balancer
from databricks_cli.configure.provider import get_config_provider, set_config_provider, DatabricksConfigProvider
base_provider = get_config_provider()
  
class DynamicConfigProvider(DatabricksConfigProvider):
  def get_config(self):
    base_config = base_provider.get_config()
    base_config.insecure = True
    return base_config 
  
set_config_provider(DynamicConfigProvider())

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)


# COMMAND ----------

from pyspark.ml.classification import LogisticRegression

# Create initial LogisticRegression model
lr = LogisticRegression(labelCol="label", featuresCol="features", maxIter=10)

# Train model with Training Data
lrModel = lr.fit(training_encounters)