Exemple #1
0
def submit_jobs(output_directory, tag, samples, events_total,
                events_per_output, tarfile):
    # Long loop to monitor jobs and resubmit failed jobs
    for i in range(10000):
        total_summary = {}

        # Loop through samples
        for sample in samples:
            config_info = samples_config[sample]

            executable = create_executable(tag, sample, config_info)

            task = CondorTask(sample=DummySample(
                N=int(float(events_total) / float(events_per_output)),
                nevents=events_total,
                dataset="/" + sample + "_NANO"),
                              tag=tag,
                              special_dir=output_directory,
                              events_per_output=events_per_output,
                              total_nevents=events_total,
                              split_within_files=True,
                              executable=executable,
                              open_dataset=False,
                              tarfile=tarfile,
                              condor_submit_params=CONDOR_SUBMIT_PARAMS)

            task.process()
            total_summary[
                task.get_sample().get_datasetname()] = task.get_task_summary()

        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/Hgg-MC-Production/").do()

        time.sleep(300)  # power nap
Exemple #2
0
def submit(which):
    total_summary = {}

    extra_requirements = "true"

    tag = "v0_noFilter"
    pdname = "HVNoFilter"
    events_per_point = int(1E4)
    events_per_job = int(100)
    cfgsDir = "psets_gensim_noFilter/"
    modelsFile = cfgsDir + "/models.txt"
    df = pd.read_csv(modelsFile)
    for year in ["2016", "2017", "2018"]:
        for iterr, row in df.iterrows():

            # fmass = float(mass)
            # mass = str(mass).replace(".","p")

            epp = int(events_per_point)

            reqname = "noFilter_m{}{}_ctau{}_xi_{}_{}_{}".format(
                row.portal, row.mass, row.ctau, row.xi, tag, year)
            njobs = epp // events_per_job
            sample = DummySample(
                dataset="/{}/params_{}_m_{}_ctau_{}mm_xi_{}_{}/LLPNTUPLE".
                format(pdname, row.portal, row.mass, row.ctau * 10, row.xi,
                       year),
                N=njobs,
                nevents=epp)
            task = CondorTask(
                sample=sample,
                output_name="output.root",
                executable="executables/condor_executable_{}.sh".format(which),
                tarfile="package_{}.tar.xz".format(year),
                open_dataset=True,
                files_per_output=1,
                condor_submit_params={
                    "classads": [
                        ["param_mass", row.mass],
                        ["param_ctau", row.ctau],
                        ["param_xi", str(row.xi).replace(".", "p")],
                        ["param_portal", row.portal],
                        ["param_year", year],
                        ["param_nevents", events_per_job],
                        ["metis_extraargs", ""],
                        ["JobBatchName", reqname],
                    ],
                    "requirements_line":
                    'Requirements = ((HAS_SINGULARITY=?=True) && (HAS_CVMFS_cms_cern_ch =?= true) && {extra_requirements})'
                    .format(extra_requirements=extra_requirements),
                },
                tag=tag,
                recopy_inputs=True)
            task.process()
            total_summary[
                task.get_sample().get_datasetname()] = task.get_task_summary()

    StatsParser(data=total_summary,
                webdir="~/public_html/dump/metis_test/").do()
Exemple #3
0
def submit():

    requests = {
        #'TTWJetsToLNuEWK_5f_NLO':       '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_NLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball_retired.tar.xz', # that's the SM point, but using the SMEFT model. No lepton filtering, so name is actually confusing
        #'TTWJetsToLNuEWK_5f_NLO_v2':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_NLO_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz', # that's the actual SM
        #'TTWplusJetsToLNuEWK_5f_NLO_v2':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWplusJetsToLNuEWK_5f_NLO_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz', # that's the actual SM
        #'TTWminusJetsToLNuEWK_5f_NLO_v2':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWminusJetsToLNuEWK_5f_NLO_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz', # that's the actual SM
        #'TTWJetsToLNuEWK_5f_EFT_myNLO_full':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_cpt8_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz', # one of the BSM points
        #'TTWJetsToLNuEWK_5f_EFT_mix_myNLO_full':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz',  # EFT mix
        'TTWJetsToLNuEWK_5f_EFT_cpq3_4_myNLO_full':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks//TTWJetsToLNuEWK_5f_EFT_myNLO_cpq3_4_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz',  # C_pq3 = 4
    }

    total_summary = {}

    extra_requirements = "true"

    tag = "v4"
    events_per_point = 500000 # produced 500k events before
    events_per_job = 2000 # up to 2000 works
    #events_per_point = 50
    #events_per_job = 10
    njobs = int(events_per_point)//events_per_job

    for reqname in requests:
        gridpack = requests[reqname]

        #reqname = "TTWJetsToLNuEWK_5f_EFT_myNLO"
        #gridpack = '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz'

        task = CondorTask(
                sample = DummySample(dataset="/%s/RunIIAutumn18/NANO"%reqname,N=njobs,nevents=int(events_per_point)),
                output_name = "nanoAOD.root",
                executable = "executables/condor_executable_Autumn18.sh",
                tarfile = "package.tar.gz",
                #scram_arch = "slc7_amd64_gcc630",
                open_dataset = False,
                files_per_output = 1,
                arguments = gridpack,
                condor_submit_params = {
                    "sites":"T2_US_UCSD", # 
                    "classads": [
                        ["param_nevents",events_per_job],
                        ["metis_extraargs",""],
                        ["JobBatchName",reqname],
                        #["SingularityImage", "/cvmfs/singularity.opensciencegrid.org/cmssw/cms:rhel6-m202006"],
                        ],
                    "requirements_line": 'Requirements = (HAS_SINGULARITY=?=True)'  # && (HAS_CVMFS_cms_cern_ch =?= true) && {extra_requirements})'.format(extra_requirements=extra_requirements),
                    },
                tag = tag,
                min_completion_fraction = 0.90,
                )

        task.process()
        total_summary[task.get_sample().get_datasetname()] = task.get_task_summary()

        StatsParser(data=total_summary, webdir="~/public_html/dump/tW_gen/").do()
