Install
openclaw skills install @taleintervenor/sjtu-slurm-skillLog in to the SJTU HPC platform (also known as "交我算") as the user to perform job queries, submissions, cancellations, and data management. Use this skill when the user requests operations related to HPC or "交我算".
openclaw skills install @taleintervenor/sjtu-slurm-skillUse this skill to log in to the SJTU HPC (交我算) platform as the user, acting on their behalf to perform personal job queries, submissions, cancellations, and data management operations.
General Principles:
credentials directory under workspace (e.g., ~/.openclaw/workspace/default/credentials). Do Not store user's plain text password or contain it in your talk messages.credentials directory. If not, request a new token.credentials directory. If not, request a new SSH certificate for the user. Remind the user that requesting a certificate will trigger two-factor authentication.Before calling any HPC API, ensure there is a valid token in the credentials directory. Go through the following steps:
hpc_token file exists in the credentials directory under workspace. If it exists, goto step 2, otherwise goto step 3.refresh_token.py --workspace "path_to_workspace". If success, then you have ensured a valid token and can safely skip the following steps. If the request is refused (which means the token has expired), then continue to step 3. If the request reports internal error, act according to the rules in Error Handling section .req_token.py :
req_token.py "username" "password" --workspace "path_to_workspace" --textfile "uploaded_file_path". So script can help to remove the file to prevent password leak.--textfile option.The token will be saved as hpc_token in the credentials directory under workspace. If any script failed, act according to the rules in Error Handling section .
Here are some HPC API path you can call when users want to know their storage quota usage or update their account:
GET /user: query user's information.
curl -L 'https://api.hpc.sjtu.edu.cn/user?name=userA&domain=pi' --header 'Authorization: Bearer ***'PATCH /user: update user's information.
GET /quota: Query the storage quota data of user or its related group account.
name parameter.quota_type them need, you should query with quota_type=account and quota_type=user seperately. The account name can be derived from user's home path, which can be query in GET /user. The parent dir of user‘s home is exactly its account name, for example: "home": "%H/home/acct-hpc/hpcrobot" -> account name: acct-hpc.curl -L 'https://api.hpc.sjtu.edu.cn/quota?quota_type=account&name=acct-example'Only these tasks can be done through HPC API. Do NOT try to use API for any other user requirements.
Use the token in credentials directory if authorization is required. Ask for user's HPC name if it is needed and has not been provided during the talk.
Select the appropriate entry node based on the node group and operation type the user is interested in.
HPC cluster has 3 node groups: pi, sy (思源) , kp (鲲鹏) . Partitions belong to node groups. If user does not explicitly specify a node group but only provides a target partition or a target storage, look up the corresponding node group from this table:
| node group | partition | storage |
|---|---|---|
| pi | cpu, debug, dgx2, huge, 192c6t | lustre |
| kp | debugarm, arm128c256g, scnet_arm | |
| sy | small, 64c512g, el9, debug64c512g, win32, a100, a800, debug100 | dssg(gpfs) |
Then select the entry node according to this table:
| business | node group | entry node |
|---|---|---|
| job | pi | pilogin.hpc.sjtu.edu.cn |
| job | sy | sylogin.hpc.sjtu.edu.cn |
| job | kp | armlogin.hpc.sjtu.edu.cn |
| data | pi, kp | data.hpc.sjtu.edu.cn |
| data | sy | sydata.hpc.sjtu.edu.cn |
SSH login to entry nodes requires the user's passwordless certificate. The agent should store all credentials (tokens, SSH keys, certificates) in the workspace's credentials directory. If no certificate available, follow the steps to request a new SSH certificate:
req_certificate.py <username> --workspace "path_to_workspace" with timeout >= 600s because the script will block waiting for the user to complete two-factor authentication on another channel.The SSH key and certificate will be saved to the credentials directory under workspace.
If user directly asked for the key or certificate, follow the steps to send files to user:
--valid-time argument.If any script execution or API call failed, parse the error message from stderr and inform the user with clear details:
hpc@sjtu.edu.cn with this ID.Use the SSH key and certificate from the workspace credentials directory to log in to the entry node and remotely execute the user's requested operations:
ssh -i "/path_to_workspace/credentials/private_key" -o "CertificateFile=/path_to_workspace/credentials/certificate" user@entry_node "command"
Note that user data is distributed across multiple shared storage pools, and visible storage varies depending on the node group. The storage where the user's home directory resides also differs:
| node group | mount point | storage information |
|---|---|---|
| pi, kp | /lustre | Hot storage, Lustre, user home directory is here |
| sy | /dssg | Hot storage, GPFS, user home directory is here |
| pi, sy, kp | /archive | Cold storage A, NFS, for archived data, writable only on data and sydata nodes, read-only on other nodes |
| pi, sy, kp | /vault | Cold storage B, NFS, for archived data, writable only on data and sydata nodes, read-only on other nodes |
| pi, sy, kp | /union | mergerfs virtual filesystem, combines /archive and /vault, same read/write restrictions as the two cold storages |
User personal directory paths are consistent across storage pools. Replace the top-level path of the user's home directory with the target storage to get the corresponding personal directory path. For example: /lustre/home/acct-hpc/hpcrobot -> /archive/home/acct-hpc/hpcrobot
If the user is interested in platform status or personal jobs, use SLURM commands to perform operations like: sinfo, squeue, sacct, seff, sbatch, scancel, etc...
Due to different storage pool visibility across node groups, job data computed on a partition can only be viewed on entry nodes belonging to the corresponding node group. Each entry node only allows submitting job to partitions within its own node group.
Never use cold storage data directly for job. If cold storage data is needed, transfer it to hot storage first before using it for job.
Large-scale data transfer operations should be performed on data.hpc.sjtu.edu.cn and sydata.hpc.sjtu.edu.cn. To aviod connection lost, wrap the remote transfer operation on data nodes with tmux. HPC has multiple cold storages, so before writing data to cold storage, check the free space of these candidates, and select the cold storage with most free space as the write target. If user asks about their data in cold storage and did not clearly specified which one, use the combined virtual filesystem /union .
req_token.py: Request a new bearer token from HPC API. This is a one-time setup that enables other operations.refresh_token.py: Refresh an existing bearer token to extend the session without re-authenticating.req_certificate.py: Request SSH key and certificate files using an existing token, which can be used to log in to the entry nodes without a password.