

def resolve_data_source_references(job_configs, job_exec_id, data_source_urls, cluster=None):
    "Resolve possible data_source references in job_configs.\n\n    Look for any string values in the 'args', 'configs', and 'params'\n    elements of job_configs which start with 'datasource://' or have\n    the form of a uuid.\n\n    For values beginning with 'datasource://', strip off the prefix\n    and search for a DataSource object with a name that matches the\n    value.\n\n    For values having the form of a uuid, search for a DataSource object\n    with an id that matches the value.\n\n    If a DataSource object is found for the value, replace the value\n    with the URL from the DataSource object. If any DataSource objects\n    are found which reference swift paths and contain credentials, set\n    credential configuration values in job_configs (use the first set\n    of swift credentials found).\n\n    If no values are resolved, return an empty list and a reference\n    to job_configs.\n\n    If any values are resolved, return a list of the referenced\n    data_source objects and a copy of job_configs with all of the\n    references replaced with URLs.\n    "
    (by_name, by_uuid) = may_contain_data_source_refs(job_configs)
    if (not (by_name or by_uuid)):
        return ([], job_configs)
    ctx = context.ctx()
    ds_seen = {
        
    }
    new_configs = {
        
    }

    def _resolve(value):
        kwargs = {
            
        }
        if (by_name and isinstance(value, six.string_types) and value.startswith(DATA_SOURCE_PREFIX)):
            value = value[len(DATA_SOURCE_PREFIX):]
            kwargs['name'] = value
        elif (by_uuid and uuidutils.is_uuid_like(value)):
            kwargs['id'] = value
        if kwargs:
            ds = conductor.data_source_get_all(ctx, **kwargs)
            if (len(ds) == 1):
                ds = ds[0]
                ds_seen[ds.id] = ds
                if (ds.id not in data_source_urls):
                    url = _construct_data_source_url(ds.url, job_exec_id)
                    runtime_url = _runtime_url(url, cluster)
                    data_source_urls[ds.id] = (url, runtime_url)
                return data_source_urls[ds.id][1]
        return value
    new_configs['configs'] = {k: _resolve(v) for (k, v) in six.iteritems(job_configs.get('configs', {
        
    }))}
    new_configs['params'] = {k: _resolve(v) for (k, v) in six.iteritems(job_configs.get('params', {
        
    }))}
    new_configs['args'] = [_resolve(a) for a in job_configs.get('args', [])]
    ds_seen = ds_seen.values()
    if (not ds_seen):
        return ([], job_configs)
    if (not job_configs.get('proxy_configs')):
        _add_credentials_for_data_sources(ds_seen, new_configs['configs'])
    else:
        new_configs['proxy_configs'] = {k: v for (k, v) in six.iteritems(job_configs.get('proxy_configs'))}
    return (ds_seen, new_configs)

dataset/ETHPy150Open openstack/sahara/sahara/service/edp/job_utils.py resolve_data_source_references/original