コード例 #1
0
    def create_adapter_with_client_id(root_relative_path: str = None,
                                      specify_endpoint: bool = False,
                                      test_blob_hostname: bool = False):
        hostname = os.environ.get("ADLS_HOSTNAME")
        root_path = os.environ.get("ADLS_ROOTPATH")
        tenant = os.environ.get("ADLS_TENANT")
        client_id = os.environ.get("ADLS_CLIENTID")
        client_secret = os.environ.get("ADLS_CLIENTSECRET")

        if test_blob_hostname is True:
            hostname = hostname.replace('blob', 'dfs')

        if specify_endpoint:
            return ADLSAdapter(hostname=hostname,
                               root=AdlsTestHelper.get_full_root_path(
                                   root_path, root_relative_path),
                               tenant=tenant,
                               client_id=client_id,
                               secret=client_secret,
                               endpoint=AzureCloudEndpoint.AZURE_PUBLIC)

        return ADLSAdapter(hostname=hostname,
                           root=AdlsTestHelper.get_full_root_path(
                               root_path, root_relative_path),
                           tenant=tenant,
                           client_id=client_id,
                           secret=client_secret)
コード例 #2
0
ファイル: syms_test_helper.py プロジェクト: minettes/CDM
    def create_adapter_clientid_with_shared_key(adapter_num: int):
        hostname = os.environ.get('SYMS_TEST_ADLS{}_HOSTNAME'.format(adapter_num))
        root_path = os.environ.get('SYMS_TEST_ADLS{}_ROOTPATH'.format(adapter_num))
        shared_key = os.environ.get('SYMS_TEST_ADLS{}_SHAREDKEY'.format(adapter_num))


        return ADLSAdapter(hostname=hostname, root=root_path, shared_key=shared_key)
コード例 #3
0
    def create_adapter_with_shared_key(root_relative_path: str = None):
        hostname = os.environ.get("ADLS_HOSTNAME")
        root_path = os.environ.get("ADLS_ROOTPATH")
        shared_key = os.environ.get("ADLS_SHAREDKEY")

        adapter = ADLSAdapter(hostname=hostname,
                              root=AdlsTestHelper.get_full_root_path(
                                  root_path, root_relative_path),
                              shared_key=shared_key)

        return adapter
コード例 #4
0
    def create_adapter_with_shared_key(root_relative_path: str = None,
                                       test_blob_hostname: bool = False):
        hostname = os.environ.get("ADLS_HOSTNAME")
        root_path = os.environ.get("ADLS_ROOTPATH")
        shared_key = os.environ.get("ADLS_SHAREDKEY")

        if test_blob_hostname is True:
            hostname = hostname.replace('blob', 'dfs')

        return ADLSAdapter(hostname=hostname,
                           root=AdlsTestHelper.get_full_root_path(
                               root_path, root_relative_path),
                           shared_key=shared_key)
コード例 #5
0
    def create_adapter_with_client_id(root_relative_path: str = None):
        hostname = os.environ.get("ADLS_HOSTNAME")
        root_path = os.environ.get("ADLS_ROOTPATH")
        tenant = os.environ.get("ADLS_TENANT")
        client_id = os.environ.get("ADLS_CLIENTID")
        client_secret = os.environ.get("ADLS_CLIENTSECRET")

        adapter = ADLSAdapter(hostname=hostname,
                              root=AdlsTestHelper.get_full_root_path(
                                  root_path, root_relative_path),
                              tenant=tenant,
                              client_id=client_id,
                              secret=client_secret)

        return adapter
コード例 #6
0
ファイル: main.py プロジェクト: minettes/CDM
# Fake cdm, normaly use the CDM Standards adapter
# Mount it as the 'cdm' device, not the default so must use "cdm:/folder" to get there
corpus.storage.mount(
    'cdm',
    LocalAdapter(
        root=os.path.join(ROOT_PATH, '../../example-public-standards')))

corpus.storage.mount('local', LocalAdapter(root=model_json_root))
# Example how to mount to the ADLS - make sure the hostname and root entered here are also changed
# in the example.model.json file we load in the next section
corpus.storage.mount(
    'adls',
    ADLSAdapter(
        root='/<FILESYSTEM_NAME>',  # Container name
        hostname='<ACCOUNT_NAME>.dfs.core.windows.net',  # Blob endpoint
        tenant='72f988bf-86f1-41af-91ab-2d7cd011db47',  # Tenant ID (Microsoft)
        resource='https://storage.azure.com',  # Resource type
        client_id='<CLIENT_ID>',  # Test account client ID
        secret='<CLIENT_SECRET>'  # Test account secret
    ))

# ---------------------------------------------------------------------------------------------
# Create manifest from a local model.json file

loop = asyncio.get_event_loop()
task = loop.create_task(corpus.fetch_object_async('local:/model.json'))
manifest = loop.run_until_complete(task)

# ------------------------------------------------------------------------------------------------------------
# Explore entities and partitions defined in the model

print('Listing entity declarations:')