Skip to content

Commit 98f3ed1

Browse files
committed
working restart core method
1 parent ad7dcc3 commit 98f3ed1

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

module/Api.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ def kill(self):
238238
self.core.do_kill = True
239239

240240
def restart(self):
241-
"""Not working, not likely to ever will"""
242-
pass
243-
#self.core.do_restart = True
241+
"""Restart pyload core"""
242+
self.core.do_restart = True
244243

245244
@permission(PERMS.STATUS)
246245
def getLog(self, offset=0):

module/remote/thriftbackend/ThriftClient.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __getattr__(self, item):
8888

8989
if __name__ == "__main__":
9090

91-
client = ThriftClient(user="User", password="")
91+
client = ThriftClient(user="User", password="pwhere")
9292

9393
print client.getServerVersion()
9494
print client.statusServer()

pyLoadCore.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import logging
3131
import logging.handlers
3232
import os
33-
from os import _exit, execl, getcwd, makedirs, remove, sep, walk, chdir
33+
from os import _exit, execl, getcwd, makedirs, remove, sep, walk, chdir, close
3434
from os.path import exists, join
3535
import signal
3636
import subprocess
@@ -544,6 +544,13 @@ def isClientConnected(self):
544544
def restart(self):
545545
self.shutdown()
546546
chdir(owd)
547+
# close some open fds
548+
for i in range(3,50):
549+
try:
550+
close(i)
551+
except :
552+
pass
553+
547554
execl(executable, executable, *sys.argv)
548555
_exit(0)
549556

0 commit comments

Comments
 (0)