Using create-batch
create-batch를 이용해 간단한 경우 KCMS의 tier site들에서 cmssw job을 배치로 submit할 수 있습니다.
lxplus에서의 bsub, 서울시립대와 경북대에서 qsub, 그리고 KISTI에서 condor를 이용할 수 있고 필요한 세팅은 사이트별로 자동으로 적용됩니다.
root file의 list를 텍스트 파일로 만들어 넣어주어야 합니다. 데이터셋 퍼블리쉬 등과 같은 복잡한 기능이 필요하다면 crab을 이용하는 편이 더 좋습니다.
Installation
다운로드 받아서 바로 실행하거나 github repository를 통째로 가져와 사용하면 됩니다. KISTI의 경우 /opt/cmssw/hep-tools가 기본 $PATH에 들어 있으므로 추가 세팅이 필요 없습니다.
Download from Junghwan's github repository
wget https://raw.githubusercontent.com/jhgoh/hep-tools/master/create-batch
chmod +x create-batch
or checkout
git clone https://github.com/jhgoh/hep-tools bin
export PATH=$PATH:`pwd`/bin
Options
주요 옵션들과 설명은 명령어를 실행하면 볼 수 있습니다.
$ create-batch
create-batch : create pbs jobs
Mandatory options :
--jobName NAME Name of job
--fileList DATA_FILES File list text file
--maxFiles N Maximum number of files per job
--cfg CONFIG_FILE_cfg.py Configuration file
Optional :
--queue QUEUE_NAME Set the batch queue name
-n Do not submit jobs to batch
--transferDest OUTPUT_LOCATION OUTPUT DIRECTORY (/store will be assumed to SE)
-g Grid certificate is required
--maxEvent N Maximum number of events per job (-1 by default)
--transferFiles Additional files to transfer
Example
KISTI cluster에서 TTJets central MC 분석 코드 돌리기
xrd cms-xrdr.sdfarm.kr ls /cms/data/xrd/store/mc/Summer12_DR53X/TTJets_MSDecays_central_TuneZ2star_8TeV-madgraph-tauola/AODSIM/PU_S10_START53_V19-v1/00000 | awk '{print "root://cms-xrdr.sdfarm.kr/"$5}'> files.txt
create-batch --jobName MyJobTest --fileList files.txt --maxFiles 100 --cfg YOUR_ANALYSIS_JOB_cfg.py
실행하면
MyJobTest? 이라는 디렉토리가 생기고 이 안에 필요 파일들과 submitter script등이 만들어집니다. job.tgz파일과 run.sh을 수정하면 이후 submit할 job에 영향을 줄 수 있습니다. config file을 변경하고 싶으면 job.tgz를 풀어 수정 한 뒤 다시 압축해야 합니다.
KISTI의 경우 submit.jds파일이 추가 생성되고 이를 이용해 실제 job submission이 가능해집니다. 자동으로 Pool output module과
TFileService?에서 저장하는 root file들은 transfer_output_files에 추가되지만 그 외의 파일들이 있다면 직접 아래에서 보는 것과 같은 식으로 수정해 주어야 합니다. (condor expert에게 물어보세요)
# Job description file for condor job centralFull
executable = run.sh
universe = vanilla
arguments = $(Process)
log = condor.log
getenv = True
should_transfer_files = YES
when_to_transfer_output = ON_EXIT
output = job_$(Process).log
error = job_$(Process).err
transfer_input_files = job.tgz
transfer_output_files = CMSSW_5_3_20/src/GeneratorInterface/RivetInterface/test/centralFull/out.aida
transfer_output_remaps = "out.aida=out_$(Process).aida"
queue 32
저장 위치를 바꿀 때 --trasferDest옵션을 주면 됩니다.
Testing 필요!!! 해 보고 잘 동작하면 알려주세요
xrd cms-xrdr.sdfarm.kr mkdir /store/user/$USER/MyJobTest
create-batch --jobName MyJobTest --fileList files.txt --maxFiles 100 --cfg YOUR_ANALYSIS_JOB_cfg.py --transferDest /store/user/$USER/MyJobTest
TFileService?나
PoolOutputModule?에 의해 만들어진 파일 이외에 다른 아웃풋 파일을 가져와야 할 때는 --transferFiles옵션으로 지정해 주면 됩니다. (
MessageLogger?에서 detailed output을 가져와야 하는 경우, Rivet analysis에서 .aida파일을 가져와야 하는 경우가 해당됨)
JOBNAME=FileTransfTest
mkdir -p /cms/scratch/$USER/$JOBNAME
create-batch --jobName $JOBNAME --fileList files.txt --maxFiles 100 --cfg run_rivetAnalyzer_cfg.py \
--transferDest /cms/scratch/$USER/$JOBNAME --transferFiles rivet.aida,detailedInfo.log
job monitoring이나 resubmit등은 각 사이트별 명령어를 확인하고 사용하면 됩니다. submit시의 옵션에 대해서는 submit.sh를 참조하면 됩니다.
KISTI에서 user run script를 submit하기
create-batch 스크립트는 cmsRun 명령어에 최적화되어 있기 때문에 user script를 지원하지는 않습니다. 추후 필요시 이를 추가할 수 있습니다.
여기에서는 직접 jds 파일을 생성하는 것을 다룹니다.
executable = run.sh
universe = vanilla
arguments = $(Process)
log = condor.log
getenv = True
should_transfer_files = YES
when_to_transfer_output = ON_EXIT
output = job_$(Process).log
error = job_$(Process).err
transfer_input_files = run.sh,run_script.C
queue
Run script의 예제는 다음과 같습니다.
#!/bin/bash
cd $CMSSW_RELEASE_BASE
eval `scram runtime -sh`
cd -
root -b -q -l run_script.C
rm -rf /cms/scratch/jhgoh/JOBTEST
mkdir -p /cms/scratch/jhgoh/JOBTEST
chmod go+w /cms/scratch/jhgoh/JOBTEST
mv out.root /cms/scratch/jhgoh/JOBTEST/
root macro는 다음과 같이 만들었습니다.
void run_script()
{
TFile* f = TFile::Open("out.root", "RECREATE");
TH1F* h = new TH1F("h", "h", 100, -10, 10);
for ( int i=0; i<10000; ++i )
{
h->Fill(gRandom->Gaus());
}
h->Write();
f->Write();
}
job submit시에
--
JunghwanGoh - 19 Sep 2014