routing
Dependencies that send a user's request to the node it concerns.
A frontend answers what it can itself and forwards the rest: a request about
a session goes to the node that runs it, one about a home directory to the
node that holds it, and a launch to the node placement picks. The forwarding
dependencies raise cluster.Forwarded with the other node's answer, which
the application turns into the response.
Requests another node forwarded here, and those of key-file clients, which reach one node only, are always answered here.
attributelogger= logging.getLogger(__name__)attributeSHARED_SYNC_SECONDS= 15attributeSHARED_FILES= '_sealskin_shared_files'funcstays_here(user) -> boolWhether a request is answered by this node whatever it concerns.
paramuserdict[str, Any]Returns
boolfuncpush_upload(node_id, username, upload_id) -> NoneMove the chunks of an upload this node received to the node that will use them.
paramnode_idstrparamusernamestrparamupload_idstrReturns
Nonefunc_send(request, node_id, user, body=None) -> NoneForward a request, with the upload its body names, and raise the answer.
paramrequestRequestparamnode_idstrparamuserdict[str, Any]parambodydict[str, Any] | None= NoneReturns
Nonefuncsession_node(session_id, request, user=Depends(verify_token)) -> NoneForward a request about a session this node does not run to the node that does.
paramsession_idstrparamrequestRequestparamuserdict[str, Any]= Depends(verify_token)Returns
Nonefunc_home_owner(request, user) -> strReturn the user a home directory route is about: the path's username, else the caller.
paramrequestRequestparamuserdict[str, Any]Returns
strfunchome_node(request, user=Depends(verify_token)) -> AnyForward a request about a home directory this node does not hold to the node that does.
The directory is the route's home_dir or home_name path parameter.
The user's shared files are on every node: a request about them is
answered here, from a copy brought up to date at most every
SHARED_SYNC_SECONDS, and what it changes is sent to the store after.
paramrequestRequestparamuserdict[str, Any]= Depends(verify_token)Returns
typing.Anyfuncbody_home_node(request, body=Depends(get_decrypted_request_body), user=Depends(verify_token)) -> NoneForward a request whose body names a home directory (home_name) held by another node.
paramrequestRequestparambodydict[str, Any]= Depends(get_decrypted_request_body)paramuserdict[str, Any]= Depends(verify_token)Returns
Nonefuncnew_home_node(request, user=Depends(verify_token)) -> NoneForward the creation of a home directory to the node placement picks for the user.
paramrequestRequestparamuserdict[str, Any]= Depends(verify_token)Returns
Nonefunchomes_of(username) -> list[str]Return a user's home directories on every node: those on this one and those the records place.
paramusernamestrReturns
list[str]func_launch_home(body, user) -> str | NoneReturn the persistent home directory a launch request mounts, if any.
parambodydict[str, Any]paramuserdict[str, Any]Returns
str | Nonefuncplace_launch(request, body=Depends(get_decrypted_request_body), user=Depends(verify_token)) -> AnyCheck a launch against the user's limits and forward it to the node it starts on.
The launch is followed for progress when the request names it, and
however it ends, here, in the handler, or on another node, is recorded.
A user with limits holds their launch lease throughout, so two launches
of theirs, on any nodes, are checked one after the other.
A forwarded launch asks the other node for any of its GPUs when the user
picked one here, since devices are named per node. The request may name
a pool or a node to start on.
paramrequestRequestparambodydict[str, Any]= Depends(get_decrypted_request_body)paramuserdict[str, Any]= Depends(verify_token)Returns
typing.Anyfuncfollow_launch(body=Depends(get_decrypted_request_body), user=Depends(verify_token)) -> AnyFollow a launch that always runs on this node for progress, and record how it ends.
parambodydict[str, Any]= Depends(get_decrypted_request_body)paramuserdict[str, Any]= Depends(verify_token)Returns
typing.Anyfunc_place(request, body, user) -> NoneCheck a launch against the user's limits and forward it when another node should run it.
paramrequestRequestparambodydict[str, Any]paramuserdict[str, Any]Returns
Nonefuncstorage_room(user=Depends(verify_token)) -> NoneRefuse a request that adds to the storage of a user at their storage limit.
paramuserdict[str, Any]= Depends(verify_token)Returns
Nonefuncannounce_changes(request, user=Depends(verify_token)) -> AnyAfter an administrative request that may have changed the shared records, log it and tell the other nodes to look.
paramrequestRequestparamuserdict[str, Any]= Depends(verify_token)Returns
typing.Anyfuncgather(request, user) -> list[Any]Ask every other answering node the caller's request and return their JSON answers.
A node that fails to answer is left out.
paramrequestRequestparamuserdict[str, Any]Returns
list[typing.Any]funcforwarded_response(_request, exc) -> ResponseException handler returning the answer a forwarding dependency carried.
param_requestRequestparamexccluster.ForwardedReturns
fastapi.Response