Skip to content
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

Improvement: Vehicle Model generator as module integration #27

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
run: |
pip install -r vehicle-model-lifecycle/src/requirements.txt
pip install -r vehicle-model-lifecycle/test/requirements.txt
python vehicle-model-lifecycle/src/install_deps.py

- name: unit test
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{
"name": "modelGeneratorGitRef",
"type": "string",
"default": "v0.3.0",
"default": "vehicle-model-generator-improvement",
"description": "Git ref of the model generator repo. Can be a tag, branch or SHA"
}
]
Expand Down
20 changes: 5 additions & 15 deletions vehicle-model-lifecycle/src/generate_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
import os
import shutil
import subprocess
import sys
from pathlib import Path

from sdv.model_generator.main import generate_model # type: ignore


def require_env(name: str) -> str:
"""Require and return an environment variable.
Expand Down Expand Up @@ -81,19 +82,8 @@ def invoke_generator(
f"Invoking model generator for language {output_language} and file "
f"{vspec_file_path!r}"
)
subprocess.check_call(
[
sys.executable,
"-m",
"sdv.model_generator.main",
"-l",
output_language,
"-T",
output_path,
vspec_file_path,
],
cwd=get_workspace_dir(),
)

generate_model(output_language, vspec_file_path, target_folder=output_path)


def install_model_if_required(language: str, model_path: str) -> None:
Expand All @@ -104,7 +94,7 @@ def install_model_if_required(language: str, model_path: str) -> None:
model_path (str): The path where the generated model is stored.
"""
if language == "python":
subprocess.check_call([sys.executable, "-m", "pip", "install", model_path])
subprocess.check_call(["sys.executable", "-m", "pip", "install", model_path])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is sys.executable quoted now? That way its just a string literal and not a variable which is being resolved. I doubt this change is runnable. Have you tested it?



if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions vehicle-model-lifecycle/src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
types-requests==2.31.0
requests==2.31.0
Loading