diff --git a/swf2batsim_split_by_user.py b/swf2batsim_split_by_user.py index 1f44e9ae3a645a1cbbfc86ee3f424bb2a5bd5ff5..399499aa703044e61d6214358d271d9ff5e785ab 100755 --- a/swf2batsim_split_by_user.py +++ b/swf2batsim_split_by_user.py @@ -11,6 +11,7 @@ import re import sys import datetime import os +from math import ceil from swf import SwfField @@ -80,7 +81,7 @@ def generate_workload(input_swf, output_folder, if user_id not in users: users[user_id] = [] - profile = int(((run_time // job_grain) + 1) * job_grain) + profile = int(ceil(run_time / job_grain) * job_grain) job = (job_id, nb_res, run_time, submit_time, profile, walltime) @@ -169,17 +170,18 @@ def main(): action="store_true", help="If set, only the given walltime in the trace " "will be used") - parser.add_argument('-jg', '--job_grain', - type=int, default=1, - help="Selects the level of detail we want for jobs. " - "This parameter is used to group jobs that have " - "close running time") - parser.add_argument('-i', '--indent', type=int, default=None, - help="If set to a non-negative integer, then JSON array " - "elements and object members will be pretty-printed " - "with that indent level. An indent level of 0, or " - "negative, will only insert newlines. The default " - "value (None) selects the most compact representation.") + parser.add_argument( + '-jg', '--job_grain', type=int, default=1, + help="Selects the level of detail we want for job profiles. " + "This parameter is used to group jobs that have close running times. " + "For example: a job grain of 10 will round up running times to the next ten.") + parser.add_argument( + '-i', '--indent', type=int, default=None, + help="If set to a non-negative integer, then JSON array " + "elements and object members will be pretty-printed " + "with that indent level. An indent level of 0, or " + "negative, will only insert newlines. The default " + "value (None) selects the most compact representation.") parser.add_argument("-q", "--quiet", action="store_true")