Enabling dasgoclient
Goals of this page:
This page describes the steps required to install the Go implementation of DAS (Data Aggregation System) client for CMS data-services in your system (
dasgoclient).
For instructions on how to use DAS to locate data samples, refer to the
CMS WorkBook.
Step 1: Enabling voms-proxy
In order to access the data samples, it is first required to enable the
CERN Certificates, following the steps described on
this page:
Copy the certificate to a file named
myCert.p12
to the computer where you will run voms-proxy-init.
Extract your certificate (which contains the public key) and the private key:
openssl pkcs12 -in myCert.p12 -clcerts -nokeys -out $HOME/.globus/usercert.pem
- Extract the encrypted key:
openssl pkcs12 -in myCert.p12 -nocerts -out $HOME/.globus/userkey.pem
- You must set the mode on your userkey.pem file to read/write only by the owner, otherwise voms-proxy-init will not use it:
chmod 600 $HOME/.globus/userkey.pem
chmod 600 $HOME/.globus/usercert.pem
It is also required to make a local configuration to validate the signature on the certificates issued by the VOMS servers, as described on
this page.
Create a directory named
vomses inside the
/etc directory and then add the following text files inside it:
- One file named cms-lcg-voms2.cern.ch with the following line:
"cms" "lcg-voms2.cern.ch" "15002" "/DC=ch/DC=cern/OU=computers/CN=lcg-voms2.cern.ch" "cms" "24"
- One file named cms-voms2.cern.ch with the following line:
"cms" "voms2.cern.ch" "15002" "/DC=ch/DC=cern/OU=computers/CN=voms2.cern.ch" "cms" "24"
- One file named
voms-cms-auth.app.cern.ch.vomses
with the following line:
"cms" "voms-cms-auth.app.cern.ch" "443" "/DC=ch/DC=cern/OU=computers/CN=cms-auth.web.cern.ch" "cms"
Then, inside the
/etc/grid-security/vomsdir
directory, create another directory named
cms
, and add the following text files:
- One file named lcg-voms2.cern.ch.lsc with the following lines:
/DC=ch/DC=cern/OU=computers/CN=lcg-voms2.cern.ch
/DC=ch/DC=cern/CN=CERN Grid Certification Authority
- One file named voms2.cern.ch.lsc with the following lines:
/DC=ch/DC=cern/OU=computers/CN=voms2.cern.ch
/DC=ch/DC=cern/CN=CERN Grid Certification Authority
- One file named voms-cms-auth.app.cern.ch.lsc with the following lines:
/DC=ch/DC=cern/OU=computers/CN=cms-auth.web.cern.ch
/DC=ch/DC=cern/CN=CERN Grid Certification Authority
Finally, some certificate files must be included in the /etc/grid-security/certificates directory. The simplest way to do this is to log into a lxplus account and copy all files contained in that directory to the machine you want to use voms-proxy in. However, the effectiveness of this method is questionable.
To-do: find a smarter way to include such certificates.
Step 2: Installing Go compiler
Check if your system has already a Go compiler installed:
go version
should return something like
go version go1.21.5 linux/amd64
if you already have a Go compiler installed. If not, download the latest release of
Go available for your system, and proceed with the installation instructions:
- Remove any previous Go installation by deleting the
/usr/local/go
folder (if it exists):
rm -rf /usr/local/go
- Extract the archive you just downloaded into /usr/local, creating a fresh Go tree in /usr/local/go:
tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz
- Add
/usr/local/go/bin
to the PATH
environment variable. Include the following line in the .bashrc or .profile file:
export PATH=$PATH:/usr/local/go/bin
- Verify that you've installed Go by opening a command prompt and typing the following command:
go version
- Confirm that the command prints the installed version of Go.
Step 3: Install dasgoclient
Now to install dasgoclient itself, use git to clone the code available at
GitHub:
git clone "https://github.com/dmwm/dasgoclient.git"
cd dasgoclient
Inside the dasgoclient directory, follow the installation steps described at the
repository:
# one time operation, setup your GOPATH and download the following
go get github.com/dmwm/cmsauth
go get github.com/dmwm/das2go
go get github.com/vkuznet/x509proxy
go get github.com/buger/jsonparser
go get github.com/pkg/profile
# to build DAS Go client
make build_all
If the system in use is Linux, run the executable .
/dasgoclient_amd64 to use dasgoclient.
Step 4: Create calling function in .bashrc
Finally, we can make it easier to run the executable by creating a function in the
.bashrc
file:
dasgoclient(){
(cd $HOME/Documents/DAS/dasgoclient;
./dasgoclient_amd64 "$@";)}
When creating the function above, change the path to the dasgoclient directory according to where it is installed in your system.
Now, it should be ready to run dasgoclient! Simply type
dasgoclient
the terminal, followed by the desired query. For exemple,
dasgoclient -query=\"file dataset=/DoubleMuon/Run2018C-UL2018_MiniAODv2_NanoAODv9-v1/NANOAOD\".
If everything is set correctly, it should return a list of
.root
files.