Skip to content

Commit

Permalink
Merge pull request #150 from pcdshub/ENH/makepeds_S3DF_more
Browse files Browse the repository at this point in the history
Enh/makepeds s3df more
  • Loading branch information
silkenelson authored Mar 30, 2023
2 parents f3fcdf7 + c6833a9 commit 5d4c6f0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
7 changes: 6 additions & 1 deletion scripts/elog_par_post
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import requests
from requests.auth import HTTPBasicAuth
import argparse
import socket

def readRunTable(fname):
runTableData={}
Expand All @@ -20,7 +21,11 @@ def postRunTableDict(runtable_data, experiment, run):
ws_url = args_url + "/run_control/{0}/ws/add_run_params".format(experiment)
print('URL:',ws_url)
user=experiment[:3]+'opr'
with open('/cds/home/opr/%s/forElogPost.txt'%user,'r') as reader:
elogPostFile='/cds/home/opr/%s/forElogPost.txt'%user
hostname=socket.gethostname()
if hostname.find('sdf')>=0:
elogPostFile='/sdf/group/lcls/ds/tools/forElogPost.txt'
with open(elogPostFile,'r') as reader:
answer = reader.readline()
r = requests.post(ws_url, params={"run_num": run}, json=runtable_data, \
auth=HTTPBasicAuth(experiment[:3]+'opr', answer[:-1]))
Expand Down
35 changes: 29 additions & 6 deletions scripts/makepeds
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ FFB=${FFB:=0}
QUEUE=${QUEUE:='xxx'}
INTERACTIVE=${INTERACTIVE:=0}

FFBQUEUES=('anaq' 'ffbh1q' 'ffbl1q' 'ffbh2q' 'ffbl2q' 'ffbh3q' 'ffbl3q' 'ffbh4q' 'ffbl4q')
ANAQUEUES=('psanagpuq' 'psanaq' 'psfehq' 'psfehprioq' 'psfehhiprioq')
FFBQUEUES=('anaq' 'ffbh1q' 'ffbl1q' 'ffbh2q' 'ffbl2q' 'ffbh3q' 'ffbl3q' 'ffbgpuq')
ANAQUEUES=('psanagpuq' 'psanaq')
SDFQUEUES=('milano' 'roma')
for FFBQUEUE in ${FFBQUEUES[@]}; do
if [[ $QUEUE == $FFBQUEUE ]]; then
FFB=1
Expand All @@ -177,6 +178,14 @@ for ANAQUEUE in ${ANAQUEUES[@]}; do
fi
done

for SDFQUEUE in ${SDFQUEUES[@]}; do
if [[ $QUEUE == $SDFQUEUE ]]; then
FFB=2
break
fi
done


if [[ $RUN == 0 ]]; then
if [[ $INTERACTIVE == 0 ]]; then
printf "Please enter a run number: \n"; read RUN
Expand All @@ -192,7 +201,7 @@ else
HUTCH=${EXP:0:3}
fi

if [[ $HOSTNAME =~ "psana" ]] || [[ $HOSTNAME =~ "drp-srcf" ]]; then
if [[ $HOSTNAME =~ "psana" ]] || [[ $HOSTNAME =~ "drp-srcf" ]] || [[ $HOSTNAME =~ "sdf" ]]; then
#echo $DIR/makepeds_psana $@
$DIR/makepeds_psana $@
else
Expand All @@ -204,22 +213,37 @@ else
echo calling on FFB system: makepeds_psana $@
echo ssh -Y $USER@psffb "$DIR/makepeds_psana $@"
ssh -Y $USER@psffb "$DIR/makepeds_psana $@"
elif [[ $FFB == 2 ]]; then
echo calling on SDF system: makepeds_psana $@
#we need to change paths here as directories are completely independent
DIR=`echo $DIR | sed s/cds/sdf/g | sed 's/\/reg\/g\/pcds/\/sed\/group\/lcls\/ds\/tools/g'`
echo ssh -Y $USER@s3dflogin ssh -Y psana "$DIR/makepeds_psana $@"
ssh -Y $USER@s3dflogin ssh -Y psana "$DIR/makepeds_psana $@"
else
echo calling on offline system: makepeds_psana $@
echo ssh -Y $USER@psana "$DIR/makepeds_psana $@"
ssh -Y $USER@psana "$DIR/makepeds_psana $@"
fi
fi

source pcds_conda
if [[ $HOSTNAME =~ "sdf" ]]; then
source /sdf/group/lcls/ds/ana/sw/conda1/manage/bin/psconda.sh
else
source pcds_conda
fi
elog_par_post --file pedestal -e "$EXP" -r $RUN

#if this is a default pedestal run, then do not post as this is handled in the pedestal scripts
#if this is a default pedestal run, then do not post as this is handled in takepeds
if [[ $elogMessage == 'DARK' ]] && [[ $ELOGTXT == '' ]] ; then
echo ---- Done processing pedestals for Run $RUN -----
exit 0
fi

if [[ $HOSTNAME =~ "sdf" ]]; then
echo Posting messages to the elog is currently not implemented from S3DF yet
exit 0
fi

PYCMD=LogBookPost.py
echo -- Now posting special message to elog --
echo -- $elogMessage --
Expand All @@ -232,7 +256,6 @@ if [[ `whoami` =~ "opr" ]]; then
else
$BINPATH $PYCMD -i "${HUTCH^^}" -u `whoami` -p pcds -e "$EXP" -t DARK -r $RUN -m "$elogMessage"&
fi
elog_par_post --file pedestal -e "$EXP" -r $RUN
else
echo $BINPATH $PYCMD -i "${HUTCH^^}" -e "$EXP" -t DARK -r $RUN -m "$elogMessage"
if [[ $HOSTNAME == 'cxi-monitor' ]]; then
Expand Down

0 comments on commit 5d4c6f0

Please sign in to comment.