Exemple #4
0
def submit():

    requests = {
        'TTWJetsToLNuEWK_5f_EFT_myNLO': '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz', # that's EFT
        'TTWJetsToLNuEWK_5f_EFT_myNLO_cpt8': '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_cpt8_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz', # that's EFT
        'TTWJetsToLNuEWK_5f_NLO':       '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_NLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz', # that's the SM
    }

    total_summary = {}

    extra_requirements = "true"

    tag = "v1"
    events_per_point = 500000
    events_per_job = 10000
    #events_per_point = 500
    #events_per_job = 100
    njobs = int(events_per_point)//events_per_job

    for reqname in requests:
        gridpack = requests[reqname]

        #reqname = "TTWJetsToLNuEWK_5f_EFT_myNLO"
        #gridpack = '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz'

        task = CondorTask(
                sample = DummySample(dataset="/%s/RunIIAutumn18/NANOGEN"%reqname,N=njobs,nevents=int(events_per_point)),
                output_name = "output.root",
                executable = "executables/condor_executable.sh",
                tarfile = "package.tar.gz",
                open_dataset = False,
                files_per_output = 1,
                arguments = gridpack,
                condor_submit_params = {
                    "sites":"T2_US_UCSD", # 
                    "classads": [
                        ["param_nevents",events_per_job],
                        ["metis_extraargs",""],
                        ["JobBatchName",reqname],
                        ],
                    "requirements_line": 'Requirements = ((HAS_SINGULARITY=?=True) && (HAS_CVMFS_cms_cern_ch =?= true) && {extra_requirements})'.format(extra_requirements=extra_requirements),
                    },
                tag = tag,
                )

        task.process()
        total_summary[task.get_sample().get_datasetname()] = task.get_task_summary()

        StatsParser(data=total_summary, webdir="~/public_html/dump/tW_gen/").do()
Exemple #5
0
def test1():
    dataset_names = [
        # "/TT_TuneCUETP8M2T4_13TeV-powheg-pythia8/RunIISummer17MiniAOD-92X_upgrade2017_realistic_v10_ext1-v1/MINIAODSIM",
        "/Dummy_test_StopBabyMaker_v25/CMS4",
    ]
    basedir = "/hadoop/cms/store/user/{0}/metis_test/example/".format(
        os.getenv("USER"))

    for i in range(10000):

        total_summary = {}
        for dsname in dataset_names:

            try:
                task = CondorTask(
                    sample=DirectorySample(
                        location=basedir,
                        dataset=dsname,
                    ),
                    files_per_output=1,
                    output_name="merged_ntuple.root",
                    tag="v25",
                    scram_arch="slc6_amd64_gcc700",
                    executable="condor_executable.sh",
                    arguments="testarg1",
                    tarfile="input.tar.gz",
                    condor_submit_params={"sites": "UAF,T2_US_UCSD,UCSB"},
                    no_load_from_backup=
                    True,  # for the purpose of the example, don't use a backup
                )

                task.process()
            except:
                traceback_string = traceback.format_exc()
                print("Runtime error:\n{0}".format(traceback_string))
                # send_email(subject="metis error", body=traceback_string)

            total_summary[dsname] = task.get_task_summary()

        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/metis/").do()

        time.sleep(5)
Exemple #6
0
def submit(which):
    total_summary = {}

    tag = "ZMuMuSkim_v0"
    task = CMSSWTask(
            sample = DBSSample(dataset="/SingleMuon/Run2017F-ZMu-17Nov2017-v1/RAW-RECO"),
            events_per_output = 10000,
            pset = "/home/users/mcitron/CMSSW_9_4_17/src/cms_lpc_llp/llp_ntupler/python/displacedJetMuon_ntupler_Data_2017_RAWRECO.py",
            cmssw_version = "CMSSW_9_4_17",
            scram_arch = "slc6_amd64_gcc700",
            tag = tag,
            # dont_check_tree = True,
            executable = "/home/users/mcitron/exeForMetis/condor_genprod_exe.sh",
            condor_submit_params = {
                "container": "/cvmfs/singularity.opensciencegrid.org/cmssw/cms:rhel6-m202006",
                },
            recopy_inputs=True
            )
    task.process()
    total_summary[task.get_sample().get_datasetname()] = task.get_task_summary()

    StatsParser(data=total_summary, webdir="~/public_html/dump/metis_test/").do()
Exemple #7
0
            merge_task.reset_io_mapping()
            merge_task.update_mapping()
            merge_task.process()

        # save some information for the dashboard
        total_summary[maker_task.get_sample().get_datasetname(
        )] = maker_task.get_task_summary()
        total_summary[merge_task.get_sample().get_datasetname(
        )] = merge_task.get_task_summary()

        # Aggregate whether all tasks are complete
        all_tasks_complete = all_tasks_complete and maker_task.complete(
        ) and merge_task.complete()

    # parse the total summary and write out the dashboard
    StatsParser(data=total_summary, webdir=metis_dashboard_path).do()

    # Print msummary table so I don't have to load up website
    os.system("msummary -s name -r | tee summary.txt")
    os.system("chmod -R 755 {}".format(metis_dashboard_path))

    # If all done exit the loop
    if all_tasks_complete:
        print ""
        print "Job={} finished".format(job_tag)
        print ""
        break

    # Neat trick to not exit the script for force updating
    print 'Press Ctrl-C to force update, otherwise will sleep for 300 seconds'
    try:
Exemple #8
0
def submit_metis(job_tag, samples_map, sample_list=[], arguments_map="", exec_script="metis.sh", tar_files=[], hadoop_dirname="testjobs", files_per_output=1, globber="*.root", sites="T2_US_UCSD"):

    import time
    import json
    import metis

    from time import sleep

    from metis.Sample import DirectorySample
    from metis.CondorTask import CondorTask

    from metis.StatsParser import StatsParser

    import os
    import glob
    import subprocess


    # file/dir paths
    main_dir             = os.getcwd()
    metis_path           = os.path.dirname(os.path.dirname(metis.__file__))
    tar_path             = os.path.join(metis_path, "package.tar")
    tar_gz_path          = tar_path + ".gz"
    metis_dashboard_path = os.path.join(metis_path, "dashboard")
    exec_path            = os.path.join(main_dir, exec_script)
    hadoop_path          = "metis/{}/{}".format(hadoop_dirname, job_tag) # The output goes to /hadoop/cms/store/user/$USER/"hadoop_path"

    # Create tarball
    os.chdir(main_dir)
    print os.getcwd()
    print "tar -chzf {} {}".format(tar_gz_path, " ".join(tar_files))
    os.system("tar -chzf {} {}".format(tar_gz_path, " ".join(tar_files)))

    # Change directory to metis
    os.chdir(metis_path)

    total_summary = {}

    # if no sample_list is provided then we form it via the keys of the samples_map
    if len(sample_list) == 0:
        for key in samples_map:
            sample_list.append(key)

    samples_to_run = []
    for key in sample_list:
        samples_to_run.append(
                DirectorySample(
                    dataset=key,
                    location=samples_map[key],
                    globber=globber,
                    )
                )

    files_per_output_config_list = []
    if isinstance(files_per_output, dict):
        for key in sample_list:
            files_per_output_config_list.append(files_per_output[key])
    else:
        for key in sample_list:
            files_per_output_config_list.append(files_per_output)

    # Loop over datasets to submit
    while True:

        all_tasks_complete = True

        #for sample in sorted(samples):
        for index, sample in enumerate(samples_to_run):

            # define the task
            maker_task = CondorTask(
                    sample               = sample,
                    tag                  = job_tag,
                    arguments            = arguments_map[sample.get_datasetname()] if arguments_map else "",
                    executable           = exec_path,
                    tarfile              = tar_gz_path,
                    special_dir          = hadoop_path,
                    output_name          = "output.root",
                    files_per_output     = files_per_output_config_list[index],
                    condor_submit_params = {"sites" : sites},
                    open_dataset         = False,
                    flush                = True,
                    #no_load_from_backup  = True,
                    )

            # process the job (either submits, checks for resubmit, or finishes etc.)
            maker_task.process()

            # save some information for the dashboard
            total_summary["["+job_tag+"] "+maker_task.get_sample().get_datasetname()] = maker_task.get_task_summary()

            # Aggregate whether all tasks are complete
            all_tasks_complete = all_tasks_complete and maker_task.complete()


        # parse the total summary and write out the dashboard
        StatsParser(data=total_summary, webdir=metis_dashboard_path).do()

        # Print msummary table so I don't have to load up website
        os.system("msummary -r -p {} | tee summary.txt".format(job_tag))
        os.system("chmod -R 755 {}".format(metis_dashboard_path))
        os.system("chmod 644 {}/images/*".format(metis_dashboard_path))

        # If all done exit the loop
        if all_tasks_complete:
            print ""
            print "Job={} finished".format(job_tag)
            print ""
            break

        # Neat trick to not exit the script for force updating
        print 'Press Ctrl-C to force update, otherwise will sleep for 300 seconds'
        try:
            for i in range(0,60):
                sleep(1) # could use a backward counter to be preeety :)
        except KeyboardInterrupt:
            raw_input("Press Enter to force update, or Ctrl-C to quit.")
            print "Force updating..."

    os.chdir(main_dir)
