Exemplo n.º 1
0
def mkRO(dataset="", astrotype="", args=None, reuseRO=False):
    
    global reductionObject, adccpid
    
    if reductionObject == None or reuseRO == False:
        adccpid = Proxies.start_adcc()
        reduceServer = Proxies.ReduceServer()
        # Playing with module, should use access function
        ReductionObjects.prs = Proxies.PRSProxy.get_adcc(reduce_server=reduceServer)
        
        rl = RecipeLibrary()
        if dataset != "":
            ad = AstroData(dataset)
            ro = rl.retrieve_reduction_object(ad)
        elif astrotype != "":
            ad = None
            ro = rl.retrieve_reduction_object(astrotype = astrotype)

        # using standard command clause supplied in RecipeLibrary module
        ro.register_command_clause(command_clause)
        rc = ReductionContext()
        rc.ro = ro
        # rc.stackFile =  File("stackIndexFile", stkindfile)
        #if args:
        #    rc.add_input(ad)
        
        reductionObject = ro
    
    if reuseRO == True:
        ro = reductionObject
        rc = ro.context

    #if args:
    #    rc.addInputs(args)
    rc.update(argv)
    ro.init(rc)
    
    return reductionObject
Exemplo n.º 2
0
        log.fullinfo("."*len(opener))
        sys.stdout.flush()

    # ------------------------------------------------------------------------ #
    #                                START ADCC
    # ------------------------------------------------------------------------ #
    # Start adcc always, since it wants the reduceServer. Prefer not to provide 
    # to every component that wants to use the adcc as an active-library

    pradcc = datetime.now()
    if (_show_times):
        print "from start to start_adcc: %s" % (pradcc - start_time) 
    
    pprox = Proxies.PRSProxy.get_adcc(check_once=True)
    if not pprox:
        adccpid = Proxies.start_adcc()
    
    afadcc = datetime.now()
    if (_show_times):
        print "time to execute start_adcc: \t%s" % (afadcc - pradcc)
    
    # launch xmlrpc interface for control and communication
    reduceServer = Proxies.ReduceServer()
    prs = Proxies.PRSProxy.get_adcc(reduce_server=reduceServer)
    usePRS = True

    # called once per substep (every yeild in any primitive when struck)
    # registered with the reduction object
    # !!!! we import this from ReductionObjects.py now
    from astrodata.ReductionObjects import command_clause