-
Notifications
You must be signed in to change notification settings - Fork 41
feat: Implement TrainerClient Backends & Local Process #33
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
3524abc
Implement TrainerClient Backends & Local Process
szaher 0f4e504
Merge branch 'main' of github.com:kubeflow/sdk into training-backends
szaher 908af68
Implement Job Cancellation
szaher 71e83ae
Merge branch 'main' into training-backends
szaher 3d578c7
update local job to add resouce limitation in k8s style
szaher bed8f70
Update python/kubeflow/trainer/api/trainer_client.py
szaher 3781c23
Merge with latest changes from main
szaher 28db17f
Fix linting issues
szaher 7977cc4
fix unit tests
szaher da0ce2f
add support wait_for_job_status
szaher ca564d6
Update data types
szaher d9af6f2
fix merge conflict
szaher 2383c52
Merge branch 'main' into training-backends
szaher 46961ba
fix unit tests
szaher e226167
remove TypeAlias
szaher 2ef70db
Replace TRAINER_BACKEND_REGISTRY with TRAINER_BACKEND
szaher 822a262
Update kubeflow/trainer/api/trainer_client.py
szaher f00280a
Update kubeflow/trainer/api/trainer_client.py
szaher e0c714f
Restructure training backends into separate dirs
szaher 1dbc3e9
Update kubeflow/trainer/api/trainer_client.py
szaher 460aae2
Merge branch 'main' into training-backends
szaher 46a5fd7
add get_runtime_packages as not supported by local-exec
szaher ea3e9cf
move backends and its configs to kubeflow.trainer
szaher 2976f8a
fix typo in delete_job
szaher e4a57b3
Move local_runtimes to constants
szaher 8d6b1e7
use google style docstring for LocalJob
szaher c3719b5
remove debug opt from LocalProcessConfig
szaher 64cdcba
only use imports from kubeflow.trainer for backends
szaher 511b22b
upload local-exec to use only one step
szaher 74d60a4
optimize loops when getting runtime
szaher 9d9a14c
add LocalRuntimeTrainer
szaher 60d96d0
rename cleanup config item to cleanup_venv
szaher 8e9190e
convert local runtime to runtime
szaher ac0be0c
convert runtimes before returning
szaher 4b1db8c
fix get_job_logs to align with parent interface
szaher 4fe7baa
rename get_runtime_trainer func
szaher 9775f3f
rename get_training_job_command to get_local_train_job_script
szaher 42c7769
Ignore failures in Coveralls action
andreyvelich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Copyright 2025 The Kubeflow Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from kubeflow.trainer.backends.k8s import K8SBackend | ||
| from kubeflow.trainer.backends.local_process import LocalProcessBackend | ||
| from kubeflow.trainer.types.backends import K8SBackendConfig, LocalProcessBackendConfig | ||
|
|
||
| TRAINER_BACKEND_REGISTRY = { | ||
| "kubernetes": { | ||
| "backend_cls": K8SBackend, | ||
| "config_cls": K8SBackendConfig, | ||
| }, | ||
| "local": { | ||
| "backend_cls": LocalProcessBackend, | ||
| "config_cls": LocalProcessBackendConfig, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Copyright 2025 The Kubeflow Authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import abc | ||
|
|
||
| from typing import Dict, List, Optional | ||
| from kubeflow.trainer.constants import constants | ||
| from kubeflow.trainer.types import types | ||
|
|
||
|
|
||
| class TrainingBackend(abc.ABC): | ||
|
|
||
| @abc.abstractmethod | ||
| def list_runtimes(self) -> List[types.Runtime]: | ||
| raise NotImplementedError() | ||
|
|
||
| @abc.abstractmethod | ||
| def get_runtime(self, name: str) -> Optional[types.Runtime]: | ||
| raise NotImplementedError() | ||
|
|
||
| @abc.abstractmethod | ||
| def train(self, | ||
| train_job_name: str, | ||
| runtime: types.Runtime, | ||
| initializer: Optional[types.Initializer] = None, | ||
| trainer: Optional[types.Trainer] = None, | ||
| ) -> str: | ||
| raise NotImplementedError() | ||
|
|
||
| @abc.abstractmethod | ||
| def list_jobs( | ||
| self, runtime: Optional[types.Runtime] = None | ||
| ) -> List[types.TrainJob]: | ||
| raise NotImplementedError() | ||
|
|
||
| @abc.abstractmethod | ||
| def get_job(self, name: str) -> Optional[types.TrainJob]: | ||
| raise NotImplementedError() | ||
szaher marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @abc.abstractmethod | ||
| def get_job_logs(self, | ||
| name: str, | ||
| follow: Optional[bool] = False, | ||
| step: str = constants.NODE, | ||
| node_rank: int = 0, | ||
| ) -> Dict[str, str]: | ||
| raise NotImplementedError() | ||
|
|
||
| @abc.abstractmethod | ||
| def delete_job(self, name: str) -> None: | ||
| raise NotImplementedError() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.