Skip to content
Commits on Source (3)
3.0.15:
Add proc name in logs for waiting and result
3.0.14:
Add env var BIOMAJ_HOST_DATA_DIR to use with *docker* process executor to specify data.dir location if different between host and container (if BIOMAJ_DATA_DIR not a subdirectory of BIOMAJ_DIR for example)
If variable is not set, container wil mount data.dir between host and container,
else will mount BIOMAJ_HOST_DATA_DIR:data.dir
3.0.13:
Fix traefik prefix
3.0.12:
......
# About
[![PyPI version](https://badge.fury.io/py/biomaj-process.svg)](https://badge.fury.io/py/biomaj-process)
Microservice to manage the process execution of biomaj.
A protobuf interface is available in biomaj_process/message/message_pb2.py to exchange messages between BioMAJ and the download service.
......
......@@ -224,9 +224,10 @@ class DockerProcess(Process):
depends.append(value)
# docker run with data.dir env as shared volume
# forwarded env variables
data_dir = self.bank_env['datadir'] + '/' + self.bank_env['dirversion']
if 'BIOMAJ_DIR' in os.environ and os.environ['BIOMAJ_DIR'] and not os.environ['BIOMAJ_DIR'].startswith('local'):
data_dir = os.environ['BIOMAJ_DIR'] + '/' + self.bank_env['dirversion']
container_data_dir = self.bank_env['datadir'] + '/' + self.bank_env['dirversion']
host_data_dir = container_data_dir
if 'BIOMAJ_HOST_DATA_DIR' in os.environ and os.environ['BIOMAJ_HOST_DATA_DIR'] and not os.environ['BIOMAJ_HOST_DATA_DIR'].startswith('local'):
host_data_dir = os.environ['BIOMAJ_HOST_DATA_DIR'] + '/' + self.bank_env['dirversion']
depends_vol = ''
for vol in depends:
......@@ -236,13 +237,14 @@ class DockerProcess(Process):
cmd = '''uid={uid}
gid={gid}
{sudo} docker {docker_url} pull {container_id}
{sudo} docker {docker_url} run --rm -w {bank_dir} {depends_vol} -v {data_dir}:{data_dir} {env} {container_id} \
{sudo} docker {docker_url} run --rm -w {bank_dir} {depends_vol} -v {host_data_dir}:{container_data_dir} {env} {container_id} \
bash -c "groupadd --gid {gid} {group_biomaj} && useradd --uid {uid} --gid {gid} {user_biomaj}; \
{exe} {args}; \
chown -R {uid}:{gid} {bank_dir}"'''.format(
uid=os.getuid(),
gid=os.getgid(),
data_dir=data_dir,
host_data_dir=host_data_dir,
container_data_dir=container_data_dir,
env=env,
container_id=self.docker,
group_biomaj='biomaj',
......@@ -257,12 +259,13 @@ class DockerProcess(Process):
else:
cmd = '''
{sudo} docker {docker_url} pull {container_id}
{sudo} docker {docker_url} run --rm -w {bank_dir} {depends_vol} -v {data_dir}:{data_dir} {env} {container_id} \
{sudo} docker {docker_url} run --rm -w {bank_dir} {depends_vol} -v {host_data_dir}:{container_data_dir} {env} {container_id} \
{exe} {args} \
'''.format(
uid=os.getuid(),
gid=os.getgid(),
data_dir=data_dir,
host_data_dir=host_data_dir,
container_data_dir=container_data_dir,
env=env,
container_id=self.docker,
group_biomaj='biomaj',
......
......@@ -49,6 +49,7 @@ class ProcessServiceClient(object):
raise Exception('Failed to connect to the process proxy')
def execute_process(self, biomaj_process):
self.biomaj_process = biomaj_process
if self.remote:
self.channel.basic_publish(
exchange='',
......@@ -58,14 +59,12 @@ class ProcessServiceClient(object):
# make message persistent
delivery_mode=2
))
else:
self.biomaj_process = biomaj_process
def wait_for_process(self):
over = False
exitcode = -1
info = None
logging.info("Process:RemoteProcess:Waiting")
logging.info("Process:RemoteProcess:Waiting:" + str(self.biomaj_process.process.name))
errors = 0
while not over:
if errors >= 3:
......@@ -89,7 +88,7 @@ class ProcessServiceClient(object):
over = True
if result['exitcode'] > 0:
info = result['info']
self.logger.error('Process:RemoteProcess:Error:' + str(result['info']))
self.logger.error('Process:RemoteProcess:Error:' + str(self.biomaj_process.process.name) + ': ' + str(result['info']))
else:
time.sleep(10)
return (exitcode, info)
......
biomaj3-process (3.0.15-1) unstable; urgency=medium
* New upstream release
-- Olivier Sallou <osallou@debian.org> Tue, 12 Nov 2019 10:32:06 +0000
biomaj3-process (3.0.13-1) unstable; urgency=medium
* New upstream release
......
......@@ -21,7 +21,7 @@ config = {
'url': 'http://biomaj.genouest.org',
'download_url': 'http://biomaj.genouest.org',
'author_email': 'olivier.sallou@irisa.fr',
'version': '3.0.13',
'version': '3.0.15',
'classifiers': [
# How mature is this project? Common values are
# 3 - Alpha
......