...
Developing applications on your local machine is strongly recommended as it saves on headaches with using shared OPIs and allows for robust testing on a simulated machine before launching in production.
Info |
---|
This guide was written for unix machines, so if you have windows, you should consider setting up WSL through SLAC IT if you don't want to figure out the equivalent windows commands. if you don't want to do that, SLAC offers NoMachine as an option for running Linux, Stanford offers a virtual desktop that runs macOS, or you can install your own ubuntu in virtualbox. |
Getting Started
- Install conda if you don't have an existing installation
- Review conda environments, the Getting Started with Conda page, and this useful conda cheatsheet
- Review this git version control intro
- Brush up on environment variables
...
- Make a GitHub account and record your username (personal or work email is fine)
- Add your ssh key to your GitHub account
- Navigate to the #comp-general Slack channel
- Create a SLAC GitHub access workflow (the + with the lightning bolt at the bottomWorkflow button at the top near the channel name). An admin will review and grant you access
Info | ||
---|---|---|
| ||
Note for anyone using ARM Macs: prefix any conda command in the following sections with |
Installing PyDM
The basic steps can be found in the official documentation, but some quality of life improvements include:
...
- Run
conda install --update-all --force-reinstall -y -c conda-forge bmad
- Run
git clone git@github.com:slaclab/lcls-lattice.git
- This repo can live wherever, just remember where it lives
- You may need to request access
- Set the
LCLS_LATTICE
environment variable to wherever the repo in step 2 lives - Run
git clone git@github.com:slaclab/simulacrum.git
and remember where it lives - Append the path from step 4 to your python path in your environment variable file using
export PYTHONPATH="${PYTHONPATH}:path/to/simulacrum/repo"
Navigate to the newly cloned simulacrum repo and runpip install .
- Run
python <service directory>/<service>.py
for any service you want runningThis will eat a terminal tab. I strongly advise against backgrounding because you'll need to kill the process eventually, and if you background it you'll either need to remember the process ID or find it later
- For SRF work specifically, we typically only need the sc_rf_service so the command would be
python sc_rf_service/sc_rf_service.py
- All other services typically need the model service running with the appropriate beam line flag (
python model_service/model_service.py [lcls classic | cu_hxr | cu_spec | cu_sxr | sc_hxr | sc_sxr]
)
- All other services typically need the model service running with the appropriate beam line flag (
...
Once you're happy with whatever program you're working on and think that it's ready (and safe) to run on production, you can connect your GitHub repo
Setup
- Add your AFS ssh key to github
- ssh into srv01 (
ssh [username]@centos7.slac.stanford.edu > ssh mcclogin > ssh physics@lcls-srv01
) and activate your own profile - make a directory with the desired name (this isn't a clone so it doesn't make the directory for you)
- navigate to that directory and run
git init
- run
~/zacarias/utils/linkRepoToGithub/link_repo_to_github.sh -i
and follow the prompts - run
git pull origin main
and all of the files should now be there
...