52
52
ServerRoleError ,
53
53
ServerRunTestsError ,
54
54
ServerShutdownError ,
55
+ ServerShutdownProgressError ,
55
56
ServerStatisticsError ,
56
57
ServerStatusError ,
57
58
ServerTimeError ,
@@ -471,14 +472,21 @@ def response_handler(resp: Response) -> Json:
471
472
472
473
return self ._execute (request , response_handler )
473
474
474
- def shutdown (self ) -> Result [bool ]: # pragma: no cover
475
+ def shutdown (self , soft : bool = False ) -> Result [bool ]: # pragma: no cover
475
476
"""Initiate server shutdown sequence.
476
477
478
+ :param soft: If set to true, this initiates a soft shutdown. This is only
479
+ available on Coordinators. When issued, the Coordinator tracks a number
480
+ of ongoing operations, waits until all have finished, and then shuts
481
+ itself down normally. It will still accept new operations.
482
+ :type soft: bool
477
483
:return: True if the server was shutdown successfully.
478
484
:rtype: bool
479
485
:raise arango.exceptions.ServerShutdownError: If shutdown fails.
480
486
"""
481
- request = Request (method = "delete" , endpoint = "/_admin/shutdown" )
487
+ request = Request (
488
+ method = "delete" , endpoint = "/_admin/shutdown" , params = {"soft" : soft }
489
+ )
482
490
483
491
def response_handler (resp : Response ) -> bool :
484
492
if not resp .is_success :
@@ -487,6 +495,26 @@ def response_handler(resp: Response) -> bool:
487
495
488
496
return self ._execute (request , response_handler )
489
497
498
+ def shutdown_progress (self ) -> Result [Json ]: # pragma: no cover
499
+ """Query the soft shutdown progress. This call reports progress about a
500
+ soft Coordinator shutdown (DELETE /_admin/shutdown?soft=true). This API
501
+ is only available on Coordinators.
502
+
503
+ :return: Information about the shutdown progress.
504
+ :rtype: dict
505
+ :raise arango.exceptions.ServerShutdownError: If shutdown fails.
506
+ """
507
+ request = Request (method = "get" , endpoint = "/_admin/shutdown" )
508
+
509
+ def response_handler (resp : Response ) -> Json :
510
+ if not resp .is_success :
511
+ raise ServerShutdownProgressError (resp , request )
512
+
513
+ result : Json = resp .body
514
+ return result
515
+
516
+ return self ._execute (request , response_handler )
517
+
490
518
def run_tests (self , tests : Sequence [str ]) -> Result [Json ]: # pragma: no cover
491
519
"""Run available unittests on the server.
492
520
0 commit comments