parse args. Returns: parser.parse_args().
()
| 365 | |
| 366 | |
| 367 | def parse_args(): |
| 368 | """ parse args. |
| 369 | |
| 370 | Returns: |
| 371 | parser.parse_args(). |
| 372 | """ |
| 373 | parser = argparse.ArgumentParser(description="Monitor") |
| 374 | parser.add_argument( |
| 375 | "--type", type=str, default='general', help="Type of remote server") |
| 376 | parser.add_argument( |
| 377 | "--remote_path", |
| 378 | type=str, |
| 379 | required=True, |
| 380 | help="The base path for the remote") |
| 381 | parser.add_argument( |
| 382 | "--remote_model_name", |
| 383 | type=str, |
| 384 | required=True, |
| 385 | help="The model name to be pulled from the remote") |
| 386 | parser.add_argument( |
| 387 | "--remote_donefile_name", |
| 388 | type=str, |
| 389 | required=True, |
| 390 | help="The donefile name that marks the completion of the remote model update" |
| 391 | ) |
| 392 | parser.add_argument( |
| 393 | "--local_path", type=str, required=True, help="Local work path") |
| 394 | parser.add_argument( |
| 395 | "--local_model_name", type=str, required=True, help="Local model name") |
| 396 | parser.add_argument( |
| 397 | "--local_timestamp_file", |
| 398 | type=str, |
| 399 | default='fluid_time_file', |
| 400 | help="The timestamp file used locally for hot loading, The file is considered to be placed in the `local_path/local_model_name` folder." |
| 401 | ) |
| 402 | parser.add_argument( |
| 403 | "--local_tmp_path", |
| 404 | type=str, |
| 405 | default='_serving_monitor_tmp', |
| 406 | help="The path of the folder where temporary files are stored locally. If it does not exist, it will be created automatically" |
| 407 | ) |
| 408 | parser.add_argument( |
| 409 | "--unpacked_filename", |
| 410 | type=str, |
| 411 | default=None, |
| 412 | help="If the model of the remote production is a packaged file, the unpacked file name should be set. Currently, only tar packaging format is supported." |
| 413 | ) |
| 414 | parser.add_argument( |
| 415 | "--interval", |
| 416 | type=int, |
| 417 | default=10, |
| 418 | help="The polling interval in seconds") |
| 419 | parser.add_argument( |
| 420 | "--debug", action='store_true', help="If set, output more details") |
| 421 | parser.set_defaults(debug=False) |
| 422 | # general monitor |
| 423 | parser.add_argument("--general_host", type=str, help="General remote host") |
| 424 | # ftp monitor |