Skip to content

Commit

Permalink
feat(main, config): make backend run as subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamhexi committed Oct 8, 2024
1 parent e391be9 commit 21f0249
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mode: CLI
mode: BACKEND
logging_level: DEBUG
production_mode: false
learning_materials: ./learning_assets
experiment_implementation: ./tests/model
experiment_results: ./tests/model/results
19 changes: 16 additions & 3 deletions knowledge_verificator/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Main module with CLI definition."""

from pathlib import Path
import subprocess

Check warning on line 4 in knowledge_verificator/main.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

knowledge_verificator/main.py#L4

Consider possible security implications associated with the subprocess module.
import sys
from knowledge_verificator.utils.configuration_parser import OperatingMode

from knowledge_verificator.io_handler import config
from knowledge_verificator.utils.configuration_parser import OperatingMode
from knowledge_verificator.command_line import run_cli_mode
from tests.model.runner import ExperimentRunner

Expand All @@ -19,5 +21,16 @@
run_cli_mode()

case OperatingMode.BACKEND:
pass
# TODO: Implement running backend.
if config.production_mode:
MODE = 'run'
else:
MODE = 'dev'

args: list[str] = [
'fastapi',
MODE,
'knowledge_verificator/backend.py',
]
process = subprocess.Popen(

Check warning on line 34 in knowledge_verificator/main.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

knowledge_verificator/main.py#L34

subprocess call - check for execution of untrusted input.
args=args,
)
1 change: 1 addition & 0 deletions knowledge_verificator/utils/configuration_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Configuration:
mode: OperatingMode
experiment_implementation: Path
experiment_results: Path
production_mode: bool

def __init__(
self,
Expand Down

0 comments on commit 21f0249

Please sign in to comment.