From T3_KR_KNU
Jump to: navigation, search
(HTCondor Batch System 사용법)
(Using x509 proxy)
Line 174: Line 174:
 
htcondor 에서 그리드 인증이 필요한 경우
 
htcondor 에서 그리드 인증이 필요한 경우
  
 +
* X509_USER_PROXY를 설정하여 proxy 파일의 위치를 다음과 같이 연산노드에서 접근 가능한 위치로 변경해야합니다.
 +
export X509_USER_PROXY=/u/user/(userid)/proxy.cert
 +
 +
* voms-proxy-info 명령을 이용해서 proxy가 올바른 위치에 생성되었는지 반드시 확인하세요.
 +
 +
* 자세한 내용은 다음 링크를 참고하시기 바랍니다.
 
https://batchdocs.web.cern.ch/tutorial/exercise2e_proxy.html
 
https://batchdocs.web.cern.ch/tutorial/exercise2e_proxy.html
  

Revision as of 06:13, 21 September 2023

1 HTCondor Batch System 사용법

1.1 Tier-3 HTCondor/CentOS7 UI 접속하기

다음과 같이 터미널을 열어서 원격로그인(SSH)으로 접속합니다.

 ssh -X username@cms.knu.ac.kr

1.2 Job submit

Job submit을 위해서는 다음과 같이 "condor_submit" 명령어를 사용합니다.

  • sleep.sh - 테스트 코드
#!/bin/bash

TIMETOWAIT="10"
echo "sleeping for $TIMETOWAIT seconds"
/bin/sleep $TIMETOWAIT
  • sleep.sub - 작업 명세 파일
executable              = sleep.sh
log                     = sleep.log
output                  = outfile.txt
error                   = errors.txt
should_transfer_files   = Yes
when_to_transfer_output = ON_EXIT
queue
  • job submit
condor_submit sleep.sub

1.3 Job 상태 확인

작업의 상태 확인을 위해서는 "condor_q"명령을 사용합니다.
전체 작업현황을 확인하려면 다음과 같이 실행하면 됩니다.

$ condor_q
-- Schedd: cms02.knu.ac.kr : <155.230.23.72:9618?... @ 07/30/20 16:49:47
OWNER BATCH_NAME    SUBMITTED   DONE   RUN    IDLE  TOTAL JOB_IDS
user001 ID: 51       7/30 16:47      _    100      _    100 51.0-99

Total for query: 100 jobs; 0 completed, 0 removed, 0 idle, 100 running, 0 held, 0 suspended
Total for hanbi: 100 jobs; 0 completed, 0 removed, 0 idle, 100 running, 0 held, 0 suspended
Total for all users: 100 jobs; 0 completed, 0 removed, 0 idle, 100 running, 0 held, 0 suspended

1.4 Job 삭제

submit 한 작업을 중간에 취소하기 위해서는 "condor_rm" 명령을 사용합니다.

condor_rm <JOBID>

모든 내 작업을 삭제하려면 다음 명령을 사용합니다.

condor_rm <UserID>

1.5 작업 명세 파일 예제

  • 단독 실행
$ science.exe infile-A.txt infile-B.txt outfile.txt
  • science1.sub - 1개 작업 실행
# science1.sub -- run one instance of science.exe
executable              = science.exe
arguments               = "infile-A.txt infile-B.txt outfile.txt"
transfer_input_files    = infile-A.txt,infile-B.txt
should_transfer_files   = IF_NEEDED
when_to_transfer_output = ON_EXIT
log                     = science1.log
queue
  • science2.sub - 40개 작업 실행, Process 번호로 input, output 파일 구분
# science2.sub -- run 40 instances of science.exe
executable              = science.exe
arguments               = "infile-$(Process)A.txt infile-$(Process)B.txt outfile$(Process).txt"
transfer_input_files    = infile-$(Process)A.txt,infile-$(Process)B.txt
should_transfer_files   = IF_NEEDED
when_to_transfer_output = ON_EXIT
log                     = science2.log
queue 40
  • science3.sub - 100개 실행 예제. Process 번호로 작업 디렉토리 구분
