00c717a1276ceb5570f7c77a7b58a07c19bfc56d,python/paddle_edl/distill/redis/server_register.py,,,#,87
Before Change
service_name = "DistillService"
if len(sys.argv) == 2:
port = int(sys.argv[1])
elif len(sys.argv) >= 3:
ip = sys.argv[1]
port = int(sys.argv[2])
if len(sys.argv) == 4:
service_name = sys.argv[3]
After Change
from redis_store import RedisStore
import argparse
parser = argparse.ArgumentParser(description="Server Register")
parser.add_argument(
"--db_endpoints",
type=str,
default="127.0.0.1:6379",
help="database endpoints, e.g. 127.0.0.1:6379 [default: %(default)s]")
parser.add_argument(
"--db_passwd",
type=str,
default=None,
help="detabase password [default: %(default)s]")
parser.add_argument(
"--db_type",
type=str,
default="redis",
help="database type, only support redis for now [default: %(default)s]")
parser.add_argument(
"--service_name",
type=str,
help="service name where the server is located",
required=True)
parser.add_argument(
"--server",
type=str,
help="endpoint of the server, e.g. 127.0.0.1:8888",
required=True)
// TODO. service_token
parser.add_argument(
"--service_token",
type=str,
default=None,
help="service token, which the same can register [default: %(default)s]"
)
args = parser.parse_args()
server = args.server
db_endpoints = args.db_endpoints.split(",")
redis_ip_port = db_endpoints[0].split(":")
server_ip_port = server.split(":")
store = RedisStore(redis_ip_port[0], int(redis_ip_port[1]))
register = ServerRegister(server_ip_port[0],
int(server_ip_port[1]), args.service_name, store)
register.start()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 22
Instances
Project Name: PaddlePaddle/edl
Commit Name: 00c717a1276ceb5570f7c77a7b58a07c19bfc56d
Time: 2020-06-02
Author: wangxi16@baidu.com
File Name: python/paddle_edl/distill/redis/server_register.py
Class Name:
Method Name:
Project Name: PaddlePaddle/edl
Commit Name: 00c717a1276ceb5570f7c77a7b58a07c19bfc56d
Time: 2020-06-02
Author: wangxi16@baidu.com
File Name: python/paddle_edl/distill/redis/server_register.py
Class Name:
Method Name:
Project Name: akkana/scripts
Commit Name: cb38a31627f152c22fb9e474c31b34da588e1134
Time: 2020-07-26
Author: akkana@shallowsky.com
File Name: starstack.py
Class Name:
Method Name:
Project Name: githubharald/SimpleHTR
Commit Name: 617e9e28a7c5ae3892043d79da55dfc86435f56b
Time: 2018-07-24
Author: harald_scheidl@hotmail.com
File Name: src/main.py
Class Name:
Method Name: