Skip to content

Commit

Permalink
starting fixing mock step job
Browse files Browse the repository at this point in the history
  • Loading branch information
TShapinsky committed Jan 7, 2025
1 parent 7c4e45d commit 96bc99a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/worker/jobs/step_run_mock_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ def __init__(self, run_id, realtime, timescale, external_clock, start_datetime,
super().__init__()
self.checkout_run(run_id)
StepRunBase.__init__(self, run_id, realtime, timescale, external_clock, start_datetime, end_datetime, skip_site_init=True, skip_stop_db_writes=True)
self.first_step_warmup = True
self.simulation_step_duration = 1
self.run.sim_time = self.start_datetime
self.options.warmup_is_first_step = True
self.options.timestep_duration = timedelta(minutes=1)
self.run.sim_time = self.options.start_datetime

def step(self):
sleep(self.simulation_step_duration)
self.set_run_time(self.run.sim_time + self.time_per_step())

def time_per_step(self) -> timedelta:
return timedelta(seconds=60)

def get_sim_time(self) -> datetime.datetime:
return self.run.sim_time

@message
def set_simulation_step_duration(self, simulation_step_duration):
self.simulation_step_duration = simulation_step_duration
self.options.timestep_duration = timedelta(minutes=simulation_step_duration)

@message
def advance(self):
self.run.sim_time = self.run.sim_time + 1

0 comments on commit 96bc99a

Please sign in to comment.