feat: force skip teapot on test
This commit is contained in:
		
							parent
							
								
									279182f659
								
							
						
					
					
						commit
						c7917efac7
					
				|  | @ -34,17 +34,15 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config: | ||||||
|         stage=result.Stage( |         stage=result.Stage( | ||||||
|             stages=[], |             stages=[], | ||||||
|             sandbox_token=repo_conf.sandbox_token, |             sandbox_token=repo_conf.sandbox_token, | ||||||
|             poststages=[get_teapot_stage(repo_conf)], |             post_stages=[], | ||||||
|         ), |         ), | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|  |     current_test = os.environ.get("PYTEST_CURRENT_TEST") is not None | ||||||
|     # Construct healthcheck stage |     # Construct healthcheck stage | ||||||
|     if ( |     print(current_test) | ||||||
|         not repo_conf.force_skip_health_check_on_test |     if not repo_conf.force_skip_health_check_on_test or not current_test: | ||||||
|         or os.environ.get("PYTEST_CURRENT_TEST") is None |         result_conf.stage.stages.append(get_healthcheck_config(repo_conf)) | ||||||
|     ): |  | ||||||
|         healthcheck_stage = get_healthcheck_config(repo_conf) |  | ||||||
|         result_conf.stage.stages.append(healthcheck_stage) |  | ||||||
|     stages: List[str] = [] |     stages: List[str] = [] | ||||||
|     # Convert each stage in the task configuration |     # Convert each stage in the task configuration | ||||||
|     for task_stage in task_conf.stages: |     for task_stage in task_conf.stages: | ||||||
|  | @ -56,6 +54,8 @@ def convert(repo_conf: repo.Config, task_conf: task.Config) -> result.Config: | ||||||
|         conf_stage = fix_file(task_stage, conf_stage) |         conf_stage = fix_file(task_stage, conf_stage) | ||||||
|         conf_stage = fix_diff(task_stage, conf_stage, task_conf) |         conf_stage = fix_diff(task_stage, conf_stage, task_conf) | ||||||
|         result_conf.stage.stages.append(conf_stage) |         result_conf.stage.stages.append(conf_stage) | ||||||
|  |     if not repo_conf.force_skip_teapot_on_test or not current_test: | ||||||
|  |         result_conf.stage.post_stages.append(get_teapot_stage(repo_conf)) | ||||||
| 
 | 
 | ||||||
|     return result_conf |     return result_conf | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -21,6 +21,7 @@ class Config(BaseModel): | ||||||
|     sandbox_token: str = Field("") |     sandbox_token: str = Field("") | ||||||
|     max_total_score: int = Field(100) |     max_total_score: int = Field(100) | ||||||
|     force_skip_health_check_on_test: bool = False |     force_skip_health_check_on_test: bool = False | ||||||
|  |     force_skip_teapot_on_test: bool = False | ||||||
|     groups: Groups = Groups() |     groups: Groups = Groups() | ||||||
|     root: Path = Path(".") |     root: Path = Path(".") | ||||||
|     path: Path = Path("repo.toml") |     path: Path = Path("repo.toml") | ||||||
|  |  | ||||||
|  | @ -142,8 +142,8 @@ class Stage(BaseModel): | ||||||
|         "/tmp/joj3_result.json", serialization_alias="outputPath" |         "/tmp/joj3_result.json", serialization_alias="outputPath" | ||||||
|     )  # nosec: B108 |     )  # nosec: B108 | ||||||
|     stages: List[StageDetail] |     stages: List[StageDetail] | ||||||
|     prestages: Optional[List[StageDetail]] = None |     pre_stages: List[StageDetail] = Field([], serialization_alias="preStages") | ||||||
|     poststages: List[StageDetail] |     post_stages: List[StageDetail] = Field([], serialization_alias="postStages") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Config(BaseModel): | class Config(BaseModel): | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| import hashlib | import hashlib | ||||||
| import shlex | import shlex | ||||||
| import socket |  | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
| 
 | 
 | ||||||
| from joj3_config_generator.models import repo, result | from joj3_config_generator.models import repo, result | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| import re | import re | ||||||
| import shlex | import shlex | ||||||
| from pathlib import Path |  | ||||||
| from typing import List, Tuple | from typing import List, Tuple | ||||||
| 
 | 
 | ||||||
