From bec06f5d5d2ecf6664174e7c17388f405183f633 Mon Sep 17 00:00:00 2001 From: ShenYuhan Date: Thu, 3 Sep 2020 10:19:02 +0800 Subject: [PATCH] add stat for product (#782) --- visualdl/server/app.py | 2 +- visualdl/server/args.py | 8 ++++++++ visualdl/utils/update_util.py | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/visualdl/server/app.py b/visualdl/server/app.py index d6e0ce99..59e1a856 100644 --- a/visualdl/server/app.py +++ b/visualdl/server/app.py @@ -63,7 +63,7 @@ def create_app(args): babel = Babel(app) api_call = create_api_call(args.logdir, args.model, args.cache_timeout) - update_util.PbUpdater().start() + update_util.PbUpdater(args.product).start() public_path = args.public_path api_path = public_path + '/api' diff --git a/visualdl/server/args.py b/visualdl/server/args.py index 114813d8..b8b80c9f 100644 --- a/visualdl/server/args.py +++ b/visualdl/server/args.py @@ -37,6 +37,7 @@ class DefaultArgs(object): self.api_only = args.get('api_only', False) self.open_browser = args.get('open_browser', False) self.model = args.get('model', '') + self.product = args.get('product', 'normal') def get_host(host=default_host, port=default_port): @@ -94,6 +95,7 @@ class ParseArgs(object): self.api_only = args.api_only self.open_browser = args.open_browser self.model = args.model + self.product = args.product def parse_args(): @@ -172,6 +174,12 @@ def parse_args(): action="version", version="%(prog)s {}".format(__version__) ) + parser.add_argument( + "--product", + type=str, + action="store", + default="normal", + help="specify the product") args = parser.parse_args() diff --git a/visualdl/utils/update_util.py b/visualdl/utils/update_util.py index 7661b1f3..bf730d4e 100644 --- a/visualdl/utils/update_util.py +++ b/visualdl/utils/update_util.py @@ -29,7 +29,8 @@ def md5(text): class PbUpdater(threading.Thread): - def __init__(self): + def __init__(self, product='normal'): + self.product = product threading.Thread.__init__(self) def update_pb(self, @@ -39,7 +40,8 @@ class PbUpdater(threading.Thread): payload = { "data": { "version": version, - "md5": md5_code + "md5": md5_code, + "product": self.product } } url = 'https://paddlepaddle.org.cn/paddlehub/stat?from=vdl' -- GitLab