# science3.sub -- run 100 instances of science.exe, with
#  unique directories named by the $(Process) macro
executable              = science.exe
arguments               = "infile-A.txt infile-B.txt outfile.txt"
should_transfer_files   = IF_NEEDED
when_to_transfer_output = ON_EXIT
initialdir              = run$(Process)
transfer_input_files    = infile-A.txt,infile-B.txt
log                     = science3.log
queue 100
  • geant4 실행 예제
$ cat run_geant4.sh
#!/bin/bash

source /cvmfs/sft.cern.ch/lcg/contrib/gcc/8.3.0/x86_64-centos7/setup.sh
source /cvmfs/geant4.cern.ch/geant4/10.6/x86_64-centos7-gcc8-optdeb/CMake-setup.sh
./$*
$ cat geant4.sub
Universe = vanilla
Log        = geant4_$(ClusterId).log
Output     = geant4_$(ClusterId)_$(ProcId).out
Error      = geant4_$(ClusterId)_$(ProcId).err
Should_Transfer_Files = Yes
When_To_Transfer_Output = ON_EXIT

#Executable = <wrapper_script>.sh
Executable = run_geant4.sh
Transfer_Executable = True
#Arguments = <Geant4 executable> <input file(s)>
Arguments = exampleB1 exampleB1.in
#Transfer_Input_Files = <Geant4 executable>,<input file(s)>
Transfer_Input_Files = exampleB1, exampleB1.in

Queue

위의 예제를 위한 geant4 설치 및 테스트는 여기를 클릭하세요.

1.6 Submitting Multiple Jobs with HTCondor

복수의 input 파일을 이용하여 동시에 다수의 작업을 처리하고 싶다면 AN INTRODUCTION TO USING HTCONDOR(Todd Tannenbaum) 에서 52p에서부터 72p의 내용을 참고하시기 바랍니다

1.7 Singularity를 이용하여 Scientific Linux 6 코드 실행

submit description file에 아래 내용을 추가합니다.

+ContainerOS = "SL6"

혹은 선호하는 이미지가 있다면 아래와 같이 기입합니다.

+SingularityImage = "/cvmfs/singularity.opensciencegrid.org/cmssw/cms:rhel6-m202001

1.8 create-batch 사용

create-batch를 경북대 부분을 condor로 변경하여 create-batch2라는 이름으로 저장해두었습니다. condor에서는 --queue cms 옵션은 필요하지 않습니다.
torque system을 당분간 운영하는 기간동안 임시로 이렇게 사용하고 condor로 완전히 전환이 되면 create-batch에 수정사항을 반영요청하겠습니다.

1.9 전체 작업 현황 살펴보기

$ condor_status -schedd
Name            Machine         RunningJobs   IdleJobs   HeldJobs

ce01.knu.ac.kr  ce01.knu.ac.kr            2          0          0
cms02.knu.ac.kr cms02.knu.ac.kr         211       1134          0

                TotalRunningJobs      TotalIdleJobs      TotalHeldJobs


         Total               213               1134                  0

1.10 주의사항

  • 작업이 실행 중에 죽는 경우

Dynamic slot으로 인해서 일부 연산노드에서는 기본 설정에서 메모리 부족으로 작업이 죽는 경우가 발생할 수 있습니다.
다음과 같이 requset_memory 옵션으로 요구 메모리를 지정해주시기 바랍니다. 특히 많은 메모리를 사용하는 작업이라면 반드시 지정해 주어야합니다.

request_memory = 4 GB
  • submit 한 작업도 속성을 다음과 같이 변경할 수 있습니다.
$ condor_hold {job_id}
$ condor_qedit {job_id} RequestMemory 4096
$ condor_release {job_id}

1.11 Using x509 proxy

htcondor 에서 그리드 인증이 필요한 경우

  • X509_USER_PROXY를 설정하여 proxy 파일의 위치를 다음과 같이 연산노드에서 접근 가능한 위치로 변경해야합니다.
export X509_USER_PROXY=/u/user/(userid)/proxy.cert
  • voms-proxy-info 명령을 이용해서 proxy가 올바른 위치에 생성되었는지 반드시 확인하세요.
  • 자세한 내용은 다음 링크를 참고하시기 바랍니다.

https://batchdocs.web.cern.ch/tutorial/exercise2e_proxy.html

1.12 참고 자료