Skip to content

Commit

Permalink
Merge 27c6b0e into e05adab
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego committed Jan 18, 2019
2 parents e05adab + 27c6b0e commit 00a6c4f
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions reana_commons/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import logging

from celery import shared_task
from celery.task.control import revoke
from kubernetes.client.rest import ApiException

from reana_commons.api_client import JobControllerAPIClient
Expand All @@ -22,33 +21,6 @@
log = logging.getLogger(__name__)


@shared_task(name='tasks.stop_workflow',
ignore_result=True)
def stop_workflow(workflow_uuid, job_list):
"""Stop a workflow.
:param workflow_uuid: UUID of the workflow to be stopped.
:param job_list: List of job identifiers which where created by the given
workflow.
"""
rjc_api_client = JobControllerAPIClient('reana-job-controller')
try:
log.info('Stopping workflow {} Celery task ...'.format(workflow_uuid))
revoke(workflow_uuid, terminate=True)
for job_id in job_list:
log.info('Stopping job {} from workflow {} ...'.format(
job_id, workflow_uuid))
response, http_response = rjc_api_client._client.jobs.delete_job(
job_id=job_id).result()
log.info(response)
log.info(http_response)
except Exception as e:
log.error('Something went wrong while stopping workflow {} ...'.format(
workflow_uuid
))
log.error(e)


def reana_ready():
"""Check if reana can start new workflows."""
from reana_commons.config import REANA_READY_CONDITIONS
Expand Down

0 comments on commit 00a6c4f

Please sign in to comment.