-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feature: get and assign sandbox to job #156
Conversation
606cb61
to
024f88b
Compare
Hello @chrisburr, I have moved on for the "assign" and "get" routes. But the test return a 404 not found while calling these routes and I did'nt found why... Do you have an idea on this? |
Hi @natthan-pigoux , You can run the test locally with the --pdb option A naive guess would be that the job id does not exist |
@router.patch("/jobs/{job_id}/sandbox/output") | ||
async def assign_sandbox( | ||
job_id: int, | ||
pfn: Annotated[str, Query(max_length=256, pattern=SANDBOX_PFN_REGEX)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the 404 problem comes from here. the pfn
is not in the query
but in the body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you declare pfn
as an str
, then you need to do your test like
r = normal_user_client.patch(
f"/api/jobs/{job_id}/sandbox/output",
json=sandbox_pfn,
)
(although probably the Pydantic model approach is better).
But this would result in 422, not 404
try to replace
assert r.status_code == 200
with
assert r.status_code == 200, r.json()
so you get to see the actual error.
If after that you still can't figure out, I'll checkout your branch and try on my machine :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I modified the sandbox_pfn
declaration. I've investigated but I didn't find any obvious solution. Could be helpful if you can have a look :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so the problem was a bit more subtle :-)
You declare your routes like this for example
@router.get("/jobs/{job_id}/sandbox")
However, the /jobs
prefix is already automatically prepended when creating the job
router (this comes from that, and yes, that is part of the missing docs :-) )
Line 88 in 3b4761c
jobs = diracx.routers.job_manager:router |
So the way you need to declare your routes is not `/jobs/{job_id}/sandbox" but just "/{job_id}/sandbox"
Effectively, your route is available as "/jobs/jobs/{job_id}/sandbox"
So changing the route definition fixes the problem you have, but you bump then into another one, which I let in your care :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @chaen!
Indeed I could see that when looking other sandbox routes... I also fixed the pfn
parameter by splitting it inside the assign_sandbox
route. Is that the right way to do it ?
Otherwise the tests finally passed, the PR should be ready for review.
0bbcb48
to
290043e
Compare
@natthan-pigoux thanks ! I'll just rebase it to pick up the latest changes :-) |
51b2b04
to
9dce245
Compare
@natthan-pigoux thanks a lot for the PR. There are a few TODO's left, in particular for identity check. Do you have time or should I finish it ? :-) |
Hi @chaen, for the todo list, are you talking about what's left in #13 or the TODOs I left in the code (such as: f04166a#diff-c24591c47e0251c9014801ea7df92eb36ff4d01a77c47d6a48a7c37e7c682f98R219) ? |
The TODO in the code :-) Once these are adressed, I merge it and if you will, you can continue with the rest of #13 :-) |
@chaen, one of the todo is |
7e71c90
to
7eb19d1
Compare
@chaen, I added the method to unassign sandbox and added the concept of "entity" which was not implemented. |
7eb19d1
to
04fa32e
Compare
yes, we are working on the policy at the moment, so don't bother with it :-) |
04fa32e
to
2a35093
Compare
2a35093
to
e43ded9
Compare
The features have been started but not finished yet.
TBF: