mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Use the python interpreter explicitly while running the background
process from the runtime.
This commit is contained in:
parent
691f01b623
commit
800d5d71d7
@ -22,7 +22,7 @@ import pytz
|
|||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from flask.ext.babel import gettext
|
from flask.ext.babel import gettext as _
|
||||||
from flask.ext.security import current_user
|
from flask.ext.security import current_user
|
||||||
|
|
||||||
import config
|
import config
|
||||||
@ -72,9 +72,9 @@ class BatchProcess(object):
|
|||||||
p = Process.query.filter_by(pid=_id, user_id=current_user.id).first()
|
p = Process.query.filter_by(pid=_id, user_id=current_user.id).first()
|
||||||
|
|
||||||
if p is None:
|
if p is None:
|
||||||
raise LookupError(gettext(
|
raise LookupError(
|
||||||
"Could not find a process with the specified ID."
|
_("Could not find a process with the specified ID.")
|
||||||
))
|
)
|
||||||
|
|
||||||
# ID
|
# ID
|
||||||
self.id = _id
|
self.id = _id
|
||||||
@ -170,10 +170,10 @@ class BatchProcess(object):
|
|||||||
def start(self):
|
def start(self):
|
||||||
if self.stime is not None:
|
if self.stime is not None:
|
||||||
if self.etime is None:
|
if self.etime is None:
|
||||||
raise Exception(gettext('The process has already been started.'))
|
raise Exception(_('The process has already been started.'))
|
||||||
raise Exception(gettext(
|
raise Exception(
|
||||||
'The process has already finished and can not be restarted.'
|
_('The process has already finished and can not be restarted.')
|
||||||
))
|
)
|
||||||
|
|
||||||
executor = os.path.join(
|
executor = os.path.join(
|
||||||
os.path.dirname(__file__), 'process_executor.py'
|
os.path.dirname(__file__), 'process_executor.py'
|
||||||
@ -181,7 +181,8 @@ class BatchProcess(object):
|
|||||||
|
|
||||||
p = None
|
p = None
|
||||||
cmd = [
|
cmd = [
|
||||||
sys.executable or 'python',
|
(sys.executable if config.SERVER_MODE else
|
||||||
|
'pythonw.exe' if os.name == 'nt' else 'python'),
|
||||||
executor,
|
executor,
|
||||||
'-p', self.id,
|
'-p', self.id,
|
||||||
'-o', self.log_dir,
|
'-o', self.log_dir,
|
||||||
@ -211,7 +212,6 @@ class BatchProcess(object):
|
|||||||
# TODO:: Couldn't start execution
|
# TODO:: Couldn't start execution
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def status(self, out=0, err=0):
|
def status(self, out=0, err=0):
|
||||||
import codecs
|
import codecs
|
||||||
ctime = get_current_time(format='%Y%m%d%H%M%S%f')
|
ctime = get_current_time(format='%Y%m%d%H%M%S%f')
|
||||||
@ -350,9 +350,9 @@ class BatchProcess(object):
|
|||||||
).first()
|
).first()
|
||||||
|
|
||||||
if p is None:
|
if p is None:
|
||||||
raise LookupError(gettext(
|
raise LookupError(
|
||||||
"Could not find a process with the specified ID."
|
_("Could not find a process with the specified ID.")
|
||||||
))
|
)
|
||||||
|
|
||||||
if _release:
|
if _release:
|
||||||
import shutil
|
import shutil
|
||||||
|
Loading…
Reference in New Issue
Block a user