def test_compute_on_cloud():
    config = parse_config("./tests/osmosis.ini")
    osm_data = DataPlugin('./tests/osmosis.ini')
    osm_computing = ComputingPlugin('./tests/osmosis.ini')
    elements_before_compute = len(
        osm_data.list(config.get('azure.share.output'), False,
                      config.get('azure.account.name')))
    result_file = osm_computing.exec_container(
        asset_url="data.txt",
        algorithm_url="algo.py",
        resource_group_name=config.get('azure.resource_group'),
        account_name=config.get('azure.account.name'),
        account_key=config.get('azure.account.key'),
        share_name_input=config.get('azure.share.input'),
        share_name_output=config.get('azure.share.output'),
        location=config.get('azure.location'),
        # input_mount_point=data.get('input_mount_point'),
        # output_mount_point=data.get('output_mount_point'),
        docker_image='python:3.6-alpine',
        memory=1.5,
        cpu=1)
    assert len(
        osm_data.list(
            config.get('azure.share.output'), False,
            config.get('azure.account.name'))) == elements_before_compute + 1
    osm_data.delete('https://testocnfiles.file.core.windows.net/output/' +
                    result_file)
Example #2
0
def test_compute_on_cloud(client):
    # disable compute until it is supported in next release.
    return
    osm = Osmosis(file_path='config_local.ini')
    config = parse_config(file_path='config_local.ini')
    elements_before_compute = len(
        osm.data_plugin.list(
            get_env_property(config, 'AZURE_SHARE_OUTPUT',
                             'azure.share.output'), False,
            get_env_property(config, 'AZURE_ACCOUNT_NAME',
                             'azure.account.name')))
    post = client.post(BaseURLs.BASE_BRIZO_URL + '/services/compute',
                       data=json.dumps(json_brizo),
                       content_type='application/json')
    assert len(
        osm.data_plugin.list(
            get_env_property(config, 'AZURE_SHARE_OUTPUT',
                             'azure.share.output'), False,
            get_env_property(
                config, 'AZURE_ACCOUNT_NAME',
                'azure.account.name'))) == elements_before_compute + 1
    osm.data_plugin.delete(
        'https://testocnfiles.file.core.windows.net/output/' +
        post.data.decode('utf-8'))
def test_parse_config():
    config = parse_config('./tests/osmosis.ini')
    assert config['module'] == 'azure'
Example #4
0
def test_parse_config():
    config = parse_config('./tests/osmosis.ini')
    assert config['azure.location'] == 'westus'