feat: pass test
This commit is contained in:
parent
115f57ab84
commit
08c75756e0
|
@ -1,6 +1,5 @@
|
|||
import hashlib
|
||||
import socket
|
||||
import tempfile
|
||||
|
||||
from joj3_config_generator.models import (
|
||||
Cmd,
|
||||
|
@ -17,10 +16,6 @@ from joj3_config_generator.models import (
|
|||
)
|
||||
|
||||
|
||||
def get_temp_directory() -> str:
|
||||
return tempfile.mkdtemp(prefix="repo-checker-")
|
||||
|
||||
|
||||
def getGradingRepoName() -> str:
|
||||
host_name = socket.gethostname()
|
||||
return f"{host_name.split('-')[0]}-joj"
|
||||
|
@ -53,7 +48,7 @@ def getHealthcheckCmd(repo_conf: Repo) -> Cmd:
|
|||
else:
|
||||
immutable_files = immutable_files + name + ","
|
||||
# FIXME: need to make solution and make things easier to edit with global scope
|
||||
chore = f"/{get_temp_directory}/repo-health-checker -root=. "
|
||||
chore = f"/tmp/repo-health-checker -root=. "
|
||||
args = ""
|
||||
args = args + chore
|
||||
args = args + repo_size
|
||||
|
@ -68,9 +63,7 @@ def getHealthcheckCmd(repo_conf: Repo) -> Cmd:
|
|||
args=args.split(),
|
||||
# FIXME: easier to edit within global scope
|
||||
copy_in={
|
||||
f"/{get_temp_directory()}/repo-health-checker": CmdFile(
|
||||
src=f"/{get_temp_directory()}/repo-health-checker"
|
||||
)
|
||||
f"/tmp/repo-health-checker": result.CmdFile(src=f"/tmp/repo-health-checker")
|
||||
},
|
||||
)
|
||||
return cmd
|
||||
|
|
|
@ -8,9 +8,8 @@ import typer
|
|||
import yaml
|
||||
|
||||
from joj3_config_generator.convert import convert as convert_conf
|
||||
|
||||
# from joj3_config_generator.lib.task import get_processed_task_obj
|
||||
from joj3_config_generator.models import Repo, Task
|
||||
from joj3_config_generator.convert import convert_joj1 as convert_joj1_conf
|
||||
from joj3_config_generator.models import joj1, repo, result, task
|
||||
from joj3_config_generator.utils.logger import logger
|
||||
|
||||
app = typer.Typer(add_completion=False)
|
||||
|
@ -47,6 +46,7 @@ def convert_joj1(yaml_file: typer.FileText, toml_file: typer.FileTextWrite) -> N
|
|||
|
||||
|
||||
@app.command()
|
||||
def convert(root: Path = Path(".")) -> result.Config:
|
||||
def convert(root: Path = Path(".")) -> result.Config:
|
||||
"""
|
||||
Convert given dir of JOJ3 toml config files to JOJ3 json config files
|
||||
|
@ -70,3 +70,5 @@ def convert(root: Path = Path(".")) -> result.Config:
|
|||
result_file.write("\n")
|
||||
|
||||
return result_model
|
||||
|
||||
return result_model
|
||||
|
|
|
@ -15,10 +15,7 @@
|
|||
"with": {
|
||||
"default": {
|
||||
"args": [
|
||||
"/<function",
|
||||
"get_temp_directory",
|
||||
"at",
|
||||
"0x7f8686b98180>/repo-health-checker",
|
||||
"/tmp/repo-health-checker",
|
||||
"-root=.",
|
||||
"-repoSize=50.5",
|
||||
"-meta=main.py",
|
||||
|
@ -70,8 +67,8 @@
|
|||
"cpuRateLimit": 0,
|
||||
"cpuSetLimit": "",
|
||||
"copyIn": {
|
||||
"//tmp/repo-checker-9jj98lrm/repo-health-checker": {
|
||||
"src": "//tmp/repo-checker-er4az3r2/repo-health-checker",
|
||||
"/tmp/repo-health-checker": {
|
||||
"src": "/tmp/repo-health-checker",
|
||||
"content": null,
|
||||
"fileId": null,
|
||||
"name": null,
|
||||
|
|
|
@ -3,6 +3,7 @@ import os
|
|||
from typing import Any, Dict, Tuple
|
||||
|
||||
import rtoml
|
||||
from deepdiff import DeepDiff
|
||||
|
||||
from joj3_config_generator.convert import convert
|
||||
from joj3_config_generator.models import repo, task
|
||||
|
@ -12,13 +13,13 @@ def read_convert_files(
|
|||
case_name: str,
|
||||
) -> Tuple[repo.Config, task.Config, Dict[str, Any]]:
|
||||
root = os.path.dirname(os.path.realpath(__file__))
|
||||
repo_toml_path = os.path.join(root.absolute(), case_name, "repo.toml")
|
||||
repo_toml_path = os.path.join(root, case_name, "repo.toml")
|
||||
with open(repo_toml_path) as f:
|
||||
repo_toml = f.read()
|
||||
task_toml_path = os.path.join(root.absolute(), case_name, "task.toml")
|
||||
task_toml_path = os.path.join(root, case_name, "task.toml")
|
||||
with open(task_toml_path) as f:
|
||||
task_toml = f.read()
|
||||
result_json_path = os.path.join(root.absolute(), case_name, "task.json")
|
||||
result_json_path = os.path.join(root, case_name, "task.json")
|
||||
with open(result_json_path) as f:
|
||||
result: Dict[str, Any] = json.load(f)
|
||||
repo_obj = rtoml.loads(repo_toml)
|
||||
|
|
Loading…
Reference in New Issue
Block a user