Commit 64a90f8e authored by Hines, Jesse's avatar Hines, Jesse
Browse files

Shift telemetry_start back to match sim_config.start

With the current dataloaders, WorkloadData.start_date can end up being
after sim_config.start. Most of the dataloaders set timestep_start and
start_date to whatever the first job in the dataset is. This issue is
most apparent when the dataloader does any filtering based on start/end
so start_date will be whichever job started in the interval.

Eventually I think we should refactor the dataloaders to return absolute
unix timestamps to avoid all these relative vs non-relative timestep
complications. But for now I'm just going to shift the telemetry_start
back to match the sim_config.start if needed. This does mean that
telemetry_start can now be a negative value, but that should work fine.
parent a017cac6
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -200,11 +200,9 @@ class Engine:
        if sim_config.start:
            start = sim_config.start
            diff = start - wd.start_date
            if diff.total_seconds() < 0:
                raise Exception(
                    f"{start.isoformat()} is before data range in workload. "
                    + f"Workload data begins at {wd.start_date.isoformat()}"
                )
            # diff may be negative if start is before the first job in the workload. We'll still
            # shift telemetry_start to match with sim_config.start, even if that leaves a blank
            # spot at the beginning.
            wd.telemetry_start += int(diff.total_seconds())
            wd.start_date = start
        else: