Exemple #1
0
def ClusterParameterEstimator_4SLURM(yml=None,
                                     outputdir=None,
                                     task=None,
                                     isTest=False):
    config = Configuration()
    config.sbatch_partition = 'cp3'
    config.sbatch_qos = 'cp3'
    config.cmsswDir = os.path.dirname(os.path.abspath(__file__))
    config.sbatch_chdir = os.path.join(config.cmsswDir, outputdir)
    config.sbatch_time = '0-02:00'
    config.sbatch_memPerCPU = '2000'
    config.batchScriptsFilename = "slurmSubmission.sh"
    #config.environmentType = 'cms'
    config.inputSandboxContent = [
        "skimProducer.py" if task == "skim" else
        ("SiStripHitResol.py" if task == "hitresolution" else
         ("CPEstimator.py"))
    ]
    config.stageoutFiles = ['*.root']
    config.stageoutDir = config.sbatch_chdir
    config.inputParamsNames = ["inputFiles", "outputFile", "task", "sample"]

    analysisCfgs = os.path.join(config.cmsswDir, yml)
    config.inputParams = getTasks(task=task,
                                  analysisCfgs=analysisCfgs,
                                  cmsswDir=config.cmsswDir,
                                  stageoutDir=config.stageoutDir,
                                  isTest=isTest)
    shutil.copyfile(analysisCfgs, config.stageoutDir + "/analysis.yml")
    config.payload = \
    """
    echo ${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}
    if [[ "$task" == *"skim"* ]]; then
        cmsRun skimProducer.py inputFiles=${inputFiles} outputFile=${outputFile}
    elif [[ "$task" == "hitresolution" ]]; then
        cmsRun SiStripHitResol.py inputFiles=${inputFiles} outputFile=${outputFile}
    else
        cmsRun CPEstimator.py inputFiles=${inputFiles} outputFile=${outputFile}
    fi
    """

    submitWorker = SubmitWorker(config,
                                submit=True,
                                yes=True,
                                debug=True,
                                quiet=True)
    submitWorker()
    logger.warning(
        'Work still in progress for better workflow ...\n'
        'To hadd files and produce plots. Please run as follow when the jobs finish running\n'
        'python postprocessing.py --workdir {}\n'
        'squeue -u user_name  : allows you to check your submitted jobs status\n'
        .format(outputdir))
Exemple #2
0
def SlurmRunNano(path= None, outputDIR=None):
    config = Configuration()
    config.sbatch_partition = 'cp3'
    config.sbatch_qos = 'cp3'
    config.cmsswDir = os.path.dirname(os.path.abspath(__file__))
    config.sbatch_chdir = os.path.join(config.cmsswDir, outputDIR)
    config.sbatch_time = '0-06:00'
    sbatch_memPerCPU = '2000'
    #config.environmentType = 'cms'
    config.inputSandboxContent = ["gridpackTolheToNanoGen.sh"]
    config.stageoutFiles = ['*.root']
    config.stageoutDir = config.sbatch_chdir
    config.inputParamsNames = ["gridpack_path","NanoGEN"]
    config.inputParams = []
    
    for gridpack_path in glob.glob(os.path.join(os.path.dirname(os.path.abspath(__file__)), path, "*_tarball.tar.xz")):
        config.inputParams.append([gridpack_path, "%s%s"%(gridpack_path.split('/')[-1].split('_slc7')[0], ".root")])
        workDIR=os.path.dirname(os.path.abspath(__file__))
    config.payload = \
    """
            if [[ "${NanoGEN}" == *"200p00_125p00"* ]]; then
                eval suffix="lowmass_"
            else
                eval suffix=""
            fi

            if [[ "${NanoGEN}" == *"bbH"* ]]; then
                eval fragment="Hadronizer_TuneCP5_13TeV_aMCatNLO_2p_LHE_pythia8_cff.py"
            elif [[ "${NanoGEN}" == *"AToZHTo2L2B"* ]]; then
                eval fragment="Hadronizer_TuneCP5_13TeV_AToZHTo2L2B_${suffix}pythia8_PSweights_cff.py"
            else
                eval fragment="Hadronizer_TuneCP5_13TeV_HToZATo2L2B_${suffix}pythia8_PSweights_cff.py"
            fi
            pwd
            echo ${gridpack_path}
            echo ${NanoGEN}
            echo ${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}
            echo ${fragment}
            echo "****************************"
            cat ${workDIR}/python/${fragment}
            echo "****************************"
            bash gridpackTolheToNanoGen.sh ${fragment} ${NanoGEN} ${gridpack_path}
    """
    submitWorker = SubmitWorker(config, submit=True, yes=True, debug=True, quiet=True)
    submitWorker()