示例#1
0
def delay(wl, t):
    """ Returns estimated delay (run time) for the test with parameter t.
    In seconds """
    opc = workloads.data['operationcount']
    # redefine operation count if the workload hath
    workload = get_workload(wl)
    if 'properties' in workload:
        if 'operationcount' in workload['properties']:
            opc = long(workload['properties']['operationcount'])
    t = opc if t is None else t
    d = int((opc / t) * 1.1)
    return timedelta(seconds = d)
示例#2
0
def delay(wl, t):
    """ Returns estimated delay (run time) for the test with parameter t.
    In seconds """
    opc = workloads.data['operationcount']
    # redefine operation count if the workload hath
    workload = get_workload(wl)
    if 'properties' in workload:
        if 'operationcount' in workload['properties']:
            opc = long(workload['properties']['operationcount'])
    t = opc if t is None else t
    d = int((opc / t) * 1.1)
    return timedelta(seconds=d)
示例#3
0
文件: ycsb.py 项目: EnigmaCurry/YCSB
def run_workload(db, workload, target=None):
    """Starts running of the workload"""
    timestamp = base_time()
    print green(timestamp, bold = True)
    database = get_db(db)
    load = get_workload(workload)
    with cd(database['home']):
        if target is not None:
            part = int(target) / len(env.roledefs['client'])
            run(_at(_ycsbruncmd(database, load, timestamp, part), timestamp))
        else:
            run(_at(_ycsbruncmd(database, load, timestamp), timestamp))
示例#4
0
文件: ycsb.py 项目: yife/ycsb
def run_workload(db, workload, target=None):
    """Starts running of the workload"""
    timestamp = base_time()
    print green(timestamp, bold=True)
    database = get_db(db)
    load = get_workload(workload)
    with cd(database['home']):
        if target is not None:
            part = int(target) / len(env.roledefs['client'])
            run(_at(_ycsbruncmd(database, load, timestamp, part), timestamp))
        else:
            run(_at(_ycsbruncmd(database, load, timestamp), timestamp))
示例#5
0
 def delay_after(self):
     """ Returns estimated delay (run time) for the test with parameter t.
     In seconds """
     opc = workloads.data['operationcount']
     # redefine operation count if the workload hath
     workload = get_workload(self.wl)
     if 'properties' in workload:
         if 'operationcount' in workload['properties']:
             opc = long(workload['properties']['operationcount'])
     t = opc if self.thr is None else self.thr
     d = int((opc / t) * 1.1)
     the_time = self.time + timedelta(seconds=d)
     the_time = base_time(the_time, tz=self.tz)  # round the time up
     return the_time - self.time
示例#6
0
 def delay_after(self):
     """ Returns estimated delay (run time) for the test with parameter t.
     In seconds """
     opc = workloads.data['operationcount']
     # redefine operation count if the workload hath
     workload = get_workload(self.wl)
     if 'properties' in workload:
         if 'operationcount' in workload['properties']:
             opc = long(workload['properties']['operationcount'])
     t = opc if self.thr is None else self.thr
     d = int((opc / t) * 1.1)
     the_time = self.time + timedelta(seconds = d)
     the_time = base_time(the_time, tz = self.tz) # round the time up
     return the_time - self.time
示例#7
0
def submit_workload(the_hosts, dir_name, db, workload, the_time, target = None):
    """
    Schedules the workload.
    Note: we cannot use ycsb.workload, because it is decorated
    """
    database = get_db(db)
    load = get_workload(workload)
    def inner_submit_workload():
        with cd(dir_name):
            param = int(target) / len(the_hosts) if target is not None else None
            # command = prepare_ycsbruncmd(database, load, the_time, param)
            command = _at(prepare_ycsbruncmd(the_hosts, dir_name, database, load, the_time, param), the_time)
            run(command)

    with almost_nothing():
        tasks.execute(inner_submit_workload, hosts=the_hosts)
示例#8
0
def submit_workload(the_hosts, dir_name, db, workload, the_time, target=None):
    """
    Schedules the workload.
    Note: we cannot use ycsb.workload, because it is decorated
    """
    database = get_db(db)
    load = get_workload(workload)

    def inner_submit_workload():
        with cd(dir_name):
            param = int(target) / len(
                the_hosts) if target is not None else None
            # command = prepare_ycsbruncmd(database, load, the_time, param)
            command = _at(
                prepare_ycsbruncmd(the_hosts, dir_name, database, load,
                                   the_time, param), the_time)
            run(command)

    with almost_nothing():
        tasks.execute(inner_submit_workload, hosts=the_hosts)