From 123f18c88dc12dd8676580a9e5c0660c1ea65ef6 Mon Sep 17 00:00:00 2001 From: Dmitry Ozerov Date: Fri, 19 Jun 2020 19:52:47 +0200 Subject: [PATCH] retrieve according to specified rate_multiplicator --- scripts/retrieve_detector_data.sh | 50 ++++++++++--------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/scripts/retrieve_detector_data.sh b/scripts/retrieve_detector_data.sh index d1b38c0..5d7083a 100755 --- a/scripts/retrieve_detector_data.sh +++ b/scripts/retrieve_detector_data.sh @@ -2,27 +2,33 @@ if [ $# -lt 3 ] then - echo "Usage : $0 detector_name start_pulse_id end_pulse_id" - echo "Example : $0 JF07T32V01 11709404000 11709405000" - echo "Optional parameters: output_file_name" + echo "Usage : $0 detector_name start_pulse_id end_pulse_id " + echo "Example : $0 JF07T32V01 11709404000 11709405000 " + echo "Optional parameters: output_file_name rate_multiplicator" exit fi DETECTOR=$1 START_PULSE_ID=$2 STOP_PULSE_ID=$3 +PULSE_ID_STEP=1 # by default assume 100Hz echo "Request to retrieve : $@ " echo "Started : "`date` date1=$(date +%s) -if [ $# == 4 ] +if [ $# -ge 4 ] then OUTFILE=$4 else OUTFILE=/gpfs/photonics/swissfel/buffer/test.${START_PULSE_ID}-${STOP_PULSE_ID}.h5 fi +if [ $# -eq 5 ] +then + PULSE_ID_STEP=$5 +fi + case ${DETECTOR} in 'JF01T03V01') NM=3 @@ -37,37 +43,18 @@ case ${DETECTOR} in NM=1 esac -#8 replay workers per core -#coreAssociated_replay=(20 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 22 23 23 23 23 23 23 23 23) -#4 replay workers per core -coreAssociated_replay=(7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 12 13 13 13 13 14 14 14 14) -#2 replay workers per core -#coreAssociated_replay=(20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35) -#1 replay workers per core -#coreAssociated_replay=(4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35) - -#coreAssociated="7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14" coreAssociated="7,8,9,10,11,12,13,14" -touch /tmp/detector_retrieve.log /tmp/detector_retrieve_replay.log +touch /tmp/detector_retrieve.log cd /gpfs/photonics/swissfel/buffer/ -PREVIOUS_STILL_RUN=1 -while [ ${PREVIOUS_STILL_RUN} = 1 ] +PREVIOUS_STILL_RUN=0 +while [ ${PREVIOUS_STILL_RUN} == 0 ] do sleep 15 # we need to sleep at least to make sure that we don't read from CURRENT file - PREVIOUS_STILL_RUN=0 -# ps -fe | grep "/usr/bin/sf_replay " | grep -v grep | grep sf_ > /dev/null - PREVIOUS_STILL_RUN1=1 - ps -fe | grep "/usr/bin/sf_writer " | grep -v grep | grep sf_ > /dev/null - PREVIOUS_STILL_RUN2=$? - if [ ${PREVIOUS_STILL_RUN1} != 1 -o ${PREVIOUS_STILL_RUN2} != 1 ] - then - PREVIOUS_STILL_RUN=1 -# echo "Previous retrieve is not yet finished ${PREVIOUS_STILL_RUN1} ${PREVIOUS_STILL_RUN2}" -# sleep 30 - fi + ps -fe | grep "bin/sf_writer " | grep -v grep | grep sf_writer > /dev/null + PREVIOUS_STILL_RUN=$? # not found == 1 done date2=$(date +%s) @@ -75,12 +62,7 @@ echo -n "Waited Time : " echo $((date2-date1)) | awk '{print int($1/60)":"int($1%60)}' echo "Started actual retrieve : "`date` -#for M in {00..31} -#do -# taskset -c ${coreAssociated_replay[10#${M}]} /usr/bin/sf_replay ${PROCESS_PID} ${DETECTOR} M${M} ${M} ${START_PULSE_ID} ${STOP_PULSE_ID} >> /tmp/detector_retrieve_replay.log & -#done - -taskset -c ${coreAssociated} /usr/bin/sf_writer ${OUTFILE} /gpfs/photonics/swissfel/buffer/${DETECTOR} ${NM} ${START_PULSE_ID} ${STOP_PULSE_ID} >> /tmp/detector_retrieve.log & +taskset -c ${coreAssociated} /usr/bin/sf_writer ${OUTFILE} /gpfs/photonics/swissfel/buffer/${DETECTOR} ${NM} ${START_PULSE_ID} ${STOP_PULSE_ID} ${PULSE_ID_STEP}>> /tmp/detector_retrieve.log & wait