Skip to content

Commit a8e5adc

Browse files
yao531441pre-commit-ci[bot]Zhenzhong1
authored
[Exporter Tool] Updated exporter tool for docker compose and k8s manifests. (opea-project#813)
* Support convert mega.yaml to docker compose yaml. * Remove device option in opea mege exporter. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updated manifests exporter * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updated manifests_exporter.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updated mega.yaml & updated manifests_exporter * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * done * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * cleancode * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * cleancode and refactor to function * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added UT for manifests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix for UT. * fixed the UT issue. * merged to one file. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Zhenzhong1 <[email protected]>
1 parent b8948f2 commit a8e5adc

File tree

7 files changed

+854
-1422
lines changed

7 files changed

+854
-1422
lines changed

comps/cores/mega/cli.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
import argparse
55

66
from .exporter import convert_to_docker_compose
7+
from .manifests_exporter import convert_to_manifests
78

89

9-
def export_kubernetes_manifests(mega_yaml, output_dir, device="cpu"):
10-
print(f"Generating Kubernetes manifests from {mega_yaml} to {output_dir}")
11-
# Add your logic to convert the YAML to Kubernetes manifest here
10+
def export_kubernetes_manifests(mega_yaml, output_file):
11+
print(f"Generating Kubernetes manifests from {mega_yaml} to {output_file}")
12+
convert_to_manifests(mega_yaml, output_file)
1213

1314

14-
def export_docker_compose(mega_yaml, output_file, device="cpu"):
15+
def export_docker_compose(mega_yaml, output_file):
1516
print(f"Generating Docker Compose file from {mega_yaml} to {output_file}")
16-
convert_to_docker_compose(mega_yaml, output_file, device)
17+
convert_to_docker_compose(mega_yaml, output_file)
1718

1819

1920
def opea_execute():
@@ -30,9 +31,6 @@ def opea_execute():
3031
compose_parser = export_subparsers.add_parser("docker-compose", help="Export to Docker Compose")
3132
compose_parser.add_argument("mega_yaml", help="Path to the mega YAML file")
3233
compose_parser.add_argument("output_file", help="Path to the Docker Compose file")
33-
compose_parser.add_argument(
34-
"--device", choices=["cpu", "gaudi", "xpu", "gpu"], default="cpu", help="Device type to use (default: cpu)"
35-
)
3634

3735
# Export to Kubernetes
3836
kube_parser = export_subparsers.add_parser("kubernetes", help="Export to Kubernetes")
@@ -48,7 +46,7 @@ def opea_execute():
4846
# Execute appropriate command
4947
if args.command == "export":
5048
if args.export_command == "docker-compose":
51-
export_docker_compose(args.mega_yaml, args.output_file, args.device)
49+
export_docker_compose(args.mega_yaml, args.output_file)
5250
elif args.export_command == "kubernetes":
5351
export_kubernetes_manifests(args.mega_yaml, args.output_dir, args.device)
5452
else:

comps/cores/mega/exporter.py

Lines changed: 502 additions & 244 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)