def _construct_data_source_url(url, job_exec_id):

    def _randstr(match):
        len = int(match.group(1))
        return ''.join(random.choice(string.ascii_lowercase)
                       for _ in six.moves.range(len))

    url = url.replace("%JOB_EXEC_ID%", job_exec_id)

    url = re.sub(r"%RANDSTR\((\d+)\)%", _randstr, url)

    return url
Resolve placeholders in data_source URL.
dataset/ETHPy150Open openstack/sahara/sahara/service/edp/job_utils.py/_construct_data_source_url