MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / start

Method start

web/pgadmin/misc/bgprocess/processes.py:295–386  ·  view source on GitHub ↗
(self, cb=None)

Source from the content-addressed store, hash-verified

293 return interpreter if interpreter else 'python'
294
295 def start(self, cb=None):
296 self.check_start_end_time()
297
298 executor = file_quote(os.path.join(
299 os.path.dirname(u_encode(__file__)), 'process_executor.py'
300 ))
301
302 interpreter = self._get_python_interpreter()
303
304 cmd = [interpreter, executor, self.cmd]
305 cmd.extend(self.args)
306
307 current_app.logger.info(
308 "Executing the process executor with the arguments: %s",
309 str(cmd)
310 )
311
312 # Acquiring lock while copying the environment from the parent process
313 # for the child process
314 with ConnectionLocker(_is_kerberos_conn=False):
315 # Make a copy of environment, and add new variables to support
316 env = os.environ.copy()
317
318 env['PROCID'] = self.id
319 env['OUTDIR'] = self.log_dir
320 env['PGA_BGP_FOREGROUND'] = "1"
321 if config.SERVER_MODE and session and \
322 session.get('auth_source_manager', {}).get(
323 'current_source') == KERBEROS and \
324 'KRB5CCNAME' in session:
325 env['KRB5CCNAME'] = session['KRB5CCNAME']
326
327 if self.env:
328 env.update(self.env)
329
330 current_app.logger.debug(self.env)
331
332 if cb is not None:
333 cb(env)
334 if os.name == 'nt':
335 DETACHED_PROCESS = 0x00000008
336 from subprocess import CREATE_NEW_PROCESS_GROUP
337
338 # We need to redirect the standard input, standard output, and
339 # standard error to devnull in order to allow it start in detached
340 # mode on
341 stdout = os.devnull
342 stderr = stdout
343 stdin = open(os.devnull, "r")
344 stdout = open(stdout, "a")
345 stderr = open(stderr, "a")
346
347 p = Popen(
348 cmd,
349 close_fds=False,
350 env=env,
351 stdout=stdout.fileno(),
352 stderr=stderr.fileno(),

Callers 15

refresh_dataMethod · 0.95
create_restore_jobFunction · 0.95
create_maintenance_jobFunction · 0.95
create_import_export_jobFunction · 0.95
deploy_on_azureFunction · 0.95
deploy_on_googleFunction · 0.95
deploy_on_rdsFunction · 0.95
get_innerMethod · 0.80
get_innerMethod · 0.80
_check_startMethod · 0.80
_check_startMethod · 0.80

Calls 15

check_start_end_timeMethod · 0.95
get_process_outputMethod · 0.95
file_quoteFunction · 0.90
u_encodeFunction · 0.90
ConnectionLockerClass · 0.90
cbFunction · 0.85
joinMethod · 0.80
dirnameMethod · 0.80
extendMethod · 0.80
infoMethod · 0.80
for_userMethod · 0.80

Tested by 11

_check_startMethod · 0.64
_check_startMethod · 0.64
_check_startMethod · 0.64
runTestMethod · 0.64
runTestMethod · 0.64
runTestMethod · 0.64
_check_startMethod · 0.64
runTestMethod · 0.64
runTestMethod · 0.64
run_parallel_testsFunction · 0.64
run_sequential_testsFunction · 0.64