9.1.1 HTCondor Jobs¶
9.1.1.1 Overview¶
HTCondor is an open-source batch processing system widely used in high-energy physics computing. It supports large-scale computing clusters, provides high flexibility, and is especially suitable for high-throughput job scheduling. The Computing Center has migrated most local resources to HTCondor. Based on the actual cluster environment, the Computing Center has configured and optimized HTCondor and deployed the HepJob toolset to help users manage jobs. HepJob wraps optimizations for the IHEP cluster. Unless there are special requirements, users should use HepJob instead of native HTCondor commands.
9.1.1.2 HepJob Toolset¶
1) Environment Setup and Job Preparation¶
All HepJob commands are located in the following directory. It is recommended that you add this directory to your PATH.
- Bash users:
- Tcsh users:
Job files submitted to the HTCondor computing cluster must have executable permission. Use the following commands to check and grant file permissions.
- Check file permissions:
In this example, job.sh does not have executable permission. Run the following command to grant executable permission:
Check again. The extra x in the first column indicates executable permission.
2) Job Submission¶
Command format:
hep_sub [-h] [-g {physics,juno,dybrun,dyw,u07,offlinerun,pku,longq}]
[-p {virtual,local,ali}] [-u {vanilla,grid,docker}] [-o OUT]
[-e ERROR] [-n NUMBER] [-os OPERATINGSYSTEM]
[-t {atlasbm,hxmtbm,wljMC}] [-prio PRIORITY]
[-np NUMBERPROCESS] [-argu ARGUMENTS [ARGUMENTS ...]]
[-dir DIRECTORY] [-mem MEMORY] [-quiet] [-part PARTITION]
[-name NAME] [-slurm] [-site SITENAME] [-jf JOBFILE]
[-tf TRANSFERFILE] [-wn WORKNODE] [-wt WALLTIME]
jobscript
Common parameters:
jobscript: Job script name. It can be an absolute or relative path.
-g: User group used by the job. If not set, the user's primary group is used. For example, to use thejunogroup:
-p: Resource pool. Two resource pools are currently provided:localphysical machine resources andvirtualvirtual machine resources. If not specified,localis used by default.
-u: Job type. If not specified, the default isvanilla. Most local-cluster users do not need to specify this parameter. To run grid jobs, specify-u grid.
-
-o: Standard output file path. If not specified, a standard output file namedjob_name.outis generated in the current directory. -
-e: Standard error file path. If not specified, a standard error file namedjob_name.erris generated in the current directory. -
-l: Job log file path. If not specified, no log file is generated. The log file records job runtime status and is usually not meaningful for ordinary users. -
-os: Required operating system version. If not specified, the default is SL6. For example, to use SL7 resources:
-
-np: Number of CPU cores to request. This is needed for MPI jobs. -
-argu: Arguments passed to the job script. For example, if the job program argument is1:
-mem: Required memory size in MB. For example, to request more than 3 GB of memory:
If only -mem is specified, the job is scheduled to machines with the largest memory.
-
-site: Remote site where the job runs. -
Convenient templates: In addition to basic parameters,
hep_subprovides job templates for different experiments to simplify job submission. Currently, thecepcmpitemplate is provided, and more experiment templates will be added gradually. Use-tto specify the template. For example, to submit a CEPC MPI job:
Note
Using other parameters together with -t may affect how the -t template is applied.
3) Query Job Status¶
Command format:
hep_q [-h] [-u [USER]] [-i ID] [-run] [-p {virtual,local,ali}]
[-t {atlasbm,hxmtbm,wljMC}] [-st STARTTIME]
[-stat {run,idle,other} [{run,idle,other} ...]] [-slurm]
Common parameters:
-u: Query jobs of a specified user. The default is the current user.
Running hep_q -u without a username outputs information for the current user's jobs.
-i: Query a specified cluster ID or complete job ID. A job system job ID consists of two parts:clusteridandprocessid.clusteridis the job cluster number, andprocessidis the internal number in the job cluster. A complete job ID has the formatclusterid.processid, such as3745232.1.
Query job 3745232.1:
Query all jobs in job cluster 3745232:
-run: Query running jobs. Without this option, all jobs are output. Example output:
JOBID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD
5519.0 user1 04/11 15:11 0+00:00:00 I 0 0.0 myjob.sh
3656.0 user2 04/11 17:12 0+00:00:00 I 0 0.1 job.sh
JOBID is the job ID, OWNER is the job owner, SUBMITTED is the submission time, RUN_TIME is the runtime, ST is the current status, PRI is the priority, SIZE is virtual memory usage, and CMD is the job program name.
-t: Select a specific template. For example,cepcmpiusers need to add this parameter when querying jobs.
4) Delete Jobs¶
Command format:
hep_rm [-h] [-a] [-forcex] [-p {virtual,physical}] [-site SITENAME]
[-t {atlasbm,hxmtbm,wljMC}] [-name NAME] [-slurm]
[jobs [jobs ...]]
Common parameters:
jobs: Job IDs to delete. Multiple job IDs can be specified at the same time.
This command deletes all jobs in job cluster 3745232 and the job 3745233.0.
-a: Delete all jobs of the current user.
-t: Select a specific template. For example,cepcmpiusers need to add this parameter when deleting jobs.
-forcex: Force deletion of jobs inXstate. This parameter is used only for jobs inXstate. Such jobs are usually in deletion state because node failures prevent compute nodes and the scheduler from releasing connections normally. You can specify a job ID or use it together with-a. For example, if job3745232is inXstate:
5) Other¶
- All HepJob commands support
-hand--helpto view command descriptions.
9.1.1.3 Job and Resource Information¶
1) Wall Time and Job Limits¶
On a login node, run the following command to view wall-time limits by group. For example, to view the limits of the juno group:
| Experiment | Short job limit (hours) | Normal job limit (hours) | Mid job limit (hours) and resource usage limit |
|---|---|---|---|
| BES | <0.5 | <40 | <100:10% |
| JUNO | <0.5 | <20 | <100:10% |
| DYW | <0.5 | <10 | <100:10% |
| CEPC | <0.5 | <10 | <100:10% |
| ATLAS | <0.5 | <10 | <100:10% |
| CMS | <0.5 | <10 | <100:10% |
| HXMT | <0.5 | <14 | <100:10% |
| GECAM | <0.5 | <24 | <100:10% |
| LHCb | <0.5 | <100 | |
| LHAASO | <0.5 | <15 | <100:10% |
For experiments without mid-job settings, the default resource usage limit for submitted mid jobs is 1.
9.1.1.4 Usage Tips¶
1) Using Macros in Job Submission¶
Macros are provided by the scheduling system. Users can define rules during job submission. Currently, only basic variable passing is supported. Variable passing can be used for jobscript, -o, -e, and -argu. The syntax consists of % and {}:
Macros are useful for batch job submission. See Section 2 below for details. Macros can also be used to include job IDs, group names, and similar values in job file names. More features will be added later.
2) Batch Job Submission¶
Batch job submission submits multiple jobs at once and supports submitting a large number of jobs. Use -n to specify the number of jobs to submit in one batch.
%{ClusterId} is the job cluster ID. %{ProcId} is the internal ID in the job cluster. It starts from 0 and increases by 1 (0,1,2,3,...). Therefore, %{ProcId} can be used to match jobs with their output or to customize output names. Job scripts can use suffixes, prefixes, or substrings corresponding to %{ProcId} to distinguish jobs.
You can also pass %{ProcId} as an argument to the job script and use it to map other files, such as input data files:
Note: When submitting batch jobs, ensure that the job script exists and has executable permission. Avoid accidentally submitting an excessively large number of jobs, because heavy resource usage affects your own job priority.
- Example 1:
Prepare executable job scripts as follows:
real_job_20191204_0.sh
real_job_20191204_10.sh
real_job_20191204_1.sh
real_job_20191204_2.sh
real_job_20191204_3.sh
real_job_20191204_4.sh
real_job_20191204_5.sh
real_job_20191204_6.sh
real_job_20191204_7.sh
real_job_20191204_8.sh
real_job_20191204_9.sh
Because the script names all follow the format real_job_20191204_*.sh and the key characters are numbers increasing from 0, submit them with:
- Example 2:
If the job script names do not contain increasing numbers starting from 0, but still follow a pattern, for example:
real_job_20191201.sh
real_job_20191202.sh
real_job_20191203.sh
real_job_20191204.sh
real_job_20191205.sh
real_job_20191206.sh
real_job_20191207.sh
...
real_job_20191230.sh
real_job_20191231.sh
Prepare an additional parent job script and pass %{ProcId} to it. The parent script maps the process ID to the actual files. For the scripts above, whose names end with dates, prepare real_job_parent.sh:
#!/bin/bash
# get procid from command line
procid=$1
# map 0,1,2,...,30 to 1,2,3,...,31
sub_name_number=`expr $procid + 1`
# format 1,2,3,...,31 to 01,02,03,...,31
sub_name=`printf "%02d\n" $sub_name_number`
# run the real job script by the formatted file name
bash real_job_201912"${sub_name}".sh
Submit the jobs with:
3) Get Basic Job Information in a Job Program¶
- Job ID
The job ID can be obtained through the _CONDOR_IHEP_JOB_ID environment variable. This variable is valid only while the job is running. Example in bash:
- Execution node
The execution node can be obtained through _CONDOR_IHEP_REMOTE_HOST:
- Job submission time
The submission time can be obtained through _CONDOR_IHEP_SUBMISSION_TIME:
9.1.1.5 Recommendations and Notes for Experiments¶
1) BESIII¶
For standard BOSS jobs, use the simplified boss.condor command:
To specify job memory:
To use multiple CPU cores:
To adjust the maximum job runtime:
The following job types are provided: test, short, mid, long, and special.
To submit a batch of jobs with consecutive job numbers, use -n:
# Suppose user jobs job0, job1, and job2 exist.
# Use -n and "%{ProcId}" for batch submission.
$ boss.condor -n 3 job%"{ProcId}"
# "{ProcId}" replaces the number starting from 0 in the job name.
# Add % before it. This submits job0, job1, and job2 at once.
The job number must start from 0.
boss.condor also supports the "one-stop" job service, packaging SIM and REC into one overall job:
One submission completes three jobs.
The "one-stop" service also supports batch submission:
# Suppose user jobs sim0, rec0, ana0, sim1, rec1, and ana1 exist.
$ boss.condor -n 2 sim%"{ProcId}" rec%"{ProcId}" ana%"{ProcId}"
# This syntax submits two user jobs:
# the first job is sim0, rec0, ana0;
# the second job is sim1, rec1, ana1.
BESIII users should set the user group to physics when submitting other jobs:
For job query and deletion, see the previous sections.
2) CEPC MPI Jobs¶
Example MPI job submission:
Here, -t specifies the cepcmpi experiment job template, and -np is the requested number of cores. The full path of the job script must be provided.
For job query and deletion, see the previous sections.
3) COMET Jobs¶
For job submission, query, and deletion, refer to the BESIII instructions.
4) Other Experiments Without Special Instructions¶
Refer to the previous sections.
FAQ¶
See FAQ.
有问题?输入后跳转到对话页继续交流