| from joj3_config_generator.models import result, task | from joj3_config_generator.models import result, task | ||||||
|  |  | ||||||
|  | @ -765,7 +765,8 @@ | ||||||
|                 ] |                 ] | ||||||
|             } |             } | ||||||
|         ], |         ], | ||||||
|         "poststages": [ |         "preStages": [], | ||||||
|  |         "postStages": [ | ||||||
|             { |             { | ||||||
|                 "name": "teapot", |                 "name": "teapot", | ||||||
|                 "group": "", |                 "group": "", | ||||||
|  |  | ||||||
|  | @ -1 +1,2 @@ | ||||||
| force_skip_health_check_on_test = true | force_skip_health_check_on_test = true | ||||||
|  | force_skip_teapot_on_test = true | ||||||
|  |  | ||||||
|  | @ -141,61 +141,7 @@ | ||||||
|                 ] |                 ] | ||||||
|             } |             } | ||||||
|         ], |         ], | ||||||
|         "poststages": [ |         "preStages": [], | ||||||
|             { |         "postStages": [] | ||||||
|                 "name": "teapot", |  | ||||||
|                 "group": "", |  | ||||||
|                 "executor": { |  | ||||||
|                     "name": "local", |  | ||||||
|                     "with": { |  | ||||||
|                         "default": { |  | ||||||
|                             "args": [ |  | ||||||
|                                 "/usr/local/bin/joint-teapot", |  | ||||||
|                                 "joj3-all-env", |  | ||||||
|                                 "/home/tt/.config/teapot/teapot.env", |  | ||||||
|                                 "--grading-repo-name", |  | ||||||
|                                 "ece280-joj", |  | ||||||
|                                 "--max-total-score", |  | ||||||
|                                 "100" |  | ||||||
|                             ], |  | ||||||
|                             "env": [ |  | ||||||
|                                 "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" |  | ||||||
|                             ], |  | ||||||
|                             "cpuLimit": 0, |  | ||||||
|                             "realCpuLimit": 0, |  | ||||||
|                             "clockLimit": 2, |  | ||||||
|                             "memoryLimit": 128000000, |  | ||||||
|                             "stackLimit": 0, |  | ||||||
|                             "procLimit": 50, |  | ||||||
|                             "cpuRateLimit": 0, |  | ||||||
|                             "cpuSetLimit": "", |  | ||||||
|                             "copyIn": {}, |  | ||||||
|                             "copyInCached": {}, |  | ||||||
|                             "copyInDir": ".", |  | ||||||
|                             "copyOut": [ |  | ||||||
|                                 "stdout", |  | ||||||
|                                 "stderr" |  | ||||||
|                             ], |  | ||||||
|                             "copyOutCached": [], |  | ||||||
|                             "copyOutMax": 0, |  | ||||||
|                             "copyOutDir": "", |  | ||||||
|                             "tty": false, |  | ||||||
|                             "strictMemoryLimit": false, |  | ||||||
|                             "dataSegmentLimit": false, |  | ||||||
|                             "addressSpaceLimit": false |  | ||||||
|                         }, |  | ||||||
|                         "cases": [] |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 "parsers": [ |  | ||||||
|                     { |  | ||||||
|                         "name": "log", |  | ||||||
|                         "with": { |  | ||||||
|                             "msg": "joj3 summary" |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 ] |  | ||||||
|             } |  | ||||||
|         ] |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1 +1,2 @@ | ||||||
| force_skip_health_check_on_test = true | force_skip_health_check_on_test = true | ||||||
|  | force_skip_teapot_on_test = true | ||||||
|  |  | ||||||
|  | @ -111,61 +111,7 @@ | ||||||
|                 ] |                 ] | ||||||
|             } |             } | ||||||
|         ], |         ], | ||||||
|         "poststages": [ |         "preStages": [], | ||||||
|             { |         "postStages": [] | ||||||
|                 "name": "teapot", |  | ||||||
|                 "group": "", |  | ||||||
|                 "executor": { |  | ||||||
|                     "name": "local", |  | ||||||
|                     "with": { |  | ||||||
|                         "default": { |  | ||||||
|                             "args": [ |  | ||||||
|                                 "/usr/local/bin/joint-teapot", |  | ||||||
|                                 "joj3-all-env", |  | ||||||
|                                 "/home/tt/.config/teapot/teapot.env", |  | ||||||
|                                 "--grading-repo-name", |  | ||||||
|                                 "ece280-joj", |  | ||||||
|                                 "--max-total-score", |  | ||||||
|                                 "100" |  | ||||||
|                             ], |  | ||||||
|                             "env": [ |  | ||||||
|                                 "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" |  | ||||||
|                             ], |  | ||||||
|                             "cpuLimit": 0, |  | ||||||
|                             "realCpuLimit": 0, |  | ||||||
|                             "clockLimit": 2, |  | ||||||
|                             "memoryLimit": 128000000, |  | ||||||
|                             "stackLimit": 0, |  | ||||||
|                             "procLimit": 50, |  | ||||||
|                             "cpuRateLimit": 0, |  | ||||||
|                             "cpuSetLimit": "", |  | ||||||
|                             "copyIn": {}, |  | ||||||
|                             "copyInCached": {}, |  | ||||||
|                             "copyInDir": ".", |  | ||||||
|                             "copyOut": [ |  | ||||||
|                                 "stdout", |  | ||||||
|                                 "stderr" |  | ||||||
|                             ], |  | ||||||
|                             "copyOutCached": [], |  | ||||||
|                             "copyOutMax": 0, |  | ||||||
|                             "copyOutDir": "", |  | ||||||
|                             "tty": false, |  | ||||||
|                             "strictMemoryLimit": false, |  | ||||||
|                             "dataSegmentLimit": false, |  | ||||||
|                             "addressSpaceLimit": false |  | ||||||
|                         }, |  | ||||||
|                         "cases": [] |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 "parsers": [ |  | ||||||
|                     { |  | ||||||
|                         "name": "log", |  | ||||||
|                         "with": { |  | ||||||
|                             "msg": "joj3 summary" |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 ] |  | ||||||
|             } |  | ||||||
|         ] |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1 +1,2 @@ | ||||||
| force_skip_health_check_on_test = true | force_skip_health_check_on_test = true | ||||||
|  | force_skip_teapot_on_test = true | ||||||
|  |  | ||||||
|  | @ -113,61 +113,7 @@ | ||||||
|                 ] |                 ] | ||||||
|             } |             } | ||||||
|         ], |         ], | ||||||
|         "poststages": [ |         "preStages": [], | ||||||
|             { |         "postStages": [] | ||||||
|                 "name": "teapot", |  | ||||||
|                 "group": "", |  | ||||||
|                 "executor": { |  | ||||||
|                     "name": "local", |  | ||||||
|                     "with": { |  | ||||||
|                         "default": { |  | ||||||
|                             "args": [ |  | ||||||
|                                 "/usr/local/bin/joint-teapot", |  | ||||||
|                                 "joj3-all-env", |  | ||||||
|                                 "/home/tt/.config/teapot/teapot.env", |  | ||||||
|                                 "--grading-repo-name", |  | ||||||
|                                 "ece280-joj", |  | ||||||
|                                 "--max-total-score", |  | ||||||
|                                 "100" |  | ||||||
|                             ], |  | ||||||
|                             "env": [ |  | ||||||
|                                 "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" |  | ||||||
|                             ], |  | ||||||
|                             "cpuLimit": 0, |  | ||||||
|                             "realCpuLimit": 0, |  | ||||||
|                             "clockLimit": 2, |  | ||||||
|                             "memoryLimit": 128000000, |  | ||||||
|                             "stackLimit": 0, |  | ||||||
|                             "procLimit": 50, |  | ||||||
|                             "cpuRateLimit": 0, |  | ||||||
|                             "cpuSetLimit": "", |  | ||||||
|                             "copyIn": {}, |  | ||||||
|                             "copyInCached": {}, |  | ||||||
|                             "copyInDir": ".", |  | ||||||
|                             "copyOut": [ |  | ||||||
|                                 "stdout", |  | ||||||
|                                 "stderr" |  | ||||||
|                             ], |  | ||||||
|                             "copyOutCached": [], |  | ||||||
|                             "copyOutMax": 0, |  | ||||||
|                             "copyOutDir": "", |  | ||||||
|                             "tty": false, |  | ||||||
|                             "strictMemoryLimit": false, |  | ||||||
|                             "dataSegmentLimit": false, |  | ||||||
|                             "addressSpaceLimit": false |  | ||||||
|                         }, |  | ||||||
|                         "cases": [] |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 "parsers": [ |  | ||||||
|                     { |  | ||||||
|                         "name": "log", |  | ||||||
|                         "with": { |  | ||||||
|                             "msg": "joj3 summary" |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 ] |  | ||||||
|             } |  | ||||||
|         ] |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1 +1,2 @@ | ||||||
| force_skip_health_check_on_test = true | force_skip_health_check_on_test = true | ||||||
|  | force_skip_teapot_on_test = true | ||||||
|  |  | ||||||
|  | @ -138,61 +138,7 @@ | ||||||
|                 ] |                 ] | ||||||
|             } |             } | ||||||
|         ], |         ], | ||||||
|         "poststages": [ |         "preStages": [], | ||||||
|             { |         "postStages": [] | ||||||
|                 "name": "teapot", |  | ||||||
|                 "group": "", |  | ||||||
|                 "executor": { |  | ||||||
|                     "name": "local", |  | ||||||
|                     "with": { |  | ||||||
|                         "default": { |  | ||||||
|                             "args": [ |  | ||||||
|                                 "/usr/local/bin/joint-teapot", |  | ||||||
|                                 "joj3-all-env", |  | ||||||
|                                 "/home/tt/.config/teapot/teapot.env", |  | ||||||
|                                 "--grading-repo-name", |  | ||||||
|                                 "ece280-joj", |  | ||||||
|                                 "--max-total-score", |  | ||||||
|                                 "100" |  | ||||||
|                             ], |  | ||||||
|                             "env": [ |  | ||||||
|                                 "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" |  | ||||||
|                             ], |  | ||||||
|                             "cpuLimit": 0, |  | ||||||
|                             "realCpuLimit": 0, |  | ||||||
|                             "clockLimit": 2, |  | ||||||
|                             "memoryLimit": 128000000, |  | ||||||
|                             "stackLimit": 0, |  | ||||||
|                             "procLimit": 50, |  | ||||||
|                             "cpuRateLimit": 0, |  | ||||||
|                             "cpuSetLimit": "", |  | ||||||
|                             "copyIn": {}, |  | ||||||
|                             "copyInCached": {}, |  | ||||||
|                             "copyInDir": ".", |  | ||||||
|                             "copyOut": [ |  | ||||||
|                                 "stdout", |  | ||||||
|                                 "stderr" |  | ||||||
|                             ], |  | ||||||
|                             "copyOutCached": [], |  | ||||||
|                             "copyOutMax": 0, |  | ||||||
|                             "copyOutDir": "", |  | ||||||
|                             "tty": false, |  | ||||||
|                             "strictMemoryLimit": false, |  | ||||||
|                             "dataSegmentLimit": false, |  | ||||||
|                             "addressSpaceLimit": false |  | ||||||
|                         }, |  | ||||||
|                         "cases": [] |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 "parsers": [ |  | ||||||
|                     { |  | ||||||
|                         "name": "log", |  | ||||||
|                         "with": { |  | ||||||
|                             "msg": "joj3 summary" |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 ] |  | ||||||
|             } |  | ||||||
|         ] |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1 +1,2 @@ | ||||||
| force_skip_health_check_on_test = true | force_skip_health_check_on_test = true | ||||||
|  | force_skip_teapot_on_test = true | ||||||
|  |  | ||||||
|  | @ -110,61 +110,7 @@ | ||||||
|                 ] |                 ] | ||||||
|             } |             } | ||||||
|         ], |         ], | ||||||
|         "poststages": [ |         "preStages": [], | ||||||
|             { |         "postStages": [] | ||||||
|                 "name": "teapot", |  | ||||||
|                 "group": "", |  | ||||||
|                 "executor": { |  | ||||||
|                     "name": "local", |  | ||||||
|                     "with": { |  | ||||||
|                         "default": { |  | ||||||
|                             "args": [ |  | ||||||
|                                 "/usr/local/bin/joint-teapot", |  | ||||||
|                                 "joj3-all-env", |  | ||||||
|                                 "/home/tt/.config/teapot/teapot.env", |  | ||||||
|                                 "--grading-repo-name", |  | ||||||
|                                 "ece280-joj", |  | ||||||
|                                 "--max-total-score", |  | ||||||
|                                 "100" |  | ||||||
|                             ], |  | ||||||
|                             "env": [ |  | ||||||
|                                 "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" |  | ||||||
|                             ], |  | ||||||
|                             "cpuLimit": 0, |  | ||||||
|                             "realCpuLimit": 0, |  | ||||||
|                             "clockLimit": 2, |  | ||||||
|                             "memoryLimit": 128000000, |  | ||||||
|                             "stackLimit": 0, |  | ||||||
|                             "procLimit": 50, |  | ||||||
|                             "cpuRateLimit": 0, |  | ||||||
|                             "cpuSetLimit": "", |  | ||||||
|                             "copyIn": {}, |  | ||||||
|                             "copyInCached": {}, |  | ||||||
|                             "copyInDir": ".", |  | ||||||
|                             "copyOut": [ |  | ||||||
|                                 "stdout", |  | ||||||
|                                 "stderr" |  | ||||||
|                             ], |  | ||||||
|                             "copyOutCached": [], |  | ||||||
|                             "copyOutMax": 0, |  | ||||||
|                             "copyOutDir": "", |  | ||||||
|                             "tty": false, |  | ||||||
|                             "strictMemoryLimit": false, |  | ||||||
|                             "dataSegmentLimit": false, |  | ||||||
|                             "addressSpaceLimit": false |  | ||||||
|                         }, |  | ||||||
|                         "cases": [] |  | ||||||
|                     } |  | ||||||
|                 }, |  | ||||||
|                 "parsers": [ |  | ||||||
|                     { |  | ||||||
|                         "name": "log", |  | ||||||
|                         "with": { |  | ||||||
|                             "msg": "joj3 summary" |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 ] |  | ||||||
|             } |  | ||||||
|         ] |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,5 +1,3 @@ | ||||||
| import pytest |  | ||||||
| 
 |  | ||||||
| from tests.convert_joj1.utils import load_case | from tests.convert_joj1.utils import load_case | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user