Exemplo n.º 1
0
    def fill_cromwell_conf(self, cromwell_conf, working_dir, project):
        try:
            project_id = gce_get_metadata('project/project-id')

            if project and project != project_id:
                logging.warning("Overridding project ID %s with %s", project,
                                project_id)

        except requests.ConnectionError as e:
            logging.warning(
                "URLError trying to fetch project ID from Compute Engine metdata"
            )
            logging.warning(e)
            logging.warning("Assuming not running on Compute Engine")

            project_id = project

        new_conf_data = file_util.file_safe_substitute(
            cromwell_conf, {
                'project_id': project_id,
                'working_dir': working_dir
            })

        with open(cromwell_conf, 'w') as f:
            f.write(new_conf_data)
  def fill_cromwell_conf(self, cromwell_conf, working_dir, project):
    try:
      project_id = gce_get_metadata('project/project-id')

      if project and project != project_id:
        logging.warning("Overridding project ID %s with %s",
                        project, project_id)

    except urllib2.URLError as e:
      logging.warning(
          "URLError trying to fetch project ID from Compute Engine metdata")
      logging.warning(e)
      logging.warning("Assuming not running on Compute Engine")

      project_id = project

    new_conf_data = file_util.file_safe_substitute(cromwell_conf, {
        'project_id': project_id,
        'working_dir': working_dir
        })

    with open(cromwell_conf, 'wb') as f:
      f.write(new_conf_data)