mirror of
https://github.com/IEEE-SB-Passau/pelican-deployment-system.git
synced 2017-09-06 16:35:38 +02:00
add _
This commit is contained in:
@@ -34,13 +34,13 @@ class DeploymentRunner:
|
|||||||
name=name)
|
name=name)
|
||||||
self.pelican_command = runner_config["pelican_command"].format(
|
self.pelican_command = runner_config["pelican_command"].format(
|
||||||
output=OUTPUT_DIR.format(name=name))
|
output=OUTPUT_DIR.format(name=name))
|
||||||
self.build_proc_env = dict(os.environ,
|
self._build_proc_env = dict(os.environ,
|
||||||
**runner_config.get("pelican_env", {}))
|
**runner_config.get("pelican_env", {}))
|
||||||
|
|
||||||
self.executor = ThreadPoolExecutor(max_workers=1)
|
self._executor = ThreadPoolExecutor(max_workers=1)
|
||||||
self.futures = set()
|
self._futures = set()
|
||||||
self.build_proc = None
|
self._build_proc = None
|
||||||
self.abort = False
|
self._abort = False
|
||||||
self._build_lock = RLock()
|
self._build_lock = RLock()
|
||||||
|
|
||||||
def update_build_repository(self):
|
def update_build_repository(self):
|
||||||
@@ -94,35 +94,35 @@ class DeploymentRunner:
|
|||||||
self.try_abort_build()
|
self.try_abort_build()
|
||||||
|
|
||||||
# cancel everything, so we are next
|
# cancel everything, so we are next
|
||||||
for fut in self.futures.copy():
|
for fut in self._futures.copy():
|
||||||
fut.cancel()
|
fut.cancel()
|
||||||
if fut.done():
|
if fut.done():
|
||||||
self.futures.remove(fut)
|
self._futures.remove(fut)
|
||||||
|
|
||||||
self.futures.add(self.executor.submit(self.build_blocking))
|
self._futures.add(self._executor.submit(self.build_blocking))
|
||||||
|
|
||||||
def try_abort_build(self):
|
def try_abort_build(self):
|
||||||
proc = self.build_proc
|
proc = self._build_proc
|
||||||
self.abort = True
|
self._abort = True
|
||||||
if proc:
|
if proc:
|
||||||
proc.kill()
|
proc.kill()
|
||||||
|
|
||||||
def build_blocking(self):
|
def build_blocking(self):
|
||||||
self.abort = False
|
self._abort = False
|
||||||
|
|
||||||
# preparing build environment
|
# preparing build environment
|
||||||
self.update_build_repository()
|
self.update_build_repository()
|
||||||
# TODO: prepare_output()
|
# TODO: prepare_output()
|
||||||
|
|
||||||
# start the build if we should not abort
|
# start the build if we should not abort
|
||||||
if not self.abort:
|
if not self._abort:
|
||||||
args = shlex.split(self.pelican_command)
|
args = shlex.split(self.pelican_command)
|
||||||
self.build_proc = Popen(args,
|
self._build_proc = Popen(args,
|
||||||
cwd=str(self.build_repo_path),
|
cwd=str(self.build_repo_path),
|
||||||
env=self.build_proc_env)
|
env=self._build_proc_env)
|
||||||
atexit.register(self.build_proc.kill)
|
atexit.register(self._build_proc.kill)
|
||||||
status = self.build_proc.wait()
|
status = self._build_proc.wait()
|
||||||
atexit.unregister(self.build_proc.kill)
|
atexit.unregister(self._build_proc.kill)
|
||||||
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
# TODO: postproc...
|
# TODO: postproc...
|
||||||
|
|||||||
Reference in New Issue
Block a user