Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tasks: remove stop workflow task #79

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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