

def _construct_data_source_url(url, job_exec_id):
    'Resolve placeholders in data_source URL.\n\n    Supported placeholders:\n\n    * %RANDSTR(len)% - will be replaced with random string of lowercase\n                       letters of length `len`.\n    * %JOB_EXEC_ID%  - will be replaced with the job execution ID.\n\n    '

    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('%RANDSTR\\((\\d+)\\)%', _randstr, url)
    return url

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