コード例 #1
0
ファイル: main.py プロジェクト: TillArndt/CmsToolsAC3b
def standalone(post_proc_tool_classes, **settings_kws):
    """
    Runs post processing alone.

    :param post_proc_tool_classes:  list of ``PostProcTool`` subclasses.
    :param  settings_kws:           settings parameters given as keyword
                                    arguments are added to settings, e.g.
                                    ``samples={"mc":MCSample, ...}`` .
    """
    _process_settings_kws(settings_kws)
    _instanciate_samples()
    settings.create_folders()

    pst = postprocessing.PostProcChain(False)
    for tool in post_proc_tool_classes:
        pst.add_tool(tool())
    settings.create_folders()
    pst.run()
コード例 #2
0
def standalone(post_proc_tool_classes, **settings_kws):
    """
    Runs post processing alone.

    :param post_proc_tool_classes:  list of ``PostProcTool`` subclasses.
    :param  settings_kws:           settings parameters given as keyword
                                    arguments are added to settings, e.g.
                                    ``samples={"mc":MCSample, ...}`` .
    """
    _process_settings_kws(settings_kws)
    _instanciate_samples()
    settings.create_folders()

    pst = postprocessing.PostProcChain(False)
    for tool in post_proc_tool_classes:
        pst.add_tool(tool())
    settings.create_folders()
    pst.run()
コード例 #3
0
ファイル: main.py プロジェクト: TillArndt/CmsToolsAC3b
def main(**settings_kws):
    """
    Processing and post processing.

    :param  settings_kws:           settings parameters given as keyword
                                    arguments are added to settings, e.g.
                                    ``samples={"mc":MCSample, ...}`` .
    """
    # prepare...
    main_args.update(settings_kws)
    _process_settings_kws(settings_kws)
    _instanciate_samples()

    # tweaks in working directory?
    tweak_name = settings.tweak
    if os.path.exists(tweak_name):
        print ("WARNING I found "
               + tweak_name
               + " and I am going to dump it first and then import it!")
        with open(tweak_name, 'r') as f: print f.read()
        import imp
        settings.tweak = imp.load_source(tweak_name[:-3], tweak_name)

    # create folders (for process confs, etc.)
    settings.create_folders()

    # controller
    controller.setup_processes()
    executed_procs = list(p for p in controller.waiting_pros if not p.will_reuse_data)

    # post processor
    pst = postprocessing.PostProcChain()
    pst._reuse = settings.enable_postproc_reuse and not bool(executed_procs)

    settings.postprocessor = pst
    controller.all_finished.connect(pst.run)
    pst.add_tools(settings.post_proc_tools)

    # create folders (for plottools)
    settings.create_folders()

    # connect for quiting
    # (all other finishing connections before this one)
    controller.all_finished.connect(exec_quit)

    # GO!
    if executed_procs:                          # Got jobs to execute?
        if (settings.not_ask_execute
            or settings.suppress_cmsRun_exec
            or raw_input(
                "Really run these processes:\n   "
                + ",\n   ".join(map(str,executed_procs))
                + "\n?? (type 'yes') "
            ) == "yes"):
            if ipython_mode: ipython_usage()
            controller.start_processes()
            return exec_start()
        else:
            print "INFO: Answer was not yes. Starting post-processing..."
            pst.run()
    elif settings.post_proc_tools:              # No jobs, but post-proc..
        pst.run()
    else:                                       # Nothing to do.
        print "I've got nothing to do!"
コード例 #4
0
def main(**settings_kws):
    """
    Processing and post processing.

    :param  settings_kws:           settings parameters given as keyword
                                    arguments are added to settings, e.g.
                                    ``samples={"mc":MCSample, ...}`` .
    """
    # prepare...
    main_args.update(settings_kws)
    _process_settings_kws(settings_kws)
    _instanciate_samples()

    # tweaks in working directory?
    tweak_name = settings.tweak
    if os.path.exists(tweak_name):
        print("WARNING I found " + tweak_name +
              " and I am going to dump it first and then import it!")
        with open(tweak_name, 'r') as f:
            print f.read()
        import imp
        settings.tweak = imp.load_source(tweak_name[:-3], tweak_name)

    # create folders (for process confs, etc.)
    settings.create_folders()

    # controller
    controller.setup_processes()
    executed_procs = list(p for p in controller.waiting_pros
                          if not p.will_reuse_data)

    # post processor
    pst = postprocessing.PostProcChain()
    pst._reuse = settings.enable_postproc_reuse and not bool(executed_procs)

    settings.postprocessor = pst
    controller.all_finished.connect(pst.run)
    pst.add_tools(settings.post_proc_tools)

    # create folders (for plottools)
    settings.create_folders()

    # connect for quiting
    # (all other finishing connections before this one)
    controller.all_finished.connect(exec_quit)

    # GO!
    if executed_procs:  # Got jobs to execute?
        if (settings.not_ask_execute or settings.suppress_cmsRun_exec
                or raw_input("Really run these processes:\n   " +
                             ",\n   ".join(map(str, executed_procs)) +
                             "\n?? (type 'yes') ") == "yes"):
            if ipython_mode: ipython_usage()
            controller.start_processes()
            return exec_start()
        else:
            print "INFO: Answer was not yes. Starting post-processing..."
            pst.run()
    elif settings.post_proc_tools:  # No jobs, but post-proc..
        pst.run()
    else:  # Nothing to do.
        print "I've got nothing to do!"