-
Notifications
You must be signed in to change notification settings - Fork 51
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
Support Elastic JobSets #463
Comments
Yes, I think we should think about allowing to autoscale the number of replicas in a replicatedJob! For example, the number of tpuslices (or more generally accelerator islands) supporting a large scale training job could scale down in case of failures.
The jobs are indexed, so a scale down means removing the higher order ones.
It is possible. If the child jobs themselves should be elastic, then the operator could change the individual jobs directly. But I guess we could also allow changing that in bulk for all job replicas, but I need to hear a use case first. |
So @ahg-g it sounds like this is supported as you are correct. Both replicas in ReplicatedJob are mutable and JobTemplate is mutable.. Maybe we should consider a task for this to at least document that this is possible? I think Kueue or other use cases would be interested in this but not sure what we need in this repo. |
We need to have tests for that to verify the behavior though. |
Well good thing I tried it haha. I think this code is blocking us from doing this. https://github.com/kubernetes-sigs/jobset/blob/main/api/jobset/v1alpha2/jobset_webhook.go#L172 I tried a simple example and did a Got:
|
/retitle Support Elastic JobSets |
I opened up #465 for discussion. We were treating the entire replicated job as immutable. It isn't clear to me what validation logic we want to have for a replicated job. We could go with just changing replicas (name and JobTemplate are immutable). |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
@andreyvelich @tenzen-y Could you comment on what kind of behavior you'd expect from JobSet for Elastic PyTorch? |
Following up on this @andreyvelich @tenzen-y can you please respond to Kevin's question when you have a moment? Since his PR #622 is close to being ready to merge and I'd like to make sure we aren't locking ourselves into an implementation that may not play nicely with torch elastic training. |
Sorry for the late reply, sure, let me review #622. |
So for v2, would you use HPA to scale replicated jobs? |
Yes, that's right. To support Elastic PyTorch Training, we need to implement this feature. |
did we have a KEP for this feature? |
The reason I am asking is because we didn't document the user stories and how this will work with PyTorch elastic training, so I am not sure if what we are implementing will address those stories. |
I didn't think too because it seemed simple enough without any API changes. |
It is more about how we expect this to be used, it is not clear to me how elastic PyTorch will integrate with this, and what we expect from other frameworks (like Jax for example) to behave to be able to take advantage of this feature. |
I was following https://github.com/kubernetes/enhancements/tree/master/keps/sig-apps/3715-elastic-indexed-job#motivation lead. This is about allowing for one to change replicas of ReplicatedJobs. |
From what Yuki and Andrey said, I don’t think HPA will be supported right away for v2. I also thought of this feature due to dynamic job support in Kueue. But I don’t have an exact use case at the moment. |
Hard to build features without a clear and fully documented use case. I suggest to not more forward without a clear and practical user stories. |
So what was the motivation behind Elastic Index Jobs? Have you found any use case with Elastic PyTorch Job or Jax? |
Our goal is to re-use elastic functionality from the JobSet when we support it.
It will be useful for frameworks that support elasticity, for example you can configure Maybe @kuizhiqing @gaocegege @tenzen-y can share more elastic use-cases. |
When I slept on this, I think I agree with @ahg-g. We have two similar ideas for elasticity (#482) and this issue. It would be worth having a customer who has some ideas on how they would like this rather than implementing for the sake of it. We could use Elastic Index Job or we could relax restrictions for the replicas. I think both are valuable but maybe having clear user stories for this or at least a customer ask where they are ready to pilot it is necessary. |
I would recommend postponing this to v0.8 since it's challenging to provide the concrete user stories by the kubeflow side based on the v2 baseline development progresses. After we implement the kubeflow v2 baseline, we can draw solid stories. |
@ahg-g you mentioned one potential use case here (support for scaling replicatedJobs to match number of healthy TPU slices). However, I agree that when designing this feature we should consider framework specific features with similar elasticity requirements, such as Pytorch elastic training. Handling changes to the underlying infra mid-training run would require both k8s layer handling and ML framework layer handling anyway.
@andreyvelich I think this pytorch elastic use case would be best supported in JobSet by scaling the size of the indexed job (i.e., elastic indexed jobs) since we don't necessarily want to scale up by creating a new job replica with N pods (where N = For the use case of scaling the JobSet up/down to match the number of healthy of TPU slices, this would require scaling the number of Jobs, since In summary, it seems to me supporting pytorch elastic training and support for scaling up/down TPU slices will have different requirements and implementation details, so I agree it would be good to do a KEP discussing these use cases (among other use cases where elasticity is required) to determine the proper API(s) and implementation strategy. |
What would you like to be added:
With Elastic Indexed jobs, it is possible to change completions/parallelism to down/up scale your jobs.
It would be nice to have something similar for JobSet.
Why is this needed:
Elastic jobs are an important usecase for autoscaling and other cases.
Implementation:
At a quick glance of the API this may be possible as replicas of a replicated job are not immutable so I think someone could patch the replicas of a ReplicatedJob to downscale or upscale.
But then I wonder what should we do with the existing replicated job?
And should we support ElasticIndexedJob with JobSet (so someone could patch the JobTemplate in a single replicated job?
The text was updated successfully, but these errors were encountered: