Example #1
0
def _main():
    'Command line entry point.'
    allow_destructive = False
    try:
        if os.environ['DESTRUCTIVE_MODE']:
            allow_destructive = True
    except Exception:
        True

    hrdw_json = json.loads(open(sys.argv[1]).read(-1))

    def encode(elt):
        'Encode unicode strings as strings else return the object'
        try:
            return elt.encode('ascii', 'ignore')
        except AttributeError:
            return elt

    hrdw = []
    for info in hrdw_json:
        hrdw.append(tuple(map(encode, info)))

    sys.stderr.write("Available memory before run = %s\n" %
                     HL.get_available_memory())

    mode = 'cpu,memory,storage'
    try:
        mode = sys.argv[2]
    except Exception:
        True

    if 'cpu-burn' in mode:
        cpu_perf(hrdw, 60, True)
    elif 'cpu' in mode:
        cpu_perf(hrdw)

    if 'memory-burn' in mode:
        mem_perf_burn(hrdw, 60)
    elif 'memory' in mode:
        mem_perf(hrdw)

    if 'storage-burn' in mode:
        storage_perf_burn(hrdw, allow_destructive, 30)
    elif 'storage' in mode:
        storage_perf(hrdw, allow_destructive)

    HL.check_mce_status(hrdw)

    # Saving result to stdout but also to a filename based on the hw properties
    output_filename = get_output_filename(hrdw)
    sys.stderr.write("Saving results in %s\n" % output_filename)
    with open(output_filename, 'w') as state_file:
        pprint.pprint(hrdw, stream=state_file)
    print(json.dumps(hrdw))
Example #2
0
def _main():
    'Command line entry point.'
    allow_destructive = False
    try:
        if os.environ['DESTRUCTIVE_MODE']:
            allow_destructive = True
    except Exception:
        True

    hrdw_json = json.loads(open(sys.argv[1]).read(-1))

    def encode(elt):
        'Encode unicode strings as strings else return the object'
        try:
            return elt.encode('ascii', 'ignore')
        except AttributeError:
            return elt

    hrdw = []
    for info in hrdw_json:
        hrdw.append(tuple(map(encode, info)))

    sys.stderr.write("Available memory before run = %s\n" % HL.get_available_memory())

    mode = 'cpu,memory,storage'
    try:
        mode = sys.argv[2]
    except Exception:
        True

    if 'cpu-burn' in mode:
        cpu_perf(hrdw, 60, True)
    elif 'cpu' in mode:
        cpu_perf(hrdw)

    if 'memory-burn' in mode:
        mem_perf_burn(hrdw, 60)
    elif 'memory' in mode:
        mem_perf(hrdw)

    if 'storage-burn' in mode:
        storage_perf_burn(hrdw, allow_destructive, 30)
    elif 'storage' in mode:
        storage_perf(hrdw, allow_destructive)

    HL.check_mce_status(hrdw)

    # Saving result to stdout but also to a filename based on the hw properties
    output_filename = get_output_filename(hrdw)
    sys.stderr.write("Saving results in %s\n" % output_filename)
    with open(output_filename, 'w') as state_file:
        pprint.pprint(hrdw, stream=state_file)
    print(json.dumps(hrdw))
Example #3
0
def _main():
    'Command line entry point.'
    allow_destructive = False
    try:
        if os.environ['DESTRUCTIVE_MODE']:
            allow_destructive = True
    except Exception:
        True

    hrdw = eval(open(sys.argv[1]).read(-1))

    sys.stderr.write("Available memory before run = %s\n" %
                     HL.get_available_memory())

    mode = 'cpu,memory,storage'
    try:
        mode = sys.argv[2]
    except Exception:
        True

    if 'cpu-burn' in mode:
        cpu_perf(hrdw, 60, True)
    elif 'cpu' in mode:
        cpu_perf(hrdw)

    if 'memory-burn' in mode:
        mem_perf_burn(hrdw, 60)
    elif 'memory' in mode:
        mem_perf(hrdw)

    if 'storage-burn' in mode:
        storage_perf_burn(hrdw, allow_destructive, 30)
    elif 'storage' in mode:
        storage_perf(hrdw, allow_destructive)

    HL.check_mce_status(hrdw)

    # Saving result to stdout but also to a filename based on the hw properties
    output_filename = get_output_filename(hrdw)
    sys.stderr.write("Saving results in %s\n" % output_filename)
    with open(output_filename, 'w') as state_file:
        pprint.pprint(hrdw, stream=state_file)
    pprint.pprint(hrdw)
Example #4
0
def _main():
    'Command line entry point.'
    allow_destructive = False
    try:
        if os.environ['DESTRUCTIVE_MODE']:
            allow_destructive = True
    except Exception:
        True

    hrdw = eval(open(sys.argv[1]).read(-1))

    sys.stderr.write("Available memory before run = %s\n" % HL.get_available_memory())

    mode = 'cpu,memory,storage'
    try:
        mode = sys.argv[2]
    except Exception:
        True

    if 'cpu-burn' in mode:
        cpu_perf(hrdw, 60, True)
    elif 'cpu' in mode:
        cpu_perf(hrdw)

    if 'memory-burn' in mode:
        mem_perf_burn(hrdw, 60)
    elif 'memory' in mode:
        mem_perf(hrdw)

    if 'storage-burn' in mode:
        storage_perf_burn(hrdw, allow_destructive, 30)
    elif 'storage' in mode:
        storage_perf(hrdw, allow_destructive)

    HL.check_mce_status(hrdw)

    # Saving result to stdout but also to a filename based on the hw properties
    output_filename = get_output_filename(hrdw)
    sys.stderr.write("Saving results in %s\n" % output_filename)
    with open(output_filename, 'w') as state_file:
        pprint.pprint(hrdw, stream=state_file)
    pprint.pprint(hrdw)
Example #5
0
 def completed(self, module):
     self.message.message = HM.MODULE
     self.message.module = module
     self.message.action = HM.COMPLETED
     HL.check_mce_status(self.message.hw)
     HP.send_hm_message(self.socket, self.message)
Example #6
0
 def completed(self, module):
     self.message.message = HM.MODULE
     self.message.module = module
     self.message.action = HM.COMPLETED
     HL.check_mce_status(self.message.hw)
     HP.send_hm_message(self.socket, self.message)