Skip to content

Instantly share code, notes, and snippets.

@surhudm
Last active November 26, 2021 10:26
Show Gist options
  • Select an option

  • Save surhudm/d89d0a30fc72f06ba8428de9a3095d11 to your computer and use it in GitHub Desktop.

Select an option

Save surhudm/d89d0a30fc72f06ba8428de9a3095d11 to your computer and use it in GitHub Desktop.
LSST pipeline setup

Here I describe my experience in setting up the LSST pipeline Gen3 butler on an IUCAA server.

Set up the LSST stack

mkdir -p lsst_stack
cd lsst_stack
curl -OL https://raw.githubusercontent.com/lsst/lsst/master/scripts/newinstall.sh
bash newinstall.sh -ct
source loadLSST.bash
eups distrib install -t v23_0_0_rc2
curl -sSL https://raw.githubusercontent.com/lsst/shebangtron/master/shebangtron | python
setup lsst_distrib

Set up postgresql

The LSST gen3 pipeline requires a database to be set up. This can be either done with sqlite3 (but may not be suited for heavy processing). Sqlite3 database creation is as simple as creating just an empty file with that name. But here I describe the setup of a postgresql server. This does not require any root password.

./configure --prefix=$HOME
make -j 20
make install
cd contrib
make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH=$HOME/lib

Now initialize the database, change the ~/gen3_db to the location you want your database to reside

$HOME/bin/initdb -D ~/gen3_db

Open the file ~/gen3_db/postgresql.conf, and change listen addresses to the appropriate address that you need to listen from.

listen_addresses = '*' 
max_connections = 1200

In pg_hba.conf, add the following line (assumes your infiniband network is on 192.168.1.XXX addresses, otherwise change appropriately.

host    all            all           192.168.1.0/24       md5

Now start the postgresql server:

$HOME/bin/pg_ctl -D ~/gen3_db -l logfile start

First create the database location, then open it in psql, add a btree_gist extension and also add a password:

createdb gen3
~/bin/psql gen3
gen3=# CREATE EXTENSION btree_gist
gen3=# \password

Now that this has been setup, you can change all the trust authentication in ~/gen3_db/pg_hba.conf to md5. This way all access will now be password based. You can setup the password using the environment variable $PGPASSWORD or write it in clear text in a $HOME/.pgpass file.

export PGPASSWORD=YourPassword

Create a gen3 repository

Now let us create a space for the gen3 repository.

mkdir $HOME/gen3_repo

Setup butler and register the instrument (in our case Subaru HSC).

echo "registry:" > reg.yaml
echo "  db: postgresql://username@server_ip_address/gen3" >> reg.yaml

DIR=$HOME/gen3_repo
butler create $DIR --seed-config reg_2018.yaml --override
butler register-instrument $DIR lsst.obs.subaru.HyperSuprimeCam

Data finally!

Advanced repositories: gen3 shared repo admin tools

Next we can use some butler-admin tools to do some ingestion of data in to this repository. The repository however is invitation only at this moment.

mkdir $HOME/github
cd $HOME/github
git clone git@github.com:lsst-dm/gen3_shared_repo_admin.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment