fix(diff): bugs on diff stdin and numerics #16
|  | @ -6,6 +6,8 @@ DEFAULT_CPU_LIMIT = Time("1s") | |||
| DEFAULT_MEMORY_LIMIT = Memory("256m") | ||||
| DEFAULT_FILE_LIMIT = Memory("32m") | ||||
| DEFAULT_CASE_SCORE = 5 | ||||
| 
					
					jon-lee marked this conversation as resolved
					
						
						
							Outdated
						
					
				 | ||||
| DEFAULT_CLOCK_LIMIT_MULTIPLIER = 2 | ||||
| DEFAULT_PROC_LIMIT = 50 | ||||
| 
 | ||||
| JOJ3_CONFIG_ROOT = Path("/home/tt/.config/joj") | ||||
| TEAPOT_CONFIG_ROOT = Path("/home/tt/.config/teapot") | ||||
|  |  | |||
|  | @ -3,9 +3,11 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union | |||
| from pydantic import BaseModel, ConfigDict, Field, field_validator | ||||
| 
 | ||||
| from joj3_config_generator.models.const import ( | ||||
|     DEFAULT_CLOCK_LIMIT_MULTIPLIER, | ||||
| 
					
					bomingzh marked this conversation as resolved
					
				 
				
					
						张泊明518370910136
						commented  Should be applied to other locations in  Should be applied to other locations in `transformers/task.py` | ||||
|     DEFAULT_CPU_LIMIT, | ||||
|     DEFAULT_FILE_LIMIT, | ||||
|     DEFAULT_MEMORY_LIMIT, | ||||
|     DEFAULT_PROC_LIMIT, | ||||
| ) | ||||
| 
 | ||||
| 
 | ||||
|  | @ -49,10 +51,13 @@ class Cmd(BaseModel): | |||
|     stdout: Union[Collector, StreamOut] = Collector(name="stdout") | ||||
|     stderr: Union[Collector, StreamOut] = Collector(name="stderr") | ||||
|     cpu_limit: int = Field(DEFAULT_CPU_LIMIT, serialization_alias="cpuLimit") | ||||
|     clock_limit: int = Field(2 * DEFAULT_CPU_LIMIT, serialization_alias="clockLimit") | ||||
|     clock_limit: int = Field( | ||||
|         DEFAULT_CLOCK_LIMIT_MULTIPLIER * DEFAULT_CPU_LIMIT, | ||||
|         serialization_alias="clockLimit", | ||||
|     ) | ||||
|     memory_limit: int = Field(DEFAULT_MEMORY_LIMIT, serialization_alias="memoryLimit") | ||||
|     stack_limit: int = Field(0, serialization_alias="stackLimit") | ||||
|     proc_limit: int = Field(50, serialization_alias="procLimit") | ||||
|     proc_limit: int = Field(DEFAULT_PROC_LIMIT, serialization_alias="procLimit") | ||||
|     cpu_rate_limit: int = Field(0, serialization_alias="cpuRateLimit") | ||||
|     cpu_set_limit: str = Field("", serialization_alias="cpuSetLimit") | ||||
|     copy_in: Dict[str, InputFile] = Field({}, serialization_alias="copyIn") | ||||
|  |  | |||
|  | @ -203,11 +203,14 @@ def fix_diff( | |||
|         # duplicate with the fallback case in executor.with_ | ||||
|         if cmd.cpu_limit == const.DEFAULT_CPU_LIMIT: | ||||
| 
					
					bomingzh marked this conversation as resolved
					
						
						
							Outdated
						
					
				 
				
					
						张泊明518370910136
						commented  What if the  What if the `with_.default.cpu_limit` is not the same as `DEFAULT_CPU_LIMIT`? Why do we need to set these fields to none? 
				
					
						李衍志523370910113
						commented  if the  if the `with_.default.cpu_limit` is not the same as `DEFAULT_CPU_LIMIT` it means its already been input before, and it is considered as the new default value for all cases (ta might want to control it). If I dont set these field to none, it will use `DEFAULT_CPU_LIMIT` instead of those ta input, which is not intended.  It solve the second problem in https://focs.ji.sjtu.edu.cn/git/JOJ/JOJ3-config-generator/issues/15 
				
					
						张泊明518370910136
						commented  Which test case will show this problem? Which test case will show this problem? 
				
					
						张泊明518370910136
						commented  We need another pydantic model for auto detected cases. Fields in these cases can be none, which means they are not set and should use  We need another pydantic model for auto detected cases. Fields in these cases can be none, which means they are not set and should use `with_.default` values. | ||||
|             cmd.cpu_limit = None | ||||
|         if cmd.clock_limit == 2 * const.DEFAULT_CPU_LIMIT: | ||||
|         if ( | ||||
|             cmd.clock_limit | ||||
|             == const.DEFAULT_CLOCK_LIMIT_MULTIPLIER * const.DEFAULT_CPU_LIMIT | ||||
|         ): | ||||
|             cmd.clock_limit = None | ||||
|         if cmd.memory_limit == const.DEFAULT_MEMORY_LIMIT: | ||||
|             cmd.memory_limit = None | ||||
|         if cmd.proc_limit == executor.with_.default.proc_limit: | ||||
|         if cmd.proc_limit == const.DEFAULT_PROC_LIMIT: | ||||
|             cmd.proc_limit = None | ||||
|         stage_cases.append(cmd) | ||||
|         parser_case = result.DiffCasesConfig( | ||||
| 
					
					jon-lee marked this conversation as resolved
					
				 
				
					
						张泊明518370910136
						commented  better check if the  better check if the `*.out` file exists in get_testcases 
				
					
						李衍志523370910113
						commented  Not quite understand why would taht better? Not quite understand why would taht better? 
				
					
						张泊明518370910136
						commented  If case*.out will always be used in diff parser, we want to ensure it exists to form a valid case. If case*.out will always be used in diff parser, we want to ensure it exists to form a valid case. 
				
					
						李衍志523370910113
						commented  ok, I see, indeed a good point. ok, I see, indeed a good point. 
				
					
						李衍志523370910113
						commented  done. done. | ||||
|  | @ -229,6 +232,7 @@ def fix_diff( | |||
|             cpu_limit=None, | ||||
|             clock_limit=None, | ||||
|             memory_limit=None, | ||||
|             proc_limit=None, | ||||
|         ) | ||||
|         stage_cases.append(cmd) | ||||
|         parser_case = result.DiffCasesConfig( | ||||
|  |  | |||
why is it removed?
added a field in toml named
diff.default_scoreand this 5 is now directly written numerically here:added back now.
why not
yes, this is the case now, sorry :)
do we need to also create a
DEFAULT_PROC_LIMIT?good idea, maybe we can also have
DEFAULT_CLOCK_LIMIT_MULTIPLIERboth added now.