Skip to content

Fixes upload via dict fucntion for tokenization #317

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

Merged
merged 1 commit into from
Jul 9, 2025
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
15 changes: 15 additions & 0 deletions controller/transfer/record_transfer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
record,
record_label_association,
upload_task,
project,
)

from controller.upload_task import manager as upload_task_manager
Expand All @@ -28,6 +29,7 @@
from util import notification
from controller.transfer.util import convert_to_record_dict
import os
from controller.task_master import manager as task_master_manager


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -182,6 +184,19 @@ def import_file_record_dict(
tmp_file_name = file.store_records_as_json_file(records)
file_type = "json"
__import_file(project_id, upload_task, file_type, tmp_file_name)
project_item = project.get(project_id)
org_id = project_item.organization_id
task_master_manager.queue_task(
str(org_id),
str(upload_task.user_id),
enums.TaskType.TOKENIZATION,
{
"project_id": str(project_id),
"scope": enums.RecordTokenizationScope.PROJECT.value,
"include_rats": True,
"only_uploaded_attributes": True,
},
)


def __import_file(
Expand Down
7 changes: 6 additions & 1 deletion tests/fast_api/routes/test_invite_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from controller.auth.kratos import delete_user_kratos

from submodules.model.models import Organization
from submodules.model.enums import UserRoles
import requests
import time

Expand Down Expand Up @@ -52,7 +53,11 @@ def test_invite_users(client: TestClient, org: Organization):
valid_emails_to_test = ["test@kern.ai"]
response = client.post(
"/api/v1/misc/invite-users",
json={"organization_name": org.name, "emails": valid_emails_to_test},
json={
"organization_name": org.name,
"emails": valid_emails_to_test,
"user_role": UserRoles.ENGINEER.value,
},
)
assert response.status_code == 200
created_user_ids = response.json()
Expand Down