onnxruntime/tools/python/get_submodules.py
Colin Versteeg 5ee0f185dc Add GRPC support to ONNX Runtime Server (#1144)
* add grpc

* add-submodule

* Revert "add-submodule"

This reverts commit e35994b25035ce310a98909658582bff759ee358.

* fix submodule

* IT BUILDS

* Initial commit of prediction_service_impl.cpp

* Server builds and runs!

* add request id, health and reflection. GRPC is done

* enable channelz for monitoring

* GRPC unit tests

* clang format

* add unit tests

* Add function tests for GRPC

* add grpc to model_zoo_tests

* revert update protobuf to 3.7.0

* update submodules

* builds but runs some gflags tests which fail

* get build working

* confine build changes to onnxruntime_server.cmake

* update build files

* code reveiw comments

* Maik's code review comments

* update cares version to fix compilation issue

* update build to fix c-ares

* code review comments

* update cgmanifest.json

* remove extraneous file

* Klein comments.

* update ci based on discussions for go dependency

* fix tag issue

* fix build issues

* remove stray submodule

* update dockerfile and build script

* dynamic linking changes

* update build script

* code review comments

* update dockerfile

* update script for mount

* code review comments
2019-07-18 11:10:38 -07:00

33 lines
1.2 KiB
Python

import pygit2
import argparse
import json
def format_component(submod):
return {"component":{"type":"git","git":{"commitHash":str(submod.head_id), "repositoryUrl":str(submod.url)}}}
def process_component(repo):
return [repo.lookup_submodule(submod) for submod in repo.listall_submodules()]
def recursive_process(base_repo):
processed_subs = []
repos_to_process = [base_repo]
while repos_to_process:
repo = repos_to_process.pop()
submodules = process_component(repo)
processed_subs.extend(submodules)
repos_to_process.extend([mod.open() for mod in submodules])
return {"Registrations":[format_component(component) for component in processed_subs]}
def main(repo_path, output_file):
repo = pygit2.Repository(repo_path)
registrations = recursive_process(repo)
with open(output_file, 'w') as f:
json.dump(registrations, f, indent=4, sort_keys=True)
if __name__=="__main__":
parser = argparse.ArgumentParser()
parser.add_argument("base_repository", help="path to base repository to get registrations for.")
parser.add_argument("-o", "--output", help="output file name.", default="cgmanifest.json")
args = parser.parse_args()
main(args.base_repository, args.output)