4343 'user' : '-U' ,
4444}
4545
46+ pg_kill = os .kill
47+
4648class Cluster (pg_api .Cluster ):
4749 """
4850 Interface to a PostgreSQL cluster.
@@ -311,14 +313,26 @@ def restart(self, logfile = None, settings = None, timeout = 10):
311313 self .start (logfile = logfile , settings = settings )
312314 self .wait_until_started (timeout = timeout )
313315
316+ def reload (self ):
317+ """
318+ Signal the cluster to reload its configuration file.
319+ """
320+ pid = self .pid
321+ if pid is not None :
322+ try :
323+ pg_kill (pid , signal .SIGHUP )
324+ except OSError as e :
325+ if e .errno != errno .ESRCH :
326+ raise
327+
314328 def stop (self ):
315329 """
316330 Stop the cluster gracefully waiting for clients to disconnect(SIGTERM).
317331 """
318332 pid = self .pid
319333 if pid is not None :
320334 try :
321- os . kill (pid , signal .SIGTERM )
335+ pg_kill (pid , signal .SIGTERM )
322336 except OSError as e :
323337 if e .errno != errno .ESRCH :
324338 raise
@@ -330,7 +344,7 @@ def shutdown(self):
330344 pid = self .pid
331345 if pid is not None :
332346 try :
333- os . kill (pid , signal .SIGINT )
347+ pg_kill (pid , signal .SIGINT )
334348 except OSError as e :
335349 if e .errno != errno .ESRCH :
336350 raise
@@ -344,7 +358,7 @@ def kill(self):
344358 pid = self .pid
345359 if pid is not None :
346360 try :
347- os . kill (pid , signal .SIGKILL )
361+ pg_kill (pid , signal .SIGKILL )
348362 except OSError as e :
349363 if e .errno != errno .ESRCH :
350364 raise
@@ -374,7 +388,7 @@ def running(self):
374388 if pid is None :
375389 return False
376390 try :
377- os . kill (pid , signal .SIG_DFL )
391+ pg_kill (pid , signal .SIG_DFL )
378392 except OSError as e :
379393 if e .errno != errno .ESRCH :
380394 raise
0 commit comments