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

consumer: removes unused task #255

Merged
merged 1 commit into from
Oct 9, 2019
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
25 changes: 0 additions & 25 deletions reana_workflow_controller/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
import uuid

import requests
from kubernetes.client.rest import ApiException
from reana_commons.consumer import BaseConsumer
from reana_commons.k8s.api_client import current_k8s_batchv1_api_client
from reana_commons.k8s.secrets import REANAUserSecretsStore
from reana_commons.utils import (calculate_file_access_time,
calculate_hash_of_dir,
Expand All @@ -27,7 +25,6 @@

from reana_workflow_controller.config import (PROGRESS_STATUSES,
REANA_GITLAB_URL, REANA_URL)
from reana_workflow_controller.errors import REANAWorkflowControllerError


class JobStatusConsumer(BaseConsumer):
Expand Down Expand Up @@ -74,10 +71,6 @@ def _update_workflow_status(workflow_uuid, status, logs):
.one_or_none()
if workflow.git_ref:
_update_commit_status(workflow, status)
alive_statuses = \
[WorkflowStatus.created, WorkflowStatus.running, WorkflowStatus.queued]
if status not in alive_statuses:
_delete_workflow_engine_pod(workflow_uuid)


def _update_commit_status(workflow, status):
Expand Down Expand Up @@ -182,21 +175,3 @@ def _update_job_cache(msg):
cached_job.result_path = msg['caching_info'].get('result_path')
cached_job.workspace_hash = workspace_hash
Session.add(cached_job)


def _delete_workflow_engine_pod(workflow_uuid):
"""Delete workflow engine pod."""
try:
jobs = current_k8s_batchv1_api_client.list_namespaced_job(
namespace='default',
)
for job in jobs.items:
if workflow_uuid in job.metadata.name:
current_k8s_batchv1_api_client.delete_namespaced_job(
namespace='default',
propagation_policy="Background",
name=job.metadata.name)
break
except ApiException as e:
raise REANAWorkflowControllerError(
"Workflow engine pod cound not be deleted {}.".format(e))