Ejemplo n.º 1
0
def load_module(agent, modname):
    chron = time.time()
    succeeds = 1
    try:
        # PERSIST:INSTRUMENT
        report_instrumentation_point(agent, PRE_USER_MODULE_LOAD)
        mod = ensure_modpath_installed(Symbol(modname))
        if not mod:
            print "=== COULD NOT INSTALL MODULE %s ===" % modname
            succeeds = 0
        currMod = get_default_module()
        # check for equality here because we are reporting instrumentation points
        if mod is not currMod:
            set_default_module(mod)
            if not ensure_default_module_loaded(agent):
                print "=== COULD NOT LOAD MODULE %s ===" % modname
                succeeds = 0
            # PERSIST:INSTRUMENT
            report_instrumentation_point(agent, POST_USER_MODULE_LOAD)
    except SPARKException:
        errid = NEWPM.displayError()
    chron = time.time() - chron
    print "Total Loading Time: %3.4f seconds." % chron
    # -*-*-*-*-*-* This is a hack to remove the logs from the console. A better solution is needed later.
    from spark.util.logger import get_sdl

    get_sdl().log("Default Module: %s", modname)
    return succeeds
Ejemplo n.º 2
0
def load_module(agent, modname):
    chron = time.time()
    succeeds = 1
    try:
        #PERSIST:INSTRUMENT        
        report_instrumentation_point(agent, PRE_USER_MODULE_LOAD)
        mod = ensure_modpath_installed(Symbol(modname))
        if not mod:
            print "=== COULD NOT INSTALL MODULE %s ==="%modname
            succeeds = 0
        currMod = get_default_module()
        #check for equality here because we are reporting instrumentation points
        if mod is not currMod:
            set_default_module(mod) 
            if not ensure_default_module_loaded(agent):
                print "=== COULD NOT LOAD MODULE %s ==="%modname
                succeeds = 0
            #PERSIST:INSTRUMENT        
            report_instrumentation_point(agent, POST_USER_MODULE_LOAD)
    except SPARKException:
        errid = NEWPM.displayError()
    chron = time.time() - chron
    print "Total Loading Time: %3.4f seconds."%chron
    #-*-*-*-*-*-* This is a hack to remove the logs from the console. A better solution is needed later.
    from spark.util.logger import get_sdl
    get_sdl().log("Default Module: %s", modname)
    return succeeds
Ejemplo n.º 3
0
def user_directed_persist(agent):
    #PERSIST:INSTRUMENT
    report_instrumentation_point(agent, USER_PERSIST_COMMAND)    
Ejemplo n.º 4
0
def user_directed_persist(agent):
    # PERSIST:INSTRUMENT
    report_instrumentation_point(agent, USER_PERSIST_COMMAND)