Skip to content

Rag4reports#718

Open
mam10eks wants to merge 60 commits intomainfrom
rag4reports
Open

Rag4reports#718
mam10eks wants to merge 60 commits intomainfrom
rag4reports

Conversation

@mam10eks
Copy link
Copy Markdown
Member

@mam10eks mam10eks commented Apr 4, 2026

No description provided.

Comment thread application/src/tira_app/endpoints/v1/_admin.py Fixed
from unittest.mock import Mock, patch

os.environ["TIRA_WORKER_CONFIG"] = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "tira-worker-config.yml")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try:
job = RunningProcesses.objects.get(uuid=job_id)
except:
return HttpResponseServerError(json.dumps({"status": 1, "message": "Job does not exist."}))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpResponseNotFound would be better suited

@check_conditional_permissions(restricted=True)
def update_running_process_output(request: Request, vm_id: str, job_id: str) -> Response:
if request.method != "POST":
return HttpResponseServerError(json.dumps({"status": 1, "message": "Only Post allowed."}))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpResponseBadRequest would be better suited

try:
data = json.loads(request.body) if request.body else request.POST.dict()
except json.JSONDecodeError:
return HttpResponseServerError(json.dumps({"status": 1, "message": "Could not parse request body as JSON."}))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpResponseBadRequest would be better suited

return HttpResponseServerError(json.dumps({"status": 1, "message": "Could not parse request body as JSON."}))

if "output" not in data:
return HttpResponseServerError(json.dumps({"status": 1, "message": "A field output is expected."}))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpResponseBadRequest would be better suited

def verify_image(self, image, platform):
client = self.__docker_client()
inspect_result = client.api.inspect_image(image)
allowed = set([platform])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allowed = set([platform])
allowed ={platform,}

client = self.__docker_client()
inspect_result = client.api.inspect_image(image)
allowed = set([platform])
architecture = "unknow"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo? → unknown

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be a constant: ARCH_UNKNOWN so that people can compare against it

}

if mount_directory:
additional_paths = 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does what enumerate does

if mount_directory:
additional_paths = 0
for k, v in mount_directory.items():
target_dir = "/tira-data/mounted/{additional_paths}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing f before the string: f"/tira-data/mounted/{additional_paths}"?

Comment on lines +529 to +534
additional_paths = 0
for k, v in mount_directory.items():
target_dir = "/tira-data/mounted/{additional_paths}"
additional_paths += 1
volumes[v] = {"bind": target_dir, "mode": "ro"}
environment[k] = target_dir
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
additional_paths = 0
for k, v in mount_directory.items():
target_dir = "/tira-data/mounted/{additional_paths}"
additional_paths += 1
volumes[v] = {"bind": target_dir, "mode": "ro"}
environment[k] = target_dir
for i, (k, v) in enumerate(mount_directory.items()):
target_dir = f"/tira-data/mounted/{i}"
volumes[v] = {"bind": target_dir, "mode": "ro"}
environment[k] = target_dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants