Skip to content

Commit

Permalink
Slight test tweak for DT_FACTOR
Browse files Browse the repository at this point in the history
  • Loading branch information
dvalters committed Sep 24, 2024
1 parent 1fac853 commit 7d920ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion test/test_sacc2events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
Unit tests for sacc2eventsfile.py
"""
import re
import pytest
from utils.sacc2eventsfile import (convert_sacc_to_workload_row,
_get_dtime, _get_account)
_get_dtime, _get_account, DT_FACTOR)

@pytest.mark.skipif(DT_FACTOR != 1, reason="Skip if DT_FACTOR != 1")
def test_convert_sacc_to_workload():
"""Test"""

Expand Down Expand Up @@ -33,6 +35,7 @@ def test_convert_sacc_to_workload():
# Assert
#assert result == output_row


def test_get_dtime_first():
"""Return the start time since simulator start for the
job submission"""
Expand All @@ -43,6 +46,7 @@ def test_get_dtime_first():
assert dtime == 0


@pytest.mark.skipif(DT_FACTOR != 1, reason="Skip if DT_FACTOR set other than 1")
def test_get_dtime_later():
"""Return the start time since simulator start for the
job submission"""
Expand Down
9 changes: 8 additions & 1 deletion utils/sacc2eventsfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

UID_PREFIX = "user"
UID_RANGE = 5
# dt time in slurm sim can be too long if measured in seconds on real
# accounting data.
# Use this factor to divide through
DT_FACTOR = 1


def convert_sacc_to_workload_row(row: dict, first_submit_time: int) -> str:
Expand All @@ -38,7 +42,10 @@ def convert_sacc_to_workload_row(row: dict, first_submit_time: int) -> str:

def _get_dtime(submit_time, first_submit_time) -> int:
dtime = int(submit_time) - int(first_submit_time)
return dtime
if DT_FACTOR > 1:
return dtime/DT_FACTOR
else:
return dtime

def _get_sim_walltime(elapse: int):
return int(elapse)/60
Expand Down

0 comments on commit 7d920ac

Please sign in to comment.