Skip to content

Commit

Permalink
Merge e770324 into 3870414
Browse files Browse the repository at this point in the history
  • Loading branch information
okraskaj committed Dec 18, 2018
2 parents 3870414 + e770324 commit 8945d35
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
35 changes: 31 additions & 4 deletions reana_workflow_controller/workflow_run_managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# under the terms of the MIT License; see LICENSE file for more details.

"""Workflow run manager interface."""
import json

from reana_workflow_controller.config import WORKFLOW_ENGINE_VERSION

Expand All @@ -27,15 +28,32 @@ class WorkflowRunManager():
engine_mapping = {
'cwl': {'image': 'reanahub/reana-workflow-engine-cwl:{}'.format(
WORKFLOW_ENGINE_VERSION),
'command': ['sleep', '1000'],
'command': "sleep 1000",
# 'command': ("run-cwl-workflow "
# "--workflow-uuid {id} "
# "--workflow-workspace {workspace} "
# "--workflow-json {json} "
# "--workflow-parameters {parameters} "
# "--operational-options {options} "),
'environment_variables': common_env_variables},
'yadage': {'image': 'reanahub/reana-workflow-engine-yadage:{}'.format(
WORKFLOW_ENGINE_VERSION),
'command': ['sleep', '1000'],
'command': "sleep 1000",
# 'command': ("run-yadage-workflow "
# "--workflow-uuid {id} "
# "--workflow-workspace {workspace} "
# "--workflow-json {json} "
# "--workflow-parameters {parameters} "
# "--operational-options {options} "),
'environment_variables': common_env_variables},
'serial': {'image': 'reanahub/reana-workflow-engine-serial:{}'.format(
WORKFLOW_ENGINE_VERSION),
'command': ['sleep', '1000'],
'command': ("run-serial-workflow "
"--workflow-uuid {id} "
"--workflow-workspace {workspace} "
"--workflow-json {json} "
"--workflow-parameters {parameters} "
"--operational-options {options} "),
'environment_variables': common_env_variables},
}
"""Mapping between engines and their basis configuration."""
Expand Down Expand Up @@ -81,7 +99,16 @@ def _workflow_engine_image(self):
def _workflow_engine_command(self):
"""Return the command to be run for a given workflow engine."""
return (WorkflowRunManager.engine_mapping[self.workflow.type_]
['command'])
['command'].format(
id=self.workflow.id_,
workspace=self.workflow.get_workspace(),
json=json.dumps(self.workflow.get_specification()),
# TODO: make sure it's correct method
parameters=self.workflow.get_input_parameters(),
# TODO: make sure it's correct method
options=self.workflow.operational_options,
# TODO: getter?
))

def _workflow_engine_env_vars(self):
"""Return necessary environment variables for the workflow engine."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ def _create_job_spec(self, name, command=None, image=None,
spec = client.V1JobSpec(
template=client.V1PodTemplateSpec())
spec.template.metadata = workflow_metadata
container = client.V1Container(name=name, image=image, env=[],
volume_mounts=[], command=command)
container = client.V1Container(name=name, image=image,
image_pull_policy='IfNotPresent',
env=[], volume_mounts=[],
command=['/bin/bash', '-c'],
args=command)
container.env.extend(env_vars)
container.volume_mounts = [
{
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
'jsonpickle>=0.9.6',
'kubernetes>=6.0.0',
'marshmallow>=2.13',
'packaging>=18.0',
'reana-commons>=0.5.0.dev20181213,<0.6.0[kubernetes]',
'reana-db>=0.5.0.dev20181126,<0.6.0',
'requests==2.20.0',
Expand Down

0 comments on commit 8945d35

Please sign in to comment.