2
2
# Licensed under the MIT License.
3
3
"""Main entrypoint."""
4
4
5
-
6
5
import argparse
7
6
8
7
9
- def parse_args ():
8
+ def create_args_parser ():
10
9
parser = argparse .ArgumentParser (
11
10
description = 'Python Azure Functions Worker' )
12
11
parser .add_argument ('--host' ,
@@ -26,18 +25,19 @@ def parse_args():
26
25
'syslog, or a file path' )
27
26
parser .add_argument ('--grpcMaxMessageLength' , type = int ,
28
27
dest = 'grpc_max_msg_len' )
29
- parser .add_argument ('--functions-uri' , dest = 'functions_uri' ,
28
+ parser .add_argument ('--functions-uri' , dest = 'functions_uri' , type = str ,
30
29
help = 'URI with IP Address and Port used to'
31
30
' connect to the Host via gRPC.' )
32
31
parser .add_argument ('--functions-request-id' , dest = 'functions_request_id' ,
33
- help = 'Request ID used for gRPC communication '
34
- 'with the Host.' )
35
- parser .add_argument ('--functions-worker-id' , dest = 'functions_worker_id' ,
32
+ type = str , help = 'Request ID used for gRPC communication '
33
+ 'with the Host.' )
34
+ parser .add_argument ('--functions-worker-id' ,
35
+ dest = 'functions_worker_id' , type = str ,
36
36
help = 'Worker ID assigned to this language worker.' )
37
37
parser .add_argument ('--functions-grpc-max-message-length' , type = int ,
38
38
dest = 'functions_grpc_max_msg_len' ,
39
39
help = 'Max grpc message length for Functions' )
40
- return parser . parse_args ()
40
+ return parser
41
41
42
42
43
43
def main ():
@@ -49,7 +49,8 @@ def main():
49
49
from ._thirdparty import aio_compat
50
50
from .logging import error_logger , logger , format_exception
51
51
52
- args = parse_args ()
52
+ parser = create_args_parser ()
53
+ args = parser .parse_args ()
53
54
logging .setup (log_level = args .log_level , log_destination = args .log_to )
54
55
55
56
logger .info ('Starting Azure Functions Python Worker.' )
0 commit comments