CRAB (CMS Remote Analysis Builder)
CRAB es el software empleando por CMSSW para submitir jobs al
GRID. No es el único software, tambien se puede usar un plugin de ganga que desarrolló Andrés Osorio (el post-doc del grupo de altas energías) o se pueden usar scripts hechos por nosotros mismos.
En nuestro caso usaremos
CRAB (que es el software oficial en la colaboración para submitir jobs).
Prerrequisitos para usar CRAB
Para poder usar crab se necesita lo siguiente:
1. Obtener un certificado de
GRID. El certificado consta de varios archivos:
userkey.pem (la clave privada)
usercert.pem (la clave pública y el certificado en si)
El certificado son las credenciales que lo identifican ante el
GRID.
2. Estar registrado en una VO (Virtual Organization) de CMS. Esto permite tener acceso a todos los recursos disponibles para CMS.
3. Estar registrado en
SiteDB
Configurando el certificado
Una vez tienen el certificado en su cuenta tienen que hacer lo siguiente:
1. Descomprimen el archivo (ya que no esta en el formato de certificado todavía)
2. Crear el directorio .globus
3. Luego hacer los siguientes comandos:
openssl pkcs12 -in mycert.p12 -clcerts -nokeys -out $HOME/.globus/usercert.pem
openssl pkcs12 -in mycert.p12 -nocerts -out $HOME/.globus/userkey.pem
cd .globus
chmod 444 usercert.pem
chmod 400 userkey.pem
4. Borrar los siguientes archivos:
crab.tar.gz y mycert.p12
5. Para verificar que el certificado está funcionando correctamente hacer:
grid-proxy-init -debug -verify
Se debe de obtener algo como lo siguiente:
User Cert File: /home/inv-cmssw/.globus/usercert.pem
User Key File: /home/inv-cmssw/.globus/userkey.pem
Trusted CA Cert Dir: /etc/grid-security/certificates
Output File: /tmp/x509up_u55231
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Enter GRID pass phrase for this identity:
Creating proxy .++++++++++++
.........++++++++++++
Done
Proxy Verify OK
Your proxy is valid until: Thu Jun 17 01:33:41 2010
Una vez eso está preparado podemos comenzar a usar crab.
Usando crab
Vamos a usar crab para hacer una generación de datos crudos.
Para poder usar crab se necesitan dos cosas.
1. Un archivo de configuración de python (es el archivo al que ustedes le hacen cmsRun), que si recuerdan para hacer generación de datos crudos se llamaba: LMORaw_cfg.py
2. El archivo de configuración de crab; llamado crab.cfg, con ese archivo crab se encarga de submitir el job que quieren correr al grid. En ese archivo también configuran el número de eventos que quieren correr, donde correr, etc.
Creando el archivo de configuración de crab:
Guardamos un archivo llamado crab.cfg con la siguiente información:
[CRAB]
use_server = 1
jobtype = cmssw
scheduler = glite
[CMSSW]
datasetpath=none
pset=LM0Raw_cfg.py
total_number_of_events=6
events_per_job = 2
#number_of_jobs = 1
output_file = LM0_Gen_8E29_RAW.root
[USER]
return_data=1
email=andresib87@gmail.com
Vamos a la carpeta: CMSSW_3_1_4/src/simulacion
En esa carpeta creamos el directorio: crab
En ese directorio copiamos el archivo LMORaw_cfg.py que se encuentra en CMSSW_3_1_4/src/simulacion.
Tambien en el directorio crab guardamo el archivo: crab.cfg que creamos anteriormente.
Una vez ya tenemos esto preparado podemos correr crab.
Corriendo crab
Para correr crab hacemos lo siguiente:
cd CMSSW_3_1_4/src/
cmsenv
source /usr/local/CRAB_2_7_2_p1/crab.sh
cd
cd CMSSW_3_1_4/src/simulacion/crab
crab -create
crab -submit
crab -status
En la terminal tenemos que obtener lo siguiente.
Al hacer crab -create
[inv-cmssw@yali crab]$ crab -create
crab: Version 2.7.2 running on Tue Jun 22 22:58:39 2010 COT (03:58:39 UTC)
crab. Working options:
scheduler glite
job type CMSSW
server ON (use_server)
working directory /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/
crab: proxy lifetime 66:18 is different from voms extension lifetime6:36 for proxy /tmp/x509up_u55231
CRAB will ask ask you create a new proxy
Enter GRID pass phrase:
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Creating temporary proxy .................................................. Done
Contacting lcg-voms.cern.ch:15002 [/DC=ch/DC=cern/OU=computers/CN=lcg-voms.cern.ch] "cms" Done
Creating proxy .............................. Done
Your proxy is valid until Wed Jun 30 22:59:19 2010
crab: Your proxy will expire in:
55 hours 16 minutes 57 seconds
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Enter GRID pass phrase for this identity:
Creating proxy ............................................................... Done
Proxy Verify OK
Your proxy is valid until: Tue Jun 29 22:59:28 2010
A proxy valid for 168 hours (7.0 days) for user /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora now exists on myproxy.cern.ch.
crab: Required 2 events per job
crab: Required 6 events in total
crab: 3 jobs can be created, each for 2 for a total of 6 events
crab: Creating 3 jobs, please wait...
crab: Total of 3 jobs created.
Log file is /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/log/crab.log
Al hacer crab -submit
[inv-cmssw@yali crab]$ crab -submit
crab: Version 2.7.2 running on Tue Jun 22 23:01:41 2010 COT (04:01:41 UTC)
crab. Working options:
scheduler glite
job type CMSSW
server ON (default)
working directory /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/
crab: proxy lifetime 191:57 is different from voms extension lifetime192:15 for proxy /tmp/x509up_u55231
CRAB will ask ask you create a new proxy
Enter GRID pass phrase:
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Creating temporary proxy ................................... Done
Contacting voms.cern.ch:15002 [/DC=ch/DC=cern/OU=computers/CN=voms.cern.ch] "cms" Done
Creating proxy ....................... Done
Your proxy is valid until Wed Jun 30 23:01:50 2010
crab: Registering credential to the server : glidein-2.t2.ucsd.edu
crab: Your proxy lacks of retrieval and renewal policies for the requested server.
crab: Renew your myproxy credentials.
crab: Please renew MyProxy delegated proxy:
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Enter GRID pass phrase for this identity:
Creating proxy .................................................................................................................. Done
Proxy Verify OK
Your proxy is valid until: Tue Jun 29 23:02:04 2010
A proxy valid for 168 hours (7.0 days) for user /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora now exists on myproxy.cern.ch.
crab: Credential successfully delegated to the server.
crab: Starting sending the project to the storage glidein-2.t2.ucsd.edu...
crab: Task crab_0_100622_225838 successfully submitted to server glidein-2.t2.ucsd.edu
crab: Total of 3 jobs submitted
Log file is /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/log/crab.log
Al hacer crab -status
[inv-cmssw@yali crab]$ crab -status
crab: Version 2.7.2 running on Tue Jun 22 23:04:19 2010 COT (04:04:19 UTC)
crab. Working options:
scheduler glite
job type CMSSW
server ON (default)
working directory /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/
crab: proxy lifetime 191:57 is different from voms extension lifetime192:15 for proxy /tmp/x509up_u55231
CRAB will ask ask you create a new proxy
Enter GRID pass phrase:
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Creating temporary proxy ............................................................................ Done
Contacting lcg-voms.cern.ch:15002 [/DC=ch/DC=cern/OU=computers/CN=lcg-voms.cern.ch] "cms" Done
Creating proxy ........................................................................ Done
Your proxy is valid until Wed Jun 30 23:04:29 2010
crab:
ID STATUS E_HOST EXE_EXIT_CODE JOB_EXIT_STATUS
--------------------------------------------------------------------------------------------
1 Submitting
2 Submitting
3 Submitting
crab: 3 Total Jobs
>>>>>>>>> 3 Jobs Submitting
crab: You can also follow the status of this task on :
CMS Dashboard: http://dashb-cms-job-task.cern.ch/taskmon.html#task=andresib_crab_0_100622_225838_67tl3f
Server page: http://glidein-2.t2.ucsd.edu:8888/logginfo
Your task name is: andresib_crab_0_100622_225838_67tl3f
Log file is /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/log/crab.log
Monitoreando los resultados
Al hacer
crab -status podemos ver que al finalizar aparecen las direcciones de varias páginas web.
Tenemos que prestar atención a la que dice
CMS Dashboard.
Si entramos a ese enlace; que en el caso anterior sería:
http://dashb-cms-job-task.cern.ch/taskmon.html#task=andresib_crab_0_100622_225838_67tl3f
Vamos a poder ver el estado en el que se encuentran los jobs que mandamamos a correr al
GRID como se muestra en la siguiente imagen:
Obteniendo resultados con crab
Despues que a nuestro correo llego la notificación que lo que enviamos con crab ya termino de correr, abrimos nuestra cuenta en yali nuevamente y hacemos:
cd CMSSW_3_1_4/src/
cmsenv
source /usr/local/CRAB_2_7_2_p1/crab.sh
cd
cd CMSSW_3_1_4/src/simulacion/crab
crab -status
crab -getoutput
En la terminal tenemos que obtener lo siguiente:
Al hacer crab -status
[inv-cmssw@yali crab]$ crab -status
crab: Version 2.7.2 running on Wed Jun 23 09:52:49 2010 COT (14:52:49 UTC)
crab. Working options:
scheduler glite
job type CMSSW
server ON (default)
working directory /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/
crab: proxy lifetime 181:11 is different from voms extension lifetime181:29 for proxy /tmp/x509up_u55231
CRAB will ask ask you create a new proxy
Enter GRID pass phrase:
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Creating temporary proxy ...................................................... Done
Contacting voms.cern.ch:15002 [/DC=ch/DC=cern/OU=computers/CN=voms.cern.ch] "cms" Done
Creating proxy ...................... Done
Your proxy is valid until Thu Jul 1 09:52:59 2010
crab:
ID STATUS E_HOST EXE_EXIT_CODE JOB_EXIT_STATUS
--------------------------------------------------------------------------------------------
1 Done t2ce06.physics.ox.ac.uk 0 0
2 Done gw-6.ccc.ucl.ac.uk 0 0
3 Done t2ce06.physics.ox.ac.uk 0 0
crab: ExitCodes Summary
>>>>>>>>> 3 Jobs with Wrapper Exit Code : 0
List of jobs: 1-3
See https://twiki.cern.ch/twiki/bin/view/CMS/JobExitCodes for Exit Code meaning
crab: 3 Total Jobs
crab: You can also follow the status of this task on :
CMS Dashboard: http://dashb-cms-job-task.cern.ch/taskmon.html#task=andresib_crab_0_100622_225838_67tl3f
Server page: http://glidein-2.t2.ucsd.edu:8888/logginfo
Your task name is: andresib_crab_0_100622_225838_67tl3f
Log file is /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/log/crab.log
Si observamos en lo anterior la parte de
STATUS dice
Done para todos los jobs que enviamos, tambien la parte de *E_HOST * nos muestra en que sitio corrieron nuestros jobs (en este caso todos corrieron en inglaterra).
Al hacer crab -getoutput
[inv-cmssw@yali crab]$ crab -getoutput
crab: Version 2.7.2 running on Wed Jun 23 09:53:22 2010 COT (14:53:22 UTC)
crab. Working options:
scheduler glite
job type CMSSW
server ON (default)
working directory /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/
crab: proxy lifetime 191:59 is different from voms extension lifetime192:30 for proxy /tmp/x509up_u55231
CRAB will ask ask you create a new proxy
Enter GRID pass phrase:
Your identity: /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=andresib/CN=694873/CN=Andres Leonardo Cabrera Mora
Creating temporary proxy ................................................................................................................................. Done
Contacting lcg-voms.cern.ch:15002 [/DC=ch/DC=cern/OU=computers/CN=lcg-voms.cern.ch] "cms" Done
Creating proxy .......................................................................... Done
Your proxy is valid until Thu Jul 1 09:53:32 2010
crab: Starting retrieving output from server glidein-2.t2.ucsd.edu...
crab: Results of Jobs # 1 are in /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/res/
crab: Results of Jobs # 2 are in /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/res/
crab: Results of Jobs # 3 are in /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/res/
Log file is /home/inv-cmssw/CMSSW_3_1_4/src/simulacion/crab/crab_0_100622_225838/log/crab.log
El comando anterior descarga a nuestra cuenta los resultados obtenidos y tambien la salida que se obtuvo en las terminales donde corrieron nuestros jobs.
Resultados
Una vez todo lo anterior está completo; ya podemos mirar los archivos root generados; que son los archivos de salida de nuestro trabajo.
Podemos buscarlos desde nuestra terminal haciendo lo siguiente:
find -name *.root
y obtenemos la ubicación de los archivos root que son el resultado de correr en
GRID una generación cruda de datos
[inv-cmssw@yali crab]$ find -name *.root
./crab_0_100622_225838/res/LM0_Gen_8E29_RAW_1_1.root
./crab_0_100622_225838/res/LM0_Gen_8E29_RAW_2_1.root
./crab_0_100622_225838/res/LM0_Gen_8E29_RAW_3_1.root
El siguiente paso es:
Usando crab para guardar en un Storage Element
--
AndresCabrera - 16-Jun-2010