Exemple #9
0
        output_is_tree=True,
        tag=tag,
        condor_submit_params={"sites": "T2_US_UCSD,UAF"},
        cmssw_version="CMSSW_10_2_9",
        scram_arch="slc6_amd64_gcc700",
        min_completion_fraction=1.00,
    )

    maker_tasks.append(maker_task)

if not args.dryRun:
    for i in range(100):
        total_summary = {}

        #for maker_task, merge_task in zip(maker_tasks,merge_tasks):
        for maker_task in maker_tasks:
            maker_task.process()

            frac = maker_task.complete(return_fraction=True)
            total_summary[maker_task.get_sample().get_datasetname(
            )] = maker_task.get_task_summary()

        print(frac)

        # parse the total summary and write out the dashboard
        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/metis_tW_scattering/").do()

        # 15 min power nap
        time.sleep(15. * 60)
Exemple #10
0
def submit():

    requests = {
        #'TTWJetsToLNuEWK_5f_NLO':       '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_NLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball_retired.tar.xz', # that's the SM point, but using the SMEFT model. No lepton filtering, so name is actually confusing
        #'TTWJetsToLNuEWK_5f_NLO_v2':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_NLO_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz', # that's the actual SM
        #'TTWplusJetsToLNuEWK_5f_NLO_v2':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWplusJetsToLNuEWK_5f_NLO_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz', # that's the actual SM
        #'TTWminusJetsToLNuEWK_5f_NLO_v2':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWminusJetsToLNuEWK_5f_NLO_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz', # that's the actual SM
        #'TTWJetsToLNuEWK_5f_EFT_myNLO_full':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_cpt8_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz', # one of the BSM points
        #'TTWJetsToLNuEWK_5f_EFT_mix_myNLO_full':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz',  # EFT mix
        #'TTWJetsToLNuEWK_5f_EFT_cpq3_4_myNLO_full':    '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks//TTWJetsToLNuEWK_5f_EFT_myNLO_cpq3_4_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz',  # C_pq3 = 4
        #'TTWJetsToLNuEWK_5f_NLO': '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_NLO_slc7_amd64_gcc730_CMSSW_9_3_16_tarball.tar.xz',
        'TTWJetsToLNuEWK_5f_SMEFTatNLO_weight':
        '/hadoop/cms/store/user/dspitzba/tW_scattering/gridpacks/TTWJetsToLNuEWK_5f_EFT_myNLO_slc7_amd64_gcc700_CMSSW_10_6_19_tarball.tar.xz',
    }

    total_summary = {}

    extra_requirements = "true"

    # v6+ is UL

    tag = "UL18_v7"
    #events_per_point = 250000
    #events_per_job = 250
    #events_per_point = 2000000
    events_per_point = 4000000
    events_per_job = 2000
    njobs = int(events_per_point) // events_per_job

    for reqname in requests:
        gridpack = requests[reqname]

        task = CondorTask(
            sample=DummySample(dataset="/%s/RunIIAutumn18/NANO" % reqname,
                               N=njobs,
                               nevents=int(events_per_point)),
            output_name="nanoAOD.root",
            executable="executables/condor_executable_UL18.sh",
            #executable = "executables/condor_executable_UL17.sh",
            #executable = "executables/condor_executable_UL16_postVFP.sh",
            tarfile="package.tar.gz",
            additional_input_files=[gridpack],
            open_dataset=False,
            files_per_output=1,
            arguments=gridpack.split('/')[-1],
            condor_submit_params={
                "sites":
                "T2_US_UCSD",  #
                #"memory": 1950,
                #"cpus": 1,
                "memory":
                15600,
                "cpus":
                8,
                "classads": [
                    ["param_nevents", events_per_job],
                    ["metis_extraargs", ""],
                    ["JobBatchName", reqname],
                    ["IS_CLOUD_JOB", "yes"],
                ],
                "requirements_line":
                'Requirements = (HAS_SINGULARITY=?=True)'
            },
            tag=tag,
            min_completion_fraction=0.90,
        )

        task.process()
        total_summary[
            task.get_sample().get_datasetname()] = task.get_task_summary()

        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/tW_gen/").do()
Exemple #11
0
                 tag=tag_mc,
                 extra_args="--year {}".format(year)))

    # # test 3/4 body
    # locations = []
    # locations += glob.glob("/hadoop/cms/store/user/namin/testscoutingmc/BToPhi_params_year*_m*_ctau*mm_RAWSIM_v*/")
    # for location in locations:
    #     tag_mc = location.rsplit("_",1)[-1].replace("/","")
    #     taskname = location.rstrip("/").rsplit("/")[-1]
    #     dataset = "/{}/{}/BABY".format(
    #             taskname.split("_",1)[0],
    #             taskname.split("_",1)[1].split("_RAWSIM")[0],
    #             )
    #     year = 2018
    #     if "year2017" in dataset:
    #         year = 2017
    #     infos.append(dict(location=location, dataset=dataset, isdata=False, tag=tag_mc, extra_args="--year {}".format(year)))

    tasks = get_tasks(infos)

    for _ in range(500):
        total_summary = {}
        for task in tasks:
            task.process()
            total_summary[
                task.get_sample().get_datasetname()] = task.get_task_summary()
        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/scouting/").do()
        # time.sleep(30*60)
        time.sleep(4 * 60 * 60)
Exemple #12
0
                    recopy_inputs=False,
                )
                merge_task = LocalMergeTask(
                    input_filenames=task.get_outputs(),
                    output_filename="{}/{}.root".format(merged_dir, shortname),
                    ignore_bad=skip_tail,
                )
                nsamples += 1
                if not task.complete():
                    task.additional_input_files = [
                        "/home/users/namin/2018/fourtop/all/FTAnalysis/babymaking/batch/condor_chirp"
                    ]
                    task.process()
                else:
                    if not merge_task.complete():
                        merge_task.process()
                    else:
                        ndone += 1

                total_summary[dsname.split("|")[0]] = task.get_task_summary()

        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/FTmetis/").do(
                        custom_event_rate_parser=get_event_rate, )

        if ndone == nsamples:
            print "All done!"
            sys.exit()

        time.sleep(600 if i < 10 else 1.5 * 60 * 60)
Exemple #13
0
                cmssw_version = cmsswver,
                tarfile = tarfile,
                special_dir = "run2_moriond17_cms4/ProjectMetis",
                # min_completion_fraction = 0.94,
                publish_to_dis = True,
                sparms = sparms,
        )
        tasks.append(task)
    return tasks
        

if __name__ == "__main__":

    for i in range(10000):
        total_summary = {}
        total_counts = {}
        tasks = []
        tasks.extend(get_tasks())
        for task in tasks:
            dsname = task.get_sample().get_datasetname()
            try:
                if not task.complete():
                    task.process()
            except:
                traceback_string = traceback.format_exc()
                print "Runtime error:\n{0}".format(traceback_string)
                send_email(subject="metis error", body=traceback_string)
            total_summary[dsname] = task.get_task_summary()
        StatsParser(data=total_summary, webdir="~/public_html/dump/metis/", make_plots=False).do()
        time.sleep(1.*3600)
Exemple #14
0
            tag=tag,
            # condor_submit_params = {"sites": "T2_US_UCSD", "use_xrootd":True, "classads": [ ["metis_extraargs", "fetch_nano"] ]},
            condor_submit_params={
                "sites": "T2_US_UCSD",
                "use_xrootd": True
            },
            cmssw_version="CMSSW_10_2_13",
            scram_arch="slc7_amd64_gcc700",
            input_executable=
            "condor_executable_metis.sh",  # your condor executable here
            tarfile=tarfile,  # your tarfile with assorted goodies here
            special_dir="VBSHWWNanoSkim/{}".format(
                tag
            ),  # output files into /hadoop/cms/store/<user>/<special_dir>
        )
        # Straightforward logic
        if not task.complete():
            task.process()

        # Set task summary
        task_summary[
            task.get_sample().get_datasetname()] = task.get_task_summary()

    # Parse the summary and make a summary.txt that will be used to pretty status of the jobs
    os.system("rm -f web_summary.json")
    os.system("rm -f summary.json")
    webdir = "~/public_html/VBSHWWNanoSkimmerDashboard"
    StatsParser(data=task_summary, webdir=webdir).do()
    os.system("chmod -R 755 {}".format(webdir))
    os.system("msummary -r -i {}/web_summary.json".format(webdir))
Exemple #15
0
while True:
    allcomplete = True
    for ds, fpo, args in dsdefs[:]:
        sample = DBSSample(dataset=ds)
        task = CondorTask(sample=sample,
                          open_dataset=False,
                          files_per_output=fpo,
                          output_name="test_skim.root"
                          if DOSKIM else "myMicroAODOutputFile.root",
                          tag=job_tag,
                          executable=exec_path,
                          tarfile=tar_path,
                          condor_submit_params={"sites": "T2_US_UCSD"},
                          special_dir=hadoop_path,
                          arguments=args.replace(" ", "|"))
        task.process()
        allcomplete = allcomplete and task.complete()
        # save some information for the dashboard
        total_summary[ds] = task.get_task_summary()
    # parse the total summary and write out the dashboard
    StatsParser(data=total_summary,
                webdir="~/public_html/dump/metis_microaod_80x/").do()
    os.system("chmod -R 755 ~/public_html/dump/metis_microaod_80x")
    if allcomplete:
        print ""
        print "Job={} finished".format(job_tag)
        print ""
        break
    print "Sleeping 1800 seconds ..."
    time.sleep(1800)
        tag=job_tag,
        cmssw_version="CMSSW_10_2_22",  # doesn't do anything
        arguments=job_args,
        executable=exec_path,
        tarfile=tar_path,
        condor_submit_params={
            "sites":
            "T2_US_UCSD",
            "container":
            "/cvmfs/singularity.opensciencegrid.org/cmssw/cms:rhel7-m20201010"
        })

    attrs = vars(task)

    # check attrs
    print(', '.join("%s: %s" % item for item in attrs.items()))

    task.process()

    total_summary = {}

    total_summary[
        task.get_sample().get_datasetname()] = task.get_task_summary()

    # Web dashboard
    StatsParser(data=total_summary, webdir="~/public_html/v4/").do()
    os.system("chmod -R 755 ~/public_html/v4/")

    print("Sleeping 10seconds ...")
    time.sleep(10)
Exemple #17
0
            # Straightforward logic
            if not task.complete():
                task.process()
            else:
                if not merge_task.complete():
                    merge_task.process()

            # Aggregate whether all tasks are complete
            all_tasks_complete = all_tasks_complete and task.complete()

            # Set task summary
            task_summary[
                task.get_sample().get_datasetname()] = task.get_task_summary()

        # Parse the summary and make a summary.txt that will be used to pretty status of the jobs
        StatsParser(data=task_summary,
                    webdir="~/public_html/VVVNanoLooperDashboard").do()
        os.system("chmod -R 755 ~/public_html/VVVNanoLooperDashboard")
        os.system("msummary -r | tee summary.txt")

        # If all done exit the loop
        if all_tasks_complete:
            print("")
            print("All job finished")
            print("")
            break

        # Neat trick to not exit the script for force updating
        print(
            'Press Ctrl-C to force update, otherwise will sleep for 600 seconds'
        )
        try:
