|
1 |
| -"""Main entrypoint.""" |
2 |
| - |
3 |
| - |
4 |
| -try: |
5 |
| - from azure.functions_worker.main import main |
6 |
| - |
7 |
| -except ImportError: |
8 |
| - # Compatibility with hard-bundled pre-beta worker versions in |
9 |
| - # deployed function apps. |
10 |
| - import argparse |
11 |
| - import traceback |
12 |
| - |
13 |
| - def parse_args(): |
14 |
| - parser = argparse.ArgumentParser( |
15 |
| - description='Python Azure Functions Worker') |
16 |
| - parser.add_argument('--host') |
17 |
| - parser.add_argument('--port', type=int) |
18 |
| - parser.add_argument('--workerId', dest='worker_id') |
19 |
| - parser.add_argument('--requestId', dest='request_id') |
20 |
| - parser.add_argument('--log-level', type=str, default='INFO', |
21 |
| - choices=['TRACE', 'INFO', 'WARNING', 'ERROR'],) |
22 |
| - parser.add_argument('--log-to', type=str, default=None, |
23 |
| - help='log destination: stdout, stderr, ' |
24 |
| - 'syslog, or a file path') |
25 |
| - parser.add_argument('--grpcMaxMessageLength', type=int, |
26 |
| - dest='grpc_max_msg_len') |
27 |
| - return parser.parse_args() |
28 |
| - |
29 |
| - def main(): |
30 |
| - args = parse_args() |
31 |
| - |
32 |
| - import azure.functions # NoQA |
33 |
| - import azure.functions_worker |
34 |
| - from azure.functions_worker import aio_compat |
35 |
| - |
36 |
| - try: |
37 |
| - return aio_compat.run(azure.functions_worker.start_async( |
38 |
| - args.host, args.port, args.worker_id, args.request_id, |
39 |
| - args.grpc_max_msg_len)) |
40 |
| - except Exception: |
41 |
| - print(traceback.format_exc(), flush=True) |
42 |
| - raise |
43 |
| - |
| 1 | +from azure.functions_worker import main |
44 | 2 |
|
45 | 3 | if __name__ == '__main__':
|
46 |
| - main() |
| 4 | + main.main() |
0 commit comments