@@ -84,7 +84,7 @@ def run(
84
84
# Let's reset the scenario (empty timetable) so we can keep a
85
85
# manageable/reproducible state.
86
86
if seed % scenario_ttl == 0 :
87
- scenario = _reset_scenario (editoast_url , scenario )
87
+ scenario = _reset_timetable (editoast_url , scenario )
88
88
prelude = []
89
89
90
90
@@ -110,35 +110,10 @@ def get_infra(editoast_url: str, infra_name: str) -> int:
110
110
111
111
112
112
def create_scenario (editoast_url : str , infra_id : int ) -> Scenario :
113
- # Create the project
114
- project_payload = {"name" : "fuzzer_project" }
115
- r = _post_with_timeout (editoast_url + "projects/" , json = project_payload )
116
- r .raise_for_status ()
117
- project_id = r .json ()["id" ]
118
- project_url = f"projects/{ project_id } "
119
-
120
- # Create the study
121
- study_payload = {"name" : "fuzzer_study" , "state" : "Starting" }
122
- r = _post_with_timeout (editoast_url + f"{ project_url } /studies/" , json = study_payload )
123
- r .raise_for_status ()
124
- study_id = r .json ()["id" ]
125
- study_url = f"{ project_url } /studies/{ study_id } "
126
-
127
113
# Create the timetable
128
114
r = _post_with_timeout (editoast_url + "v2/timetable/" , json = {})
129
115
timetable_id = r .json ()["id" ]
130
-
131
- # Create the scenario
132
- scenario_payload = {
133
- "name" : "fuzzer_scenario" ,
134
- "infra_id" : infra_id ,
135
- "timetable_id" : timetable_id ,
136
- }
137
- r = _post_with_timeout (editoast_url + f"v2/{ study_url } /scenarios/" , json = scenario_payload )
138
- r .raise_for_status ()
139
- timetable_id = r .json ()["timetable_id" ]
140
- id = r .json ()["id" ]
141
- return Scenario (project_id , study_id , id , infra_id , timetable_id )
116
+ return Scenario (- 1 , - 1 , - 1 , infra_id , timetable_id )
142
117
143
118
144
119
class _FailedTest (Exception ):
@@ -486,35 +461,16 @@ def _convert_stop(stop: Tuple[str, float], i: int) -> Dict:
486
461
return {"offset" : _to_mm (offset ), "track" : track_section , "id" : str (i )}
487
462
488
463
489
- def _reset_scenario (editoast_url : str , scenario : Scenario ) -> Scenario :
490
- """Deletes the current scenario and creates a new one."""
491
- print ("scenario reset" )
492
- project_id , study_id , infra_id = scenario .project , scenario .op_study , scenario .infra
493
-
494
- # Delete the current scenario
495
- study_url = f"v2/projects/{ project_id } /studies/{ study_id } "
496
- r = _delete_with_timeout (editoast_url + study_url + f"/scenarios/{ scenario .scenario } " )
497
- r .raise_for_status ()
498
-
464
+ def _reset_timetable (editoast_url : str , scenario : Scenario ) -> Scenario :
465
+ """Deletes the current timetable and creates a new one."""
499
466
# Delete the current timetable
500
467
r = _delete_with_timeout (editoast_url + f"/v2/timetable/{ scenario .timetable } /" )
501
468
r .raise_for_status ()
502
469
503
470
# Create a timetable
504
471
r = _post_with_timeout (editoast_url + "v2/timetable/" , json = {})
505
472
timetable_id = r .json ()["id" ]
506
-
507
- # Create a new scenario
508
- new_scenario_payload = {
509
- "name" : "fuzzer_scenario" ,
510
- "infra_id" : infra_id ,
511
- "timetable_id" : timetable_id ,
512
- }
513
- r = _post_with_timeout (editoast_url + f"{ study_url } /scenarios/" , json = new_scenario_payload )
514
- r .raise_for_status ()
515
- new_timetable_id = r .json ()["timetable_id" ]
516
- new_id = r .json ()["id" ]
517
- return Scenario (project_id , study_id , new_id , infra_id , new_timetable_id )
473
+ return Scenario (- 1 , - 1 , - 1 , infra_id , timetable_id )
518
474
519
475
520
476
def _make_random_margin_value () -> str :
0 commit comments