def submit(dinfos, version_tag, dotestrun=False, files_per_output_func=UNITY):

    # Loop
    while True:

        tasks = [] # List to hold all the Metis Tasks
        total_summary = {} # Summary for task status report to access via http

        # Boolean to aggregate all the task compelete status
        all_tasks_complete = True

        # Loop over all the campaigns
        for campaign in dinfos:

            create_tar_ball(dinfos[campaign]["year"], dinfos[campaign]["baby_type"], version_tag) # Create tar ball

            # Get all the tasks for this campaign
            this_set_of_tasks = get_tasks(
                    samples_dictionary    = dinfos[campaign]["samples"],
                    year                  = dinfos[campaign]["year"],
                    baby_type             = dinfos[campaign]["baby_type"],
                    baby_version_tag      = version_tag,
                    dotestrun             = dotestrun,
                    files_per_output_func = files_per_output_func,
                    )

            # Need separate dictionaries for each tag in order to let StatsParsers uniquely handle same dataset name jobs.
            if len(this_set_of_tasks) > 0:
                print this_set_of_tasks[0].tag
                total_summary[this_set_of_tasks[0].tag] = {}

            # Add to the master list of tasks
            tasks += this_set_of_tasks

        # Loop over all the tasks
        for task in tasks:

            # Process the task (submit or resubmit)
            task.process()

            # save some information for the dashboard
            total_summary[task.tag][task.get_sample().get_datasetname()] = task.get_task_summary()

            # Aggregate task complete booleans
            all_tasks_complete = all_tasks_complete and task.complete()

        # parse the total summary and write out the dashboard
        #metis_dashboard_path = os.path.join(os.path.dirname(os.path.dirname(metis.__file__)), "dashboard")
        metis_dashboard_path = "~/public_html/dump"

        # Go through each tag and do StatsParser
        for tag in total_summary:
            StatsParser(data=total_summary[tag], webdir=metis_dashboard_path).do()

        # Print msummary table so I don't have to load up website
        #os.system("msummary -r -p MAKER | tee summary.txt")
        os.system("msummary -r | tee summary.txt")
        os.system("chmod -R 755 {}".format(metis_dashboard_path))

        # If all done exit the loop
        if all_tasks_complete:
            print ""
            print "All job finished"
            print ""
            break

        # Neat trick to not exit the script for force updating
        print 'Press Ctrl-C to force update, otherwise will sleep for 300 seconds'
        try:
            for i in range(0,300):
                sleep(1) # could use a backward counter to be preeety :)
        except KeyboardInterrupt:
            raw_input("Press Enter to force update, or Ctrl-C to quit.")
            print "Force updating..."
Exemple #19
0
                        condor_submit_params={"sites": "T2_US_UCSD"} if
                        (args.use_wget) else {
                            "sites":
                            "T2_US_UCSD,T2_US_CALTECH,T2_US_MIT,T2_US_WISCONSIN,T2_US_Nebraska,T2_US_Vanderbilt,T2_US_Florida,T3_US_UCR,T3_US_OSG,T3_US_Baylor,T3_US_Colorado,T3_US_Rice,T3_US_PuertoRico,T3_US_Cornell,T3_US_FIT,T3_US_FIU,T3_US_OSU,T3_US_Rutgers,T3_US_TAMU,T3_US_TAMU,T3_US_TTU,T3_US_UCD,T3_US_UMD,T3_US_UMiss"
                        },
                        special_dir=hadoop_path,
                        arguments=conds_dict[year])
                    task.process()
                    if not task.complete():
                        allcomplete = False
                    total_summary[dataset] = task.get_task_summary()
                    if first_run:
                        print "Sleeping 30s to space out jobs"
                        os.system("sleep 30s")
    StatsParser(data=total_summary,
                summary_fname="summary_%s.json" % job_tag,
                webdir="~/public_html/dump/ttH_BabyMaker_v2_%s/" %
                job_tag).do()
    os.system("chmod -R 755 ~/public_html/dump/ttH_BabyMaker_v2_%s" % job_tag)
    if allcomplete:
        print("")
        print("Job={} finished".format(job_tag))
        print("")
        break
    first_run = False
    print("Sleeping 1000 seconds ...")
    time.sleep(1000)

signal_strings = [
    "ttHJetToGG", "ttHToGG", "THQ", "THW", "VBF", "GluGluHToGG", "VHToGG",
    "FCNC", "ttHiggs"
]
Exemple #20
0
def main():

    if data_year == "2016":
        samples_to_run = dataset.hww_samples_to_run_2016
        samples_short_name = dataset.samples_short_name_2016
        dslocs = dataset.dslocscms4_2016_allpf

    # file/dir paths
    main_dir = os.path.dirname(os.path.abspath(__file__))
    metis_path = os.path.dirname(os.path.dirname(metis.__file__))
    tar_path = os.path.join(metis_path, "package.tar")
    tar_gz_path = tar_path + ".gz"
    metis_dashboard_path = os.path.join(metis_path, "dashboard")
    exec_path = os.path.join(main_dir, "metis.sh")
    merge_exec_path = os.path.join(main_dir, "merge.sh")
    hadoop_path = "metis/baby/{}".format(
        job_tag
    )  # The output goes to /hadoop/cms/store/user/$USER/"hadoop_path"
    if job_tag.find("HWW") != -1:
        args = "0"  # HWWBaby

    # Create tarball
    os.chdir(main_dir)
    os.system(
        "tar -chzf {} localsetup.sh processBaby *.so *.pcm rooutil/lib*.so coreutil/data coreutil/lib*.so *.txt btagsf MVAinput jetCorrections leptonSFs puWeight2016.root pileup_jul21_nominalUpDown.root ../CORE/Tools/ mergeHadoopFiles.C rooutil/hadd.py fastjet/fastjet-install/lib"
        .format(tar_gz_path))

    # Change directory to metis
    os.chdir(metis_path)

    total_summary = {}

    # Loop over datasets to submit
    while True:

        all_tasks_complete = True

        for sample in samples_to_run:

            loc = dslocs[sample]

            # define the task
            maker_sample_name = "/MAKER_" + sample[1:]
            maker_task = CondorTask(
                sample=DirectorySample(dataset=maker_sample_name,
                                       location=loc),
                tag=job_tag,
                arguments=args,
                executable=exec_path,
                tarfile=tar_gz_path,
                special_dir=hadoop_path,
                output_name="output.root",
                files_per_output=1,
                condor_submit_params={"sites": "T2_US_UCSD"},
                open_dataset=False,
                flush=True,
                #min_completion_fraction = 0.5,
                #no_load_from_backup  = True,
            )

            # process the job (either submits, checks for resubmit, or finishes etc.)
            maker_task.process()

            # save some information for the dashboard
            total_summary[maker_task.get_sample().get_datasetname(
            )] = maker_task.get_task_summary()

            # define the task
            merge_sample_name = "/MERGE_" + sample[1:]
            merge_task = CondorTask(
                sample=DirectorySample(dataset=merge_sample_name,
                                       location=maker_task.get_outputdir()),
                tag=job_tag,
                executable=merge_exec_path,
                tarfile=tar_gz_path,
                files_per_output=100000,
                output_dir=maker_task.get_outputdir() + "/merged",
                output_name=samples_short_name[sample] + ".root",
                condor_submit_params={"sites": "T2_US_UCSD"},
                open_dataset=False,
                flush=True,
                output_is_tree=True,
                cmssw_version="CMSSW_9_2_0",
                scram_arch="slc6_amd64_gcc530",
                #no_load_from_backup  = True,
            )

            if maker_task.complete():

                # process the job (either submits, checks for resubmit, or finishes etc.)
                merge_task.process()

                # save some information for the dashboard
                total_summary[merge_task.get_sample().get_datasetname(
                )] = merge_task.get_task_summary()

            # Aggregate whether all tasks are complete
            all_tasks_complete = all_tasks_complete and maker_task.complete()

        # parse the total summary and write out the dashboard
        StatsParser(data=total_summary, webdir=metis_dashboard_path).do()

        # Print msummary table so I don't have to load up website
        os.system("msummary -r | tee summary.txt")
        os.system("chmod -R 755 {}".format(metis_dashboard_path))

        # If all done exit the loop
        if all_tasks_complete:
            print ""
            print "Job={} finished".format(job_tag)
            print ""
            break

        # Neat trick to not exit the script for force updating
        print 'Press Ctrl-C to force update, otherwise will sleep for 300 seconds'
        try:
            for i in range(0, 300):
                sleep(1)  # could use a backward counter to be preeety :)
        except KeyboardInterrupt:
            raw_input("Press Enter to force update, or Ctrl-C to quit.")
            print "Force updating..."
