feat: support user-impersonated backend job launches - #40
Conversation
…g-backend into job-as-user
|
|
||
| # Environment variable that overrides auto-detection (e.g. INFRASTRUCTURE=delta-ai-ncsa) | ||
| INFRASTRUCTURE_ENV_VAR = "INFRASTRUCTURE" | ||
| _CLUSTER_USERNAME_RE = re.compile(r"^[A-Za-z][A-Za-z0-9._-]{0,63}$") |
There was a problem hiding this comment.
I'm wondering if the regex is too Delta-aware. Maybe it should be a configuration item?
| return str(Path(raw_root).expanduser() / username) | ||
|
|
||
|
|
||
| def get_vec_inf_log_base_dir(infrastructure: Optional[str] = None) -> Optional[str]: |
There was a problem hiding this comment.
Same definition as above, maybe missed deleting this one?
| workspace_dir = _ensure_impersonated_workspace_dir(cluster_username) | ||
| _ensure_shared_cache_dir_access(cluster_username) | ||
| if workspace_dir is not None: | ||
| params.setdefault("work_dir", str(workspace_dir)) |
There was a problem hiding this comment.
okay, weird issue. params is set as
params = deployment.model_dump(exclude={"modelName", "modelId", "userId"})
model_dump sets work_dir:
work_dir: Optional[str] = None # Optional working directory for vec-inf jobs
and setdefault silently refuses to override None:
>>>my_dict = {"work_dir": None}
>>>my_dict.setdefault("work_dir", "test")
>>>my_dict
{'work_dir': None}|
|
||
| VEC_INF_LOG_DIR: Optional[str] = None # Shared vec-inf log directory override | ||
| VEC_INF_SHARED_WORK_ROOT: Optional[str] = None # Parent directory for impersonated per-user logs/scripts | ||
| VEC_INF_EXECUTION_MODE: str = "direct" # direct or impersonate |
There was a problem hiding this comment.
Can we restrict to "direct" or "impersonate" here?
| ] | ||
| for command in acl_commands: | ||
| try: | ||
| subprocess.run(command, text=True, capture_output=True, check=True) |
There was a problem hiding this comment.
Add a generous timeout?
|
Claude logged some security concerns, but I didn't know how much of that to mention. I know we were saving a security pass for later. Here's what claude had. I can make tickets for them if desired
|
|
@rohan-uiuc was wondering if you can resolve the merge conflicts and Josh's review.. Will get started on reviewing this soon. |
|
@rohan-uiuc I have tried running this in the delta service machine as the service user I understand this is strictly a backend PR only so to test it I need to run the deployments API curl -X POST http://localhost:8002/api/models/deployments \
-H 'Content-Type: application/json' \
-d '{
"modelName": "Qwen2.5-0.5B-Instruct",
"userId": "0ea3686b-10b2-42f0-85ab-60cdadbb87e2",
"clusterUsername": "svcllmhubmohanar2",
"partition": "gpuA40x4",
"time": "01:00:00",
"resource_type": "nvidia_a40"
}'However, I am getting this error on running it Is this because the impersonated user P.S I think we should make a seperate issue to update deployments API, though the json parameter is |
I moved the repo to the prohects folder, so the new path is |
Because the requested Python version (>=3.9) does not satisfy Python>=3.10 and vec-inf==0.9.0 depends on Python>=3.10, we can conclude that
vec-inf==0.9.0 cannot be used.
|
@Vismayak and @rohan-uiuc I'm wondering if we're doing the impersonation on the wrong level. What if svc-account runs the back and then we save impersonation just for the sbatch and cancel portions: We could do something similar for scancel as well. |

Summary
Impact
Backend deployments can launch under the requesting cluster user when impersonation mode is configured. Direct execution remains supported.
Validation
Source
Ports Center-for-AI-Innovation/llm-serving-backend#32.