[med-svn] [Git][med-team/biomaj3-process][upstream] New upstream version 3.0.15

Olivier Sallou gitlab at salsa.debian.org
Tue Nov 12 10:53:28 GMT 2019



Olivier Sallou pushed to branch upstream at Debian Med / biomaj3-process


Commits:
985faf41 by Olivier Sallou at 2019-11-12T10:32:00Z
New upstream version 3.0.15
- - - - -


5 changed files:

- CHANGES.txt
- README.md
- biomaj_process/process.py
- biomaj_process/process_client.py
- setup.py


Changes:

=====================================
CHANGES.txt
=====================================
@@ -1,3 +1,9 @@
+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:


=====================================
README.md
=====================================
@@ -1,5 +1,7 @@
 # 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.


=====================================
biomaj_process/process.py
=====================================
@@ -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',


=====================================
biomaj_process/process_client.py
=====================================
@@ -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)


=====================================
setup.py
=====================================
@@ -21,7 +21,7 @@ config = {
     'url': 'http://biomaj.genouest.org',
     'download_url': 'http://biomaj.genouest.org',
     'author_email': 'olivier.sallou at irisa.fr',
-    'version': '3.0.13',
+    'version': '3.0.15',
      'classifiers': [
         # How mature is this project? Common values are
         #   3 - Alpha



View it on GitLab: https://salsa.debian.org/med-team/biomaj3-process/commit/985faf41363b40f003e47f29dfff7c616e1a8277

-- 
View it on GitLab: https://salsa.debian.org/med-team/biomaj3-process/commit/985faf41363b40f003e47f29dfff7c616e1a8277
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20191112/b0097abd/attachment-0001.html>


More information about the debian-med-commit mailing list