General informations
HTCondor is a powerful yet complex batch system: in this page you'll find basic informations on how to submit and manage jobs, but for a fully fledged user manual you can find all the details on the official HTCondor documentation.
All the command you will find on the user guide need to be executed on the frontend node, the one you'll land via ssh (htc-fe.rmlab.infn.it)
Submit a job
$ condor_submit example.sub
...
The .sub file is called "job descriptor" where you can write all the informations related to the job you want to submit (universuniverse, job numbers, parameters, etc)
...
* Executable = foo.sh
* Universe = vanilla
Error = bar/err.$(ClusterId).$(ProcId)
Output = bar/out.$(ClusterId).$(ProcId)
* Log = bar/log.$(ClusterId).$(ProcId)
arguments = arg1 arg2 $(ProcId)
request_cpus = 1
* request_memory = 1024
request_disk = 10240
should should_transfer_files = yesno
* Queue 1
* = required fields
You can also submit many similar jobs with one queue command
For reference you can have a look at job submission manual or at science job example
...
Parametri:
Executable = Job to be executed
Universe = choose between vanilla/docker/parallel
Error, Output, Log = where to write log files. Those folders need to be existent exist before submitting the job
Arguments = Argomenti passati come array di stringhe al jobStrings array to be provided to the job itself.
request_* = le caratteristiche richieste per il workernode – PER UN FUNZIONAMENTO IDEALE DELL’INFRASTRUTTURA SONO OBBLIGATORIE
Queue = La direttiva queue istruisce condor ad eseguire un determinato numero di job. Il default è 1. Ogni job avrà una variabile $ProcId incrementale.
Universe
[...] = Job requirements
Queue = This is the submission request, here you can specify the number of job to be executed
Require a specific operative system environment
To provide the highest compatibility with scientific frameworks, the cluster is composed of heterogeneous nodes running Ubuntu 24 and AlmaLinux 9.
Unless explicitly requested, jobs may be executed on any available node — this is useful for jobs that use self-contained environments, such as Python virtual environments or Docker/Singularity containers.
To explicitly request that a job run on a specific operating system, simply add the following line to your job file:
Requirements = (OpSysName == "<OS Name>")The allowed values for <OS Name> are "AlmaLinux" and "Ubuntu".
Universe
A universe represent an execution environment for the job: HTCondor support several universes Un universo è un ambiente di esecuzione di un job, HTCondor gestisce più tipi di universi:
* vanilla
grid
java
scheduler
local
* parallel
vm
container
* docker
* = Supported by rm2lab htc cluster
Il vanilla universe è quello di base, per lanciare docker container verrà utilizzato l’universo docker.
Docker Universe
Docker Universe
To run jobs using a docker image you can write a job descriptor as follow Per utilizzare i container all’interno del cluster, si può utilizzare un submit file come il seguente :
---------------------------------------------------------
universe = docker
docker_image = ubuntu:20.04
executable = /bin/cat
arguments = /etc/hosts
transfer_input_files = input.txt
transfer_output_files = output.txt
should_transfer_files = YES
when_to_transfer_output = ON_EXIT
output = out.$(ClusterId).$(ProcId)
error = err.$(ClusterId).$(ProcId)
log = log.$(ClusterId).$(ProcId)
request_cpus = 1
request_memory = 256M
request_disk = 1024M
queue 1
---------------------------------------------------------
dove il campo docker_image specifica l’immagine docker da scaricare da Docker Hub.
Il campo should_transfer_files specifica se copiare i file nel container, i campi
transfer_input_files e transfer_output_files quali files/directory trasferire dal/nel container. Opzioni non necessarie se i file si trovano sui volumi condivisi.
Trovate maggiori informazioni qui:
https://htcondor.readthedocs.io/en/latest/users-manual/docker-universe-applications.html
...
L'universo Parallel permette di sottomettere jobs paralleli. Lo scheduler aspetta di avere le risorse libere prima di eseguire i job su tutti gli slot richiesti.
universe = parallel
executable = foo.sh
log = logfile
input = infile.$(Node)
output = outfile.$(Node)
error = errfile.$(Node)
machine_count = 2
request_cpus = 8
should_transfer_files = IF_NEEDED
when_to_transfer_output = ON_EXIT
queue
la direttiva should_transfer_files = IF_NEEDED
In caso si voglia utilizzare Openmpi è necessario utilizzare uno script per permettere la comunicazione tra i vari jobs.
Tale script si trova preconfigurato sul nodo submitter nella cartella /OpenmpiScript del nodo submitter (192.168.0.102). Copiare il file .sh nella stessa folder del file di sottomissione.
Le seguenti direttive indicano rispettivamente quanti processi paralleli lanciare e quante cpu assegnare per processo:
...
Further details about docker universe applications can be found on the official manual
Parallel Universe
Parallel universe allows you to submit parallel jobs using mpi: the scheduler will wait for all the needed resources to be available before submitting the job.
To use OpenMPI you need to use a wrapper script instead of your executable: the executable, compiled with openmpi, needs to be passed as first argument on transferred using the "trasfer_input_file" directive.
universe = parallel
executable = openmpiscript.sh
arguments =
Nel file di sottomissione è necessario quindi specificare come eseguibile lo script preconfigurato e come argomento il processo buildato mpi.
...
mpitest
should_transfer_files
...
=
...
yes
transfer_input_files
...
=
...
mpitest
when_to_transfer_output
...
=
...
on_exit_or_evict
output
...
=
...
logs/out.$(NODE)
error
...
...
=
...
logs/err.$(NODE)
log
...
...
=
...
logs/log
machine_count = 15
request_cpus = 10
queue
The openmpiscript.sh is locate in the /scripts folder of the frontend node, it needs to be copied in the folder where you submit the job
The following directives indicate how many parallel processes need to be run and how many cpus are needed for each process.
machine_count = 15
request_cpus = 10queue
Detailed info about parallel applications can be found here
Jobs with GPU
To execute a job that needs a GPU you can specify "request_GPUs = 1" in the job submission file.Trovate maggiori informazioni qui:
https://htcondor.readthedocs.io/en/latest/users-manual/parallel-applications.html
Manage a job
$ condor_rm clusterID.procIDRimuove il job identificato da clusterID.procID (vedere [Submit a job])
Removes a specific job
$ condor_hold clusterID.procID
Mette in stato di hold il job, tale job non sarà schedulato fino a che non verrà rilasciato. Quando viene utilizzato il comando condor_hold il nodo che lo sta girando verrà liberato.
Put a job on hold, it will not be executed until released
$ condor_release clusterID.procID
Il job esce dallo stato di hold per essere nuovamente schedulato ritornando nello stato di Idle fino a che non sarà possibile farlo eseguire
Release a previously hold job.
Queue check
...
$ condor_q <parameters>
The condor_q parameters allows you to check a job / queue status
Parameters:Il commando condor_q consente di controllare lo stato dei jobs sul cluster.
Opzioni
-nobatch Mostra un Display a job per linea (disattiva l’opzione -batch)line
-global Mostra tutte le code attive nel pool
-hold Shows all the active queues in the cluster
-hold Restituisce informazioni sui job in stato di hold (usare in caso anche -analyze o Shows information about job on hold (you can also use -analyze or --better-analyze parameters)
-run Restituisce Shows info sui on running job running, deve essere usata con , to be used with -nobatch