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

celery fix #1089

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 4 additions & 6 deletions backend/dataset/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
#### CELERY SHARED TASKS


@shared_task(
bind=True,
)
@shared_task(queue="default")
def upload_data_to_data_instance(
self, dataset_string, pk, dataset_type, content_type, deduplicate=False
dataset_string, pk, dataset_type, content_type, deduplicate=False
):
# sourcery skip: raise-specific-error
"""Celery background task to upload the data to the dataset instance through file upload.
Expand Down Expand Up @@ -102,8 +100,8 @@ def upload_data_to_data_instance(
raise Exception(f"Upload failed for lines: {failed_rows}")


@shared_task(bind=True)
def deduplicate_dataset_instance_items(self, pk, deduplicate_field_list):
@shared_task(queue="default")
def deduplicate_dataset_instance_items(pk, deduplicate_field_list):
if len(deduplicate_field_list) == 0:
return "Field list cannot be empty"
try:
Expand Down
2 changes: 1 addition & 1 deletion backend/notifications/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def delete_excess_Notification(user):
return 0


# @shared_task
# @shared_task(queue: "default")
def create_notification_handler(
title, notification_type, users_ids, project_id=None, task_id=None
):
Expand Down
8 changes: 4 additions & 4 deletions backend/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def filter_data_items(
#### CELERY SHARED TASKS


@shared_task
@shared_task(queue="default")
def create_parameters_for_task_creation(
project_type,
dataset_instance_ids,
Expand Down Expand Up @@ -384,7 +384,7 @@ def create_parameters_for_task_creation(
tasks = create_tasks_from_dataitems(sampled_items, project)


@shared_task
@shared_task(queue="default")
def export_project_in_place(
annotation_fields, project_id, project_type, get_request_data
) -> None:
Expand Down Expand Up @@ -676,7 +676,7 @@ def export_project_in_place(
return f"Exported {len(data_items)} items."


@shared_task
@shared_task(queue="default")
def export_project_new_record(
annotation_fields,
project_id,
Expand Down Expand Up @@ -823,7 +823,7 @@ def export_project_new_record(
tasks.update(task_status=EXPORTED)


@shared_task
@shared_task(queue="default")
def add_new_data_items_into_project(project_id, items):
"""Function to pull the dataitems into the project

Expand Down
1 change: 1 addition & 0 deletions backend/shoonya_backend/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Celery Queue related settings
celery_app.conf.task_default_queue = "default"
celery_app.conf.task_routes = {
"default.tasks.*": {"queue": "default"},
"functions.tasks.*": {"queue": "functions"},
"reports.tasks.*": {"queue": "reports"},
}
Expand Down
Loading