SealSkin

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
= 15
attributeSHARED_FILES
= '_sealskin_shared_files'
funcstays_here(user) -> bool

Whether a request is answered by this node whatever it concerns.

paramuserdict[str, Any]

Returns

bool
funcpush_upload(node_id, username, upload_id) -> None

Move the chunks of an upload this node received to the node that will use them.

paramnode_idstr
paramusernamestr
paramupload_idstr

Returns

None
func_send(request, node_id, user, body=None) -> None

Forward a request, with the upload its body names, and raise the answer.

paramrequestRequest
paramnode_idstr
paramuserdict[str, Any]
parambodydict[str, Any] | None
= None

Returns

None
funcsession_node(session_id, request, user=Depends(verify_token)) -> None

Forward a request about a session this node does not run to the node that does.

paramsession_idstr
paramrequestRequest
paramuserdict[str, Any]
= Depends(verify_token)

Returns

None
func_home_owner(request, user) -> str

Return the user a home directory route is about: the path's username, else the caller.

paramrequestRequest
paramuserdict[str, Any]

Returns

str
funchome_node(request, user=Depends(verify_token)) -> Any

Forward 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.

paramrequestRequest
paramuserdict[str, Any]
= Depends(verify_token)

Returns

typing.Any
funcbody_home_node(request, body=Depends(get_decrypted_request_body), user=Depends(verify_token)) -> None

Forward a request whose body names a home directory (home_name) held by another node.

paramrequestRequest
parambodydict[str, Any]
= Depends(get_decrypted_request_body)
paramuserdict[str, Any]
= Depends(verify_token)

Returns

None
funcnew_home_node(request, user=Depends(verify_token)) -> None

Forward the creation of a home directory to the node placement picks for the user.

paramrequestRequest
paramuserdict[str, Any]
= Depends(verify_token)

Returns

None
funchomes_of(username) -> list[str]

Return a user's home directories on every node: those on this one and those the records place.

paramusernamestr

Returns

list[str]
func_launch_home(body, user) -> str | None

Return the persistent home directory a launch request mounts, if any.

parambodydict[str, Any]
paramuserdict[str, Any]

Returns

str | None
funcplace_launch(request, body=Depends(get_decrypted_request_body), user=Depends(verify_token)) -> Any

Check 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.

paramrequestRequest
parambodydict[str, Any]
= Depends(get_decrypted_request_body)
paramuserdict[str, Any]
= Depends(verify_token)

Returns

typing.Any
funcfollow_launch(body=Depends(get_decrypted_request_body), user=Depends(verify_token)) -> Any

Follow 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.Any
func_place(request, body, user) -> None

Check a launch against the user's limits and forward it when another node should run it.

paramrequestRequest
parambodydict[str, Any]
paramuserdict[str, Any]

Returns

None
funcstorage_room(user=Depends(verify_token)) -> None

Refuse a request that adds to the storage of a user at their storage limit.

paramuserdict[str, Any]
= Depends(verify_token)

Returns

None
funcannounce_changes(request, user=Depends(verify_token)) -> Any

After an administrative request that may have changed the shared records, log it and tell the other nodes to look.

paramrequestRequest
paramuserdict[str, Any]
= Depends(verify_token)

Returns

typing.Any
funcgather(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.

paramrequestRequest
paramuserdict[str, Any]

Returns

list[typing.Any]
funcforwarded_response(_request, exc) -> Response

Exception handler returning the answer a forwarding dependency carried.

param_requestRequest
paramexccluster.Forwarded

Returns

fastapi.Response