-
Notifications
You must be signed in to change notification settings - Fork 700
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
[SDK] Create Unify Training Client #1719
Changes from all commits
3523221
383c757
385e632
b31e778
963932e
c6d1516
bc7cd54
55f6922
32e32f2
65ef786
3c5d4db
33705c2
71bd898
8ade008
ad6d693
3cb3443
3339089
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,21 +46,30 @@ def fix_test_files() -> None: | |
for test_file in test_files: | ||
print(f"Precessing file {test_file}") | ||
if test_file.endswith(".py"): | ||
with fileinput.FileInput(os.path.join(test_folder_dir, test_file), inplace=True) as file: | ||
with fileinput.FileInput( | ||
os.path.join(test_folder_dir, test_file), inplace=True | ||
) as file: | ||
for line in file: | ||
print(_apply_regex(line), end='') | ||
print(_apply_regex(line), end="") | ||
|
||
|
||
def add_imports() -> None: | ||
with open(os.path.join(sdk_dir, "kubeflow/training/__init__.py"), "a") as init_file: | ||
init_file.write("from kubeflow.training.api.tf_job_client import TFJobClient\n") | ||
init_file.write("from kubeflow.training.api.py_torch_job_client import PyTorchJobClient\n") | ||
init_file.write("from kubeflow.training.api.xgboost_job_client import XGBoostJobClient\n") | ||
init_file.write("from kubeflow.training.api.mpi_job_client import MPIJobClient\n") | ||
init_file.write("from kubeflow.training.api.mx_job_client import MXJobClient\n") | ||
init_file.write("from kubeflow.training.api.paddle_job_client import PaddleJobClient\n") | ||
with open(os.path.join(sdk_dir, "kubeflow/__init__.py"), "a") as init_file: | ||
init_file.write("__path__ = __import__('pkgutil').extend_path(__path__, __name__)") | ||
with open(os.path.join(sdk_dir, "kubeflow/training/__init__.py"), "a") as f: | ||
f.write("from kubeflow.training.api.training_client import TrainingClient\n") | ||
with open(os.path.join(sdk_dir, "kubeflow/__init__.py"), "a") as f: | ||
f.write("__path__ = __import__('pkgutil').extend_path(__path__, __name__)") | ||
|
||
# Add Kubernetes models to proper deserialization of Training models. | ||
with open(os.path.join(sdk_dir, "kubeflow/training/models/__init__.py"), "r") as f: | ||
new_lines = [] | ||
for line in f.readlines(): | ||
new_lines.append(line) | ||
if line.startswith("from __future__ import absolute_import"): | ||
new_lines.append("\n") | ||
new_lines.append("# Import Kubernetes models.\n") | ||
new_lines.append("from kubernetes.client import *\n") | ||
with open(os.path.join(sdk_dir, "kubeflow/training/models/__init__.py"), "w") as f: | ||
f.writelines(new_lines) | ||
Comment on lines
+62
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to generate swagger.json containing kubernetes APIs, not importing them to Python SDK. For example, we can generate swagger.json with kubernetes core API in the following: $ openapi-gen --input-dirs github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1,github.com/kubeflow/common/pkg/apis/common/v1,k8s.io/api/core/v1 --report-filename=hack/violation_exception.list \
--output-package github.com/kubeflow/training-operator/pkg/apis/kubeflow.org/v1 \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--output-base "${TEMP_DIR}" WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, but in that case we are going to store all the Kubernetes models in our repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... You're correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel that we can keep the way as it is for this PR and create a separate issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, let's discuss the long term plan for it separately. |
||
|
||
|
||
def _apply_regex(input_str: str) -> str: | ||
|
@@ -69,5 +78,5 @@ def _apply_regex(input_str: str) -> str: | |
return input_str | ||
|
||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
main() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
{ | ||
"packageName" : "kubeflow.training", | ||
"projectName" : "training", | ||
"packageVersion": "1.5.0", | ||
"importMappings": { | ||
"V1Container": "from kubernetes.client import V1Container", | ||
"V1ObjectMeta": "from kubernetes.client import V1ObjectMeta", | ||
"V1ListMeta": "from kubernetes.client import V1ListMeta", | ||
"V1ResourceRequirements": "from kubernetes.client import V1ResourceRequirements", | ||
"V1JobCondition": "from kubernetes.client import V1JobCondition", | ||
"V1PodTemplateSpec": "from kubernetes.client import V1PodTemplateSpec" | ||
} | ||
"packageName": "kubeflow.training", | ||
"projectName": "training", | ||
"packageVersion": "1.5.0", | ||
"typeMappings": { | ||
"V1Time": "datetime" | ||
} | ||
} |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we removed all configuration files for ksonnet in this PR. So Can we remove this section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update these docs for the new E2Es, do we want to do it in the following PRs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I'm ok with either PR.