def execute_profile(profile):
    """Method to execute a profile (list of sql scripts) on an edw cluster.

  Execute a profile (list of sql scripts, identified by names) on a cluster and
  report a dictionary with the execution time.

  Arguments:
    profile: Profile to identify the sequence of scripts.

  Returns:
    A dictionary containing
      1. Individual script metrics: script name and its execution time (-1 if
         the script fails).
      2. Aggregated execution time: profile name and cumulative execution time.
  """
    execution_times = {}
    start_time = time.time()

    for script_index in tpc_profile_details.profile_dictionary[profile]:
        logfile_suffix = '{}_{}'.format(profile, str(script_index))
        script = '{}.sql'.format(str(script_index))
        script_performance = script_driver.execute_script(
            script, logfile_suffix)
        execution_times.update(json.loads(script_performance))
    profile_execution_wall_time = round((time.time() - start_time), 2)
    execution_times['wall_time'] = {
        'execution_time': profile_execution_wall_time,
        'job_id': 'undefined_job'
    }
    return json.dumps(execution_times)
def execute_profile(profile):
  """Method to execute a profile (list of sql scripts) on an edw cluster.

  Execute a profile (list of sql scripts, identified by names) on a cluster and
  report a dictionary with the execution time.

  Arguments:
    profile: Profile to identify the sequence of scripts.

  Returns:
    A dictionary containing
      1. Individual script metrics: script name and its execution time (-1 if
         the script fails).
      2. Aggregated execution time: profile name and cumulative execution time.
  """
  execution_times = {}
  start_time = time.time()

  for script_index in tpc_profile_details.profile_dictionary[profile]:
    logfile_suffix = '{}_{}'.format(profile, str(script_index))
    script = '{}.sql'.format(str(script_index))
    script_performance = script_driver.execute_script(script, logfile_suffix)
    execution_times.update(json.loads(script_performance))
  execution_times['wall_time'] = round((time.time() - start_time), 2)
  return json.dumps(execution_times)