Skip to content

Commit

Permalink
chore(tasks): publish assignment to generate assignment hub id
Browse files Browse the repository at this point in the history
  • Loading branch information
superiorsd10 committed May 2, 2024
1 parent c660539 commit 737853c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/app/celery/tasks/assignment_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ def process_assignment_generation(
types_of_questions: dict,
generate_assignment_id: str,
assignments_count: int,
hub_id: str,
) -> None:
"""
Process assignment generation task asynchronously.
Expand Down Expand Up @@ -677,6 +678,8 @@ def process_assignment_generation(
]
)

print(types_of_questions_string)

if assignments_count == 0:
generated_assignment = generate_assignment_llama(
title=title,
Expand Down Expand Up @@ -704,9 +707,10 @@ def process_assignment_generation(
if assignments_dict:
redis_client = Config.REDIS_CLIENT
generate_assignment_key = f"generate_assignment_id_{generate_assignment_id}"
generate_assignment_hub_key = f"generate_assignment_hub_id_{hub_id}"
assignments_dict_data = json.dumps(assignments_dict)
redis_client.set(generate_assignment_key, assignments_dict_data)
redis_client.publish(generate_assignment_key, assignments_dict_data)
redis_client.publish(generate_assignment_hub_key, assignments_dict_data)
else:
print("assignments_dict is None or empty, skipping Redis operations.")

Expand Down
4 changes: 4 additions & 0 deletions server/app/sockets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
handle_leave_hub,
handle_send_message,
)

from .assignment_sockets import (
generate_assignment,
)

0 comments on commit 737853c

Please sign in to comment.