示例#1
0
def test_get_workspace_from_config():
    """ Test Get Workspace From Config File"""
    cfg = load_configuration(filepath + "/../workspace_conf.yml")

    get_or_create_workspace(cfg['workspace_name'], cfg['subscription_id'],
                            cfg['resource_group'], cfg['workspace_region'])

    workspace = get_workspace_from_config()
    assert isinstance(workspace, Workspace)
示例#2
0
def test_get_or_create_workspace():
    """Test Get or Create Workspace Method"""
    cfg = load_configuration(filepath + "/../workspace_conf.yml")

    workspace = get_or_create_workspace(cfg['workspace_name'],
                                        cfg['subscription_id'],
                                        cfg['resource_group'],
                                        cfg['workspace_region'])

    assert isinstance(workspace, Workspace)
    assert os.path.isfile('./.azureml/config.json')
def test_00_aml_configuration():
    cfg = load_configuration("../workspace_conf.yml")

    subscription_id = cfg['subscription_id']
    resource_group = cfg['resource_group']
    workspace_name = cfg['workspace_name']
    workspace_region = cfg['workspace_region']

    results = pm.execute_notebook('notebooks/00_AMLConfiguration.ipynb',
                                  'notebooks/00_AMLConfiguration.output_ipynb',
                                  parameters=dict(
                                      subscription_id=subscription_id,
                                      resource_group=resource_group,
                                      workspace_name=workspace_name,
                                      workspace_region=workspace_region),
                                  kernel_name="ai-architecture-template")

    for cell in results.cells:
        if cell.cell_type is "code":
            assert not cell.metadata.papermill.exception, "Error in Python Notebook"
示例#4
0
def test_load_configuration():

    cfg = load_configuration(filepath + "/../sample_workspace_conf.yml")
    assert cfg

    assert cfg['subscription_id'] == '<>'
    assert cfg['resource_group'] == '<>'
    assert cfg['workspace_name'] == '<>'
    assert cfg['workspace_region'] == '<>'
    assert cfg['image_name'] == '<>'

    assert cfg['sql_server_name'] == '<>'
    assert cfg['sql_database_name'] == '<>'
    assert cfg['sql_username'] == '<>'
    assert cfg['sql_password'] == '<>'

    assert cfg['datastore_rg'] == '<>'
    assert cfg['container_name'] == '<>'
    assert cfg['account_name'] == '<>'
    assert cfg['account_key'] == '<>'
示例#5
0
def init_test_vars():
    """
    Load Common Vars for Testing

    :return: CONFIG, SUBSCRIPTION_ID, RESOURCE_GROUP, WORKSPACE_NAME, WORKSPACE_REGION, workspace, SQL_DATASTORE_NAME,
    BLOB_DATASTORE_NAME
    :rtype: Union[Dict[Hashable, Any], list, None], str, str, str, str, Workspace, str, str
    """
    cfg = load_configuration(DIRECTORY + "/../workspace_conf.yml")

    subscription_id = cfg['subscription_id']
    resource_group = cfg['resource_group']
    workspace_name = cfg['workspace_name']
    workspace_region = cfg['workspace_region']

    workspace = get_or_create_workspace(workspace_name, subscription_id,
                                        resource_group, workspace_region)

    sql_datastore_name = "ado_sql_datastore"
    blob_datastore_name = "ado_blob_datastore"

    return cfg, subscription_id, resource_group, workspace_name, workspace_region, workspace, sql_datastore_name, \
           blob_datastore_name