Exemple #21
0
def runall(special_dir, tag, total_nevents, events_per_output, config):

    for _ in range(25):

        proc_tag = "v1"
        #special_dir = "workflowtest/ProjectMetis"
        #special_dir = "miniaod_runII/JHUSample_ttH"

        cmssw_v_gensim = config["cmssw_v_gensim"]
        pset_gensim = config["pset_gensim"]
        scram_arch_gensim = config["scram_arch_gensim"]

        cmssw_v_aodsim = config["cmssw_v_aodsim"]
        pset_aodsim = config["pset_aodsim"]
        scram_arch_aodsim = config["scram_arch_aodsim"]

        pset_aodsim2 = config["pset_aodsim2"]
        cmssw_v_aodsim2 = cmssw_v_aodsim  #config["pset_aodsim2"]
        scram_arch_aodsim2 = scram_arch_aodsim  #config["scram_arch_aodsim2"]

        cmssw_v_miniaodsim = config["cmssw_v_miniaodsim"]
        pset_miniaodsim = config["pset_miniaodsim"]
        scram_arch_miniaodsim = config["scram_arch_miniaodsim"]

        step1 = CMSSWTask(
            # Change dataset to something more meaningful (but keep STEP1, as we use this
            # for string replacement later); keep N=1
            sample=DummySample(N=1, dataset="/" + tag + "_STEP1"),
            # A unique identifier
            tag=proc_tag,
            special_dir=special_dir,
            # Probably want to beef up the below two numbers to control splitting,
            # but note that step2 is the bottleneck, so don't put too many events
            # in one output file here
            events_per_output=events_per_output,
            total_nevents=total_nevents,
            #events_per_output = 50,
            #total_nevents = 1000,
            # We have one input dummy file, so this must be True
            split_within_files=True,
            pset="psets/" + pset_gensim,
            cmssw_version=cmssw_v_gensim,
            scram_arch=scram_arch_gensim,
        )

        step2 = CMSSWTask(
            sample=DirectorySample(
                location=step1.get_outputdir(),
                dataset=step1.get_sample().get_datasetname().replace(
                    "STEP1", "STEP2"),
            ),
            tag=proc_tag,
            special_dir=special_dir,
            open_dataset=True,
            files_per_output=1,
            pset="psets/" + pset_aodsim,
            cmssw_version=cmssw_v_aodsim,
            scram_arch=scram_arch_aodsim,
        )

        step3 = CMSSWTask(
            sample=DirectorySample(
                location=step2.get_outputdir(),
                dataset=step2.get_sample().get_datasetname().replace(
                    "STEP2", "STEP3"),
            ),
            tag=proc_tag,
            special_dir=special_dir,
            open_dataset=True,
            files_per_output=1,
            pset="psets/" + pset_aodsim2,
            cmssw_version=cmssw_v_aodsim2,
            scram_arch=scram_arch_aodsim2,
        )

        step4 = CMSSWTask(
            sample=DirectorySample(
                location=step3.get_outputdir(),
                dataset=step3.get_sample().get_datasetname().replace(
                    "STEP3", "STEP4"),
            ),
            tag=proc_tag,
            special_dir=special_dir,
            open_dataset=True,
            files_per_output=1,
            output_name="step4.root",
            pset="psets/" + pset_miniaodsim,
            cmssw_version=cmssw_v_miniaodsim,
            scram_arch=scram_arch_miniaodsim,
            # condor_submit_params = {"sites":"UAF,UCSD"},
        )
        '''
    step5 = CMSSWTask(
            sample = DirectorySample(
                location = step4.get_outputdir(),
                dataset = step4.get_sample().get_datasetname().replace("STEP4","STEP5"),
                ),
            tag = proc_tag,
            special_dir = special_dir,
            open_dataset = True,
            files_per_output = 1,
            pset = "psets/TOP-RunIIFall17NanoAODv7-00001_1_cfg.py",
            # The below two lines should match output file names in the pset
            output_name = "step5.root",
            #other_outputs = ["step3_inMINIAODSIM.root","step3_inDQM.root"],
            cmssw_version = "CMSSW_10_2_22",
            scram_arch = "slc6_amd64_gcc700",
            # condor_submit_params = {"sites":"UAF,UCSD"},
            )
    '''
        #for _ in range(25):
        total_summary = {}
        for task in [step1, step2, step3, step4]:
            task.process()
            summary = task.get_task_summary()
            total_summary[task.get_sample().get_datasetname()] = summary
        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/metis/").do()
        time.sleep(600)
Exemple #22
0
            files_per_output=6,
            output_name="merged.root",
            tag=job_tag,
            #cmssw_version = "CMSSW_9_2_1", # doesn't do anything
            arguments=args,
            executable=exec_path,
            tarfile=tar_path,
            special_dir=hadoop_path,
            #condor_submit_params = {"universe" : "local"}
            condor_submit_params={"sites": "UAF"})

        task.process()

        # save some information for the dashboard
        total_summary["WWW_v0_1_%s_%s" %
                      (baby_version, job_tag)] = task.get_task_summary()

        # parse the total summary and write out the dashboard
        StatsParser(data=total_summary,
                    webdir="~/public_html/tasutil/Metis_WWW/").do()

        if task.complete():
            print ""
            print "Job=%s finished" % job_tag
            print ""
            break

        time.sleep(2 * 60)

#eof
Exemple #23
0
        total_summary = {}
        fracs = []

        for task in tasks:
            #for maker_task in maker_tasks:
            task.process()

            frac = task.complete(return_fraction=True)

            total_summary[
                task.get_sample().get_datasetname()] = task.get_task_summary()

            fracs.append(frac)

        # parse the total summary and write out the dashboard
        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/metis_%s/" % model).do()

        print "%s/%s jobs are completed." % (sum(fracs), len(fracs))

        if sum(fracs) / len(fracs) == 1:
            print "Done."
            break

        # 60 min power nap
        time.sleep(60. * 60)

for signal in signals:
    #signal['spin'] = signal['name'].split('_')[0]
    print signal['name']
    try:
        res = readResFile(signal['workspace'])
Exemple #24
0
        files = [f.name for f in sample.get_files()]
        print(len(files))
        task = CondorTask(sample=sample,
                          open_dataset=False,
                          flush=True,
                          files_per_output=info["fpo"],
                          output_name="merged_ntuple.root",
                          tag=job_tag,
                          cmssw_version=cmssw_ver,
                          executable=exec_path,
                          tarfile=tar_path,
                          condor_submit_params={"sites": "T2_US_UCSD"},
                          special_dir=hadoop_path,
                          arguments=info["meta_conditions"])
        task.process()
        if not task.complete():
            allcomplete = False
        # save some information for the dashboard
        total_summary[dataset] = task.get_task_summary()
    # parse the total summary and write out the dashboard
    StatsParser(data=total_summary,
                webdir="~/public_html/dump/ttH_BabyMaker/").do()
    os.system("chmod -R 755 ~/public_html/dump/ttH_BabyMaker")
    if allcomplete:
        print("")
        print("Job={} finished".format(job_tag))
        print("")
        break
    print("Sleeping 300 seconds ...")
    time.sleep(300)
Exemple #25
0
def main():

    main_dir = os.path.dirname(os.path.abspath(__file__))
    metis_path = os.path.dirname(os.path.dirname(metis.__file__))
    exec_path = main_dir + "/metis.sh"
    hadoop_path = "metis/"
    metis_dashboard_path = os.path.join(metis_path, "dashboard")
    job_tag = ""

    total_summary = {}

    os.chdir(metis_path)

    while True:

        masspoints = [125]

        tasks = []

        for mass in masspoints:

            miniaod = CondorTask(
                    ## Dummy sample as no input is needed in generating the events
                    #sample = DummySample(
                    #    N=3000,
                    #    dataset="/VHToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/PRIVATE-RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v1/MINIAODSIM"
                    #    ),
                    # Dummy sample as no input is needed in generating the events
                    sample = DummySample(
                        N=3500,
                        dataset="/WWW_4F_TuneCP5_13TeV-amcatnlo-pythia8/PRIVATE-RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM"
                        ),
                    tag                  = job_tag,
                    executable           = exec_path,
                    special_dir          = hadoop_path + "/private_miniaod",
                    output_name          = "output.root",
                    files_per_output     = 1,
                    condor_submit_params = {"sites" : "T2_US_UCSD"},
                    open_dataset         = True,
                    flush                = True,
                    #no_load_from_backup  = True,
                    )

            tasks.extend([miniaod])

        all_tasks_complete = True
        for task in tasks:
            task.process()
            summary = task.get_task_summary()
            total_summary[task.get_sample().get_datasetname()] = summary
            all_tasks_complete = all_tasks_complete and task.complete()

        # parse the total summary and write out the dashboard
        StatsParser(data=total_summary, webdir=metis_dashboard_path).do()

        # Print msummary table so I don't have to load up website
        os.system("msummary -v0 -p ext2 | tee summary.txt")
        os.system("chmod -R 755 {}".format(metis_dashboard_path))

        # If all done exit the loop
        if all_tasks_complete:
            print ""
            print "Job={} finished".format(job_tag)
            print ""
            break

        # Neat trick to not exit the script for force updating
        print 'Press Ctrl-C to force update, otherwise will sleep for 300 seconds'
        try:
            for i in range(0,300):
                sleep(1) # could use a backward counter to be preeety :)
        except KeyboardInterrupt:
            raw_input("Press Enter to force update, or Ctrl-C to quit.")
            print "Force updating..."
Exemple #26
0
        # tasks.extend(moriondremc_isotracks.get_tasks())
        # tasks.extend(data2018_102x.get_tasks()) # NOTE open dataset because WTF DAS can add files after the datset is marked as valid? NOTE remember to flush eventually
        for task in tasks:
            dsname = task.get_sample().get_datasetname()
            try:
                if not task.complete():
                    # condor chirp for expert monitoring
                    # task.additional_input_files = ["/home/users/namin/2017/ProjectMetis/metis/executables/condor_chirp"]
                    task.process()
            except:
                traceback_string = traceback.format_exc()
                print "Runtime error:\n{0}".format(traceback_string)
                send_email(subject="metis error", body=traceback_string)
            total_summary[dsname] = task.get_task_summary()
        StatsParser(data=total_summary,
                    webdir="~/public_html/dump/metis/",
                    make_plots=False).do(show_progress_bar=True)

        interruptible_sleep(3 * 3600,
                            reload_modules=[
                                data2016_94x_v2,
                                data2017_94x_v2,
                                mc2017_94x_v2,
                                mc2016_94x_v3,
                                data2018_102x,
                                mc2018_102x_v1,
                                prompt10x_data,
                                moriondremc,
                                moriondremc_isotracks,
                                moriondremc_private,
                            ])
Exemple #27
0
            f.name for f in sample.get_files() if f.name not in corrupt_files
        ]
        sample.set_files(files)
        task = CondorTask(
            sample=sample,
            open_dataset=False,
            flush=True,
            files_per_output=1,
            output_name="merged_ntuple.root",
            tag=job_tag,
            cmssw_version="CMSSW_9_2_1",  # doesn't do anything
            executable=exec_path,
            tarfile=tar_path,
            condor_submit_params={"sites": "T2_US_UCSD"},
            special_dir=hadoop_path)
        task.process()
        if not task.complete():
            allcomplete = False
        # save some information for the dashboard
        total_summary[ds] = task.get_task_summary()
    # parse the total summary and write out the dashboard
    StatsParser(data=total_summary, webdir="~/public_html/dump/deepiso/").do()
    os.system("chmod -R 755 ~/public_html/dump/deepiso")
    if allcomplete:
        print ""
        print "Job={} finished".format(job_tag)
        print ""
        break
    print "Sleeping 300 seconds ..."
    time.sleep(300)
Exemple #28
0
def main():

    # file/dir paths
    main_dir = os.path.dirname(os.path.abspath(__file__))
    metis_path = os.path.dirname(os.path.dirname(metis.__file__))
    tar_path = os.path.join(metis_path, "package.tar")
    tar_gz_path = tar_path + ".gz"
    metis_dashboard_path = os.path.join(metis_path, "dashboard")
    exec_path = os.path.join(main_dir, "metis.sh")
    hadoop_path = "metis/baby/{}".format(
        job_tag
    )  # The output goes to /hadoop/cms/store/user/$USER/"hadoop_path"

    # Create tarball
    os.chdir(main_dir)
    os.system("tar -chzf {} a.out setup.sh *.xml".format(tar_gz_path))

    # Change directory to metis
    os.chdir(metis_path)

    total_summary = {}

    samples_to_run = [
        DirectorySample(
            dataset=
            "/GluGluHToWWToLNuQQ_M125_13TeV_powheg_JHUGenV628_pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber="GluGluHToWWToLNuQQ_M125_13TeV_powheg_JHUGenV628*.root",
        ),
        DirectorySample(
            dataset=
            "/VBFHToWWToLNuQQ_M125_13TeV_powheg_JHUGenV628_pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber="VBFHToWWToLNuQQ_M125_13TeV_powheg_JHUGenV628*.root",
        ),
        DirectorySample(
            dataset=
            "/TT_TuneCUETP8M2T4_13TeV-powheg-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber="TT_TuneCUETP8M2T4_13TeV-powheg*.root",
        ),
        DirectorySample(
            dataset=
            "/WJetsToLNu_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber="WJetsToLNu_TuneCUETP8M1_13TeV-madgraphMLM*.root",
        ),
        DirectorySample(
            dataset=
            "/WJetsToLNu_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber=
            "WJetsToLNu_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM_ext1*.root",
        ),
        DirectorySample(
            dataset=
            "/WJetsToLNu_HT-600To800_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber=
            "WJetsToLNu_HT-600To800_TuneCUETP8M1_13TeV-madgraphMLM_ext1*.root",
        ),
        DirectorySample(
            dataset=
            "/WJetsToLNu_HT-800To1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber=
            "WJetsToLNu_HT-800To1200_TuneCUETP8M1_13TeV-madgraphMLM_ext1*.root",
        ),
        DirectorySample(
            dataset=
            "/WJetsToLNu_HT-1200To2500_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber=
            "WJetsToLNu_HT-1200To2500_TuneCUETP8M1_13TeV-madgraphMLM*.root",
        ),
        DirectorySample(
            dataset=
            "/WJetsToLNu_HT-2500ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/RunIISummer16MiniAODv2-PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6_ext1-v1/MINIAODSIM",
            location=
            "/hadoop/cms/store/user/phchang/metis/baby/HWW2016_v1.15.1/merged4",
            globber=
            "WJetsToLNu_HT-2500ToInf_TuneCUETP8M1_13TeV-madgraphMLM_ext1*.root",
        ),
    ]

    # Loop over datasets to submit
    while True:

        all_tasks_complete = True

        #for sample in sorted(samples):
        for sample in samples_to_run:

            # define the task
            maker_task = CondorTask(
                sample=sample,
                tag=job_tag,
                arguments="",
                executable=exec_path,
                tarfile=tar_gz_path,
                special_dir=hadoop_path,
                output_name="output.root",
                files_per_output=1,
                condor_submit_params={"sites": "T2_US_UCSD"},
                open_dataset=False,
                flush=True,
                #no_load_from_backup  = True,
            )

            # process the job (either submits, checks for resubmit, or finishes etc.)
            maker_task.process()

            # save some information for the dashboard
            total_summary[maker_task.get_sample().get_datasetname(
            )] = maker_task.get_task_summary()

            # Aggregate whether all tasks are complete
            all_tasks_complete = all_tasks_complete and maker_task.complete()

        # parse the total summary and write out the dashboard
        StatsParser(data=total_summary, webdir=metis_dashboard_path).do()

        # Print msummary table so I don't have to load up website
        os.system("msummary -r | tee summary.txt")
        os.system("chmod -R 755 {}".format(metis_dashboard_path))

        # If all done exit the loop
        if all_tasks_complete:
            print ""
            print "Job={} finished".format(job_tag)
            print ""
            break

        # Neat trick to not exit the script for force updating
        print 'Press Ctrl-C to force update, otherwise will sleep for 300 seconds'
        try:
            for i in range(0, 300):
                sleep(1)  # could use a backward counter to be preeety :)
        except KeyboardInterrupt:
            raw_input("Press Enter to force update, or Ctrl-C to quit.")
            print "Force updating..."
Exemple #29
0
        calc_neg_events=False,
    )

    jra_flatpu = CMSSWTask(
        sample=DirectorySample(
            location=indir_flatpu,
            dataset=
            "/QCD_Pt-15to7000_TuneCP5_Flat_13TeV_pythia8/privateMC_fastsim_FlatPU_94x/JRA"
        ),
        open_dataset=True,
        files_per_output=10,
        pset="../run_JRA_cfg_update.py",
        cmssw_version="CMSSW_9_4_12",
        scram_arch="slc6_amd64_gcc630",
        tag=tag,
        tarfile="lib_JRA.tar.xz",
        dont_check_tree=True,
        calc_neg_events=False,
    )

    tasks = [jra_nopu, jra_flatpu]

    for task in tasks:
        task.process()
        summary = task.get_task_summary()
        total_summary[task.get_sample().get_datasetname()] = summary

    StatsParser(data=total_summary,
                webdir="~/public_html/dump/metis_jra/").do()
    time.sleep(30 * 60)
Exemple #30
0
                            flush = True,
                            files_per_output = fpo(sample),
                            output_name = "merged_ntuple.root",
                            tag = job_tag,
                            cmssw_version = cmssw_ver,
                            executable = "condor_exe_%s.sh" % job_tag if (args.use_xrdcp or args.use_gridftp or args.use_wget) else "condor_exe.sh",
                            tarfile = "empty" if (args.use_xrdcp or args.use_gridftp or args.use_wget) else tar_path,
                            condor_submit_params = {"sites" : "T2_US_UCSD"} if (args.use_wget) else {"sites" : "T2_US_UCSD,T2_US_CALTECH,T2_US_MIT,T2_US_WISCONSIN,T2_US_Nebraska,T2_US_Purdue,T2_US_Vanderbilt,T2_US_Florida"},
                            special_dir = hadoop_path,
                            arguments = conds_dict[year]
                    )
                    task.process()
                    if not task.complete():
                        allcomplete = False
                    total_summary[dataset] = task.get_task_summary()
                    if first_run:
                        print "Sleeping 30s to space out jobs"
                        os.system("sleep 30s")
    StatsParser(data=total_summary, webdir="~/public_html/dump/ttH_BabyMaker_v2_%s/" % job_tag).do()
    os.system("chmod -R 755 ~/public_html/dump/ttH_BabyMaker_v2_%s" % job_tag)
    if allcomplete:
        print("")
        print("Job={} finished".format(job_tag))
        print("")
        break
    first_run = False
    print("Sleeping 1000 seconds ...")
    time.sleep(1000)

signal_strings = ["ttHJetToGG", "ttHToGG", "THQ", "THW", "VBF", "GluGluHToGG", "VHToGG", "FCNC", "ttHiggs"]