Skip to content

Commit

Permalink
Merge 622aef3 into 9d4e8f6
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinos Kousidis committed Feb 13, 2019
2 parents 9d4e8f6 + 622aef3 commit 3d0d428
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 64 deletions.
44 changes: 0 additions & 44 deletions reana_workflow_controller/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@
"""If CEPH storage backend is used, this represents the name of the
Kubernetes persistent volume claim."""

MOUNT_CVMFS = True if os.getenv('REANA_MOUNT_CVMFS', '').lower() == \
'true' else False
"""Option to mount CVMFS volumes in workflow engines and jobs."""

SHARED_FS_MAPPING = {
'MOUNT_SOURCE_PATH': os.getenv("SHARED_VOLUME_PATH_ROOT",
SHARED_VOLUME_PATH),
Expand Down Expand Up @@ -88,10 +84,6 @@
{
'name': 'SHARED_VOLUME_PATH',
'value': SHARED_VOLUME_PATH
},
{
'name': 'REANA_MOUNT_CVMFS',
'value': '{}'.format(MOUNT_CVMFS)
}
]
"""Common to all workflow engines environment variables."""
Expand All @@ -106,42 +98,6 @@
"""Threshold in seconds to clean up terminated (either Complete or Failed)
jobs."""


CVMFS_VOLUME_CONFIGURATION = {
'alice': {
'name': 'alice-cvmfs-volume',
'persistentVolumeClaim': {
'claimName': 'csi-cvmfs-alice-pvc',
'readOnly': True
},
'mountPath': '/cvmfs/alice.cern.ch'
},
'cms': {
'name': 'cms-cvmfs-volume',
'persistentVolumeClaim': {
'claimName': 'csi-cvmfs-cms-pvc',
'readOnly': True
},
'mountPath': '/cvmfs/cms.cern.ch'
},
'lhcb': {
'name': 'lhcb-cvmfs-volume',
'persistentVolumeClaim': {
'claimName': 'csi-cvmfs-lhcb-pvc',
'readOnly': True
},
'mountPath': '/cvmfs/lhcb.cern.ch'
},
'atlas': {
'name': 'atlas-cvmfs-volume',
'persistentVolumeClaim': {
'claimName': 'csi-cvmfs-atlas-pvc',
'readOnly': True
},
'mountPath': '/cvmfs/atlas.cern.ch'
}
}

K8S_INTERACTIVE_DEPLOYMENT_TEMPLATE_PATH = \
"templates/k8s/interactive-deployment.template"
"""Path to the k8s interactive deployment template, relative to the package."""
Expand Down
33 changes: 14 additions & 19 deletions reana_workflow_controller/workflow_run_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
current_k8s_extensions_v1beta1)
from reana_workflow_controller.errors import REANAInteractiveSessionError
from reana_workflow_controller.config import (
CVMFS_VOLUME_CONFIGURATION,
CWL_WORKFLOW_ENGINE_VERSION,
K8S_INTERACTIVE_DEPLOYMENT_TEMPLATE_PATH,
MANILA_CEPHFS_PVC, MOUNT_CVMFS,
MANILA_CEPHFS_PVC,
REANA_STORAGE_BACKEND,
SERIAL_WORKFLOW_ENGINE_VERSION,
SHARED_FS_MAPPING,
Expand Down Expand Up @@ -142,8 +141,19 @@ def _workflow_engine_command(self):

def _workflow_engine_env_vars(self):
"""Return necessary environment variables for the workflow engine."""
return (WorkflowRunManager.engine_mapping[self.workflow.type_]
['environment_variables'])
env_vars = list(WorkflowRunManager.engine_mapping[
self.workflow.type_]['environment_variables'])
cvmfs_volumes = 'false'
for resource in self.workflow.reana_specification['workflow'].\
get('resources', {}):
if 'cvmfs' in resource:
cvmfs_volumes = resource['cvmfs']
break
if type(cvmfs_volumes) == list:
cvmfs_env_var = {'name': 'REANA_MOUNT_CVMFS',
'value': str(cvmfs_volumes)}
env_vars.append(cvmfs_env_var)
return (env_vars)


class KubernetesWorkflowRunManager(WorkflowRunManager):
Expand All @@ -165,16 +175,6 @@ class KubernetesWorkflowRunManager(WorkflowRunManager):
}
}

cvmfs_volumes = []
cvmfs_volume_mounts = []
for cvmfs_mount in CVMFS_VOLUME_CONFIGURATION.values():
cvmfs_volumes.append({'name': cvmfs_mount['name'],
'persistentVolumeClaim':
cvmfs_mount['persistentVolumeClaim']})
cvmfs_volume_mounts.append({'name': cvmfs_mount['name'],
'mountPath': cvmfs_mount['mountPath']})
"""Configuration to connect to the different storage backends."""

default_namespace = 'default'
"""Default Kubernetes namespace."""

Expand Down Expand Up @@ -295,11 +295,6 @@ def _create_job_spec(self, name, command=None, image=None,
KubernetesWorkflowRunManager.k8s_shared_volume
[REANA_STORAGE_BACKEND]
]
if MOUNT_CVMFS:
container.volume_mounts.extend(KubernetesWorkflowRunManager.
cvmfs_volume_mounts)
spec.template.spec.volumes.extend(KubernetesWorkflowRunManager.
cvmfs_volumes)
job.spec = spec
job.spec.template.spec.restart_policy = 'Never'
job.spec.ttl_seconds_after_finished = TTL_SECONDS_AFTER_FINISHED
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
'kubernetes>=6.0.0',
'marshmallow>=2.13',
'packaging>=18.0',
'reana-commons>=0.5.0.dev20190207,<0.6.0[kubernetes]',
'reana-commons>=0.5.0.dev20190212,<0.6.0[kubernetes]',
'reana-db>=0.5.0.dev20190125,<0.6.0',
'requests==2.20.0',
'sqlalchemy-utils>=0.31.0',
Expand Down

0 comments on commit 3d0d428

Please sign in to comment.