Ejemplo n.º 1
0
def generate_docs():
  docs = []

  #filter for images in the conf that have the generate_docs flag set to true
  image_configs = filter(lambda image: image["automated_flags"]["generate_docs"] == True and image["automated_flags"]["include_in_ui"] == True and image["automated_flags"]["build"] == True, config["image_data"])
  remote_docs = get_current_versions()

  #maps the current documentation to a map of {image_name: version} key values
  remote_versions_list = list(map(lambda image_doc: {image_doc["id"]: image_doc["version"]}, remote_docs))
  remote_versions = utils.flatten_list_of_dicts(remote_versions_list)

  print "current versions detected: " + str(remote_versions)

  for image_config in image_configs:
      # Here we check first if the remote documentation exists, then if the local version is the same as the remote. 
      # If the remote documentation exists and the version matches the local, we re-use the old documentation
      if image_config["name"] in remote_versions and image_config["version"] == remote_versions[image_config["name"]]:
        remote_doc = list(filter(lambda image_doc: image_doc["id"] == image_config["name"], remote_docs))[0]
        print "using remote doc: {}".format(remote_doc)
        doc = remote_doc
      else:
        doc = generate_doc_for_image(image_config)

      docs.append(doc)

  docs.extend(get_other_docs())
  return docs
def get_docs(params):
  tools = params.image_config["tools"]
  doc_builder = get_doc_builder()

  docs = {}
  for tool in tools:
    print "Writing doc for tool {}".format(tool)
      #flattens the arrays of objects with packages:version key value pairs into single object with all key value pairs
    docs[tool] = utils.flatten_list_of_dicts(doc_builder[tool](params))

  return docs
def generate_docs():
    docs = []

    #filter for images in the conf that have the generate_docs flag set to true
    image_configs = filter(
        lambda image: image["automated_flags"]["generate_docs"] == True and
        image["automated_flags"]["include_in_ui"] == True and image[
            "automated_flags"]["build"] == True, config["image_data"])
    remote_docs = get_current_versions()

    #maps the current documentation to a map of {image_name: version} key values
    remote_versions_list = list(
        map(lambda image_doc: {image_doc["id"]: image_doc["version"]},
            remote_docs))
    remote_versions = utils.flatten_list_of_dicts(remote_versions_list)

    print "current versions detected: " + str(remote_versions)

    legacy_gatk_doc = filter(
        lambda remote_doc: remote_doc["id"] == "terra-jupyter-gatk_legacy",
        remote_docs)[0]
    legacy_bioconductor_doc = utils.read_json_file(static_config_location)[
        0]  # hard coding this until next bioconductor release (~06/2022)

    for image_config in image_configs:
        # Here we check first if the remote documentation exists, then if the local version is the same as the remote.
        # If the remote documentation exists and the version matches the local, we re-use the old documentation

        remote_doc = list(
            filter(lambda image_doc: image_doc["id"] == image_config["name"],
                   remote_docs))[0]
        if image_config["name"] in remote_versions and image_config[
                "version"] == remote_versions[image_config["name"]]:
            print "using remote doc: {}".format(remote_doc)
            doc = remote_doc
        else:
            doc = generate_doc_for_image(image_config)

        #Computing legacy  images for gatk and bioconductor
        if image_config["name"] == "terra-jupyter-gatk":
            legacy_gatk_doc = get_legacy_image(image_config["version"],
                                               remote_doc, legacy_gatk_doc)

        # TODO: add back in after next bioconductor release (~06/2022)
        #if image_config["name"] == "terra-jupyter-bioconductor":
        #legacy_bioconductor_doc = get_legacy_image(image_config["version"], doc)

        docs.append(doc)

    docs.extend(get_other_docs())
    docs.extend([legacy_gatk_doc, legacy_bioconductor_doc])
    return docs