Skip to content

Commit 5e52f07

Browse files
authored
Migration of both calc and batch to new hardware (#466)
* updates to makeConfig * updates to distributed processing to align with newest wmpl * add a comment to explain what the code does * remove json db * update consolidation to handle sqlite dbs * remove unused function * create data for daily report * remove unused file * update to call new version of reportOfLatestMatches * add test variables * mildly improve doco * put test logs in the right CW log group * handle missing log groups better * extra value in TrajQualityParams * bugfixes revealed in testing * fix issues in reportOfLatestMatches * put container dbs in a sensible place * catch logging errors * tidy up file locations * simplify calcserver start up * sorting out errors in container logging * update container logging info * avoid unnecessary error * fix bugs in log capture process * add MAX_STNS so i can experiement with limits * add logging. Add max_stns to constraints and set to 9999 push logs to s3 copy calcserver logs to ukmonhelper * don't pull or push the databases from S3 during distribution but do back them up after consolidation * catch error if trajpickle can't be found * set rundate more safely move some processes into nightlyJob to make testing easier * tidy up backup file names and housekeep backup folder * move some processes from findAllMatches to nightlyJob to make testing easier * support for testing of createExecReplot * pass testmode to createExecReplot * ensure logs are unique and capture container logs * realigning createFireballPage with prod. Updating gitignore * remove verbosity flag from one tar operation * fixup to handle new style log with datestamps * get privip after restarting calcserver * temporarily don't run rerunFailedLambdas in test * update to work in a test env too * add 'period' to the match summary api * add period to match summary api * re-enabling rerunFailedLambdas * quieten an S3 transfer * include the foldername when reporting on container progress * put daily trajdb in a safe place * be more specific when finding the daily log * only tar the current container logs * save daily obsdb in the right place * rename ec2.tf to calcserver.tf * quieten some s3 transfers * rename ec2.tf in my acct to ukmonhelper_ec2.tf to make it clearer what it is * update SSM params to reflect new serverid * bugfix in distributeCandidates - using wrong path * add newline to getCostMetrics * weird bug in statsToMqtt * bugfix in update_wmpl.sh for traj container * Script to create an AMI for the calcengine * exclude test data when syncing from s3 * writing databases and logs to the wrong target * bad test on istest * typo in serveruserid * adding to server migration notes * purge old rawcsvs and fullcsvs older than 180 days * improved housekeeping of old data * make sure we scoop up data for 31/12 * stop creation of an unused set of files * change default locations for container data * put container logs in the right place * update dockerfile syntax * change locations of test container data and output * remove incorrect comments * Add script to clean up deleted/duplicate trajs * simplify the stats gathering and move to python fix bug in getMatchStats * comment out unused files * update reportOfLatestMatches to exclude deleted trajectories * add scp to requirements * add SQL database maintenance to dataMaintenance * incorrect default for datadir * update call to pymysql.connect * ensure consolidateOutput rerunnable for prior years * upgrading WMPL * update gitignore a bit * bugfix to catch data from 31/12 each year * add paramiko to dependencies for matchPickle to support wmpl upgrade * update getpickle to newest WMPL * bugfix in api tests * bugfix - changes to dailydb not saved * improvements to process to cleanup deleted trajs * after merging, check and remove any duplicate trajectories from the sqlite db and disk * Adding version * bump version 2025.11.1 -> 2026.04.0 * update files containing vesion * bump version 2026.04.0 -> 2026.04.1 * unmangling side effets of automerge * correct usage message * decommission old calcserver and add new batchserver * add calcserver IP to ssm variables and use it in scripts * Update my branch with the latest from master (#436) * Update version (#433) * remove disused code * update livestream to accept normal RMS filenames * search dialog - fix bug and set default date range * small change to explain default dates * improvement in live image search * remove redundant file * update deployment scripts * improvements in routine to convert GMN report to pandas * more analysis of gmn data * Update the terraform a little * remove hardcoded reference to ec2-user * add SERVERUSERID env /ssm variable for calcserver user id * update container for new distrib-processing method * use calcserver SERVERUSERID variable * support for test ECS containers * fix paths in deployment scripts * remove unused file * missed some templates * update dev/test env settings * remove disused file * make sure paths are expanded * fixing various config issues * updates to makeConfig * updates to distributed processing to align with newest wmpl * add a comment to explain what the code does * remove json db * update consolidation to handle sqlite dbs * remove unused function * create data for daily report * remove unused file * update to call new version of reportOfLatestMatches * add test variables * mildly improve doco * put test logs in the right CW log group * handle missing log groups better * extra value in TrajQualityParams * bugfixes revealed in testing * fix issues in reportOfLatestMatches * put container dbs in a sensible place * catch logging errors * tidy up file locations * simplify calcserver start up * sorting out errors in container logging * update container logging info * avoid unnecessary error * fix bugs in log capture process * add MAX_STNS so i can experiement with limits * add logging. Add max_stns to constraints and set to 9999 push logs to s3 copy calcserver logs to ukmonhelper * don't pull or push the databases from S3 during distribution but do back them up after consolidation * catch error if trajpickle can't be found * set rundate more safely move some processes into nightlyJob to make testing easier * tidy up backup file names and housekeep backup folder * move some processes from findAllMatches to nightlyJob to make testing easier * support for testing of createExecReplot * pass testmode to createExecReplot * ensure logs are unique and capture container logs * realigning createFireballPage with prod. Updating gitignore * remove verbosity flag from one tar operation * fixup to handle new style log with datestamps * get privip after restarting calcserver * temporarily don't run rerunFailedLambdas in test * update to work in a test env too * add 'period' to the match summary api * add period to match summary api * re-enabling rerunFailedLambdas * quieten an S3 transfer * include the foldername when reporting on container progress * put daily trajdb in a safe place * be more specific when finding the daily log * only tar the current container logs * save daily obsdb in the right place * rename ec2.tf to calcserver.tf * quieten some s3 transfers * rename ec2.tf in my acct to ukmonhelper_ec2.tf to make it clearer what it is * update SSM params to reflect new serverid * bugfix in distributeCandidates - using wrong path * add newline to getCostMetrics * weird bug in statsToMqtt * bugfix in update_wmpl.sh for traj container * Script to create an AMI for the calcengine * exclude test data when syncing from s3 * writing databases and logs to the wrong target * bad test on istest * typo in serveruserid * adding to server migration notes * purge old rawcsvs and fullcsvs older than 180 days * improved housekeeping of old data * make sure we scoop up data for 31/12 * stop creation of an unused set of files * change default locations for container data * put container logs in the right place * update dockerfile syntax * change locations of test container data and output * remove incorrect comments * Add script to clean up deleted/duplicate trajs * simplify the stats gathering and move to python fix bug in getMatchStats * comment out unused files * update reportOfLatestMatches to exclude deleted trajectories * add scp to requirements * add SQL database maintenance to dataMaintenance * incorrect default for datadir * update call to pymysql.connect * ensure consolidateOutput rerunnable for prior years * upgrading WMPL * update gitignore a bit * bugfix to catch data from 31/12 each year * add paramiko to dependencies for matchPickle to support wmpl upgrade * update getpickle to newest WMPL * bugfix in api tests * bugfix - changes to dailydb not saved * improvements to process to cleanup deleted trajs * after merging, check and remove any duplicate trajectories from the sqlite db and disk * Adding version * bump version 2025.11.1 -> 2026.04.0 * update files containing vesion * bump version 2026.04.0 -> 2026.04.1 * unmangling side effets of automerge * correct usage message * adding install script * changes to ansible scripts * remove irrelevant file * Adding SSM variables for the new batchserver in the ukmda account * attempt to add logging to consolidateDistTraj * remove reference to ee account * temporarily add mariadb deets to ssm in mjmm account * bugfixes in dataMaintenance and cleanupDeletedTrajs to avoid deleting disk files when trajs share same folder * updating migration instructions * more work on deduplication for ukmon * remove username-specific stuff * remove the old deployment scripts * update install script * updates to improve server migration process * add bashrc to the installer * slight tweak to installer * add a few installer messages * remove an echo * be less verbose in the rsyncs * oops need -a for one of the rsyncs * rename requirements file for ukmda * remove dependencies on MeteorTools * add utils to ukmon_pylib * more removal of dependencies on MeteorTools * updating how shower data is obtained * corercting location of IMO and gmn shower data * bugfixes * fixes in imoWorkinShowerlist * small error in install_or_update * bugfix when no data found in imo set * retrieve IMO data after each code update * fixing up getShowerDets * improve installer * fix createShowerExtracts * update extractors and showeranalysis * bug in extractor thats existed since 2023 but nobody noticed... * trying to fix matplotlib bug * more working on matplotlib issue * oops overfixed a bug * another incorrect bugfix! * make bars wider * more removal of MeteorTools * bugfix in createannualbarchart * working on bug * more work on lenght bug * remove some debugging * oops forgot to push the fixed version of createReportIndex * segregating function to get list of images that weren't calibrated by RMS * reorganize stuff a bit * add email sending functionality to ukmon_pylib * use send email functionality in code * add database and gmaps keys/passwords as secure variables * update to use secure keys * remove dbpw from environment * remove dbpw from environment * add script to retrieve db passwd * add script to retrieve db passwords * bug in createTables * updates to migration instructions * include pip installs in the script * tweak installer * remove glob.glob1 * move unused scripts - will delete later * fix mariadb connections * typo * tidy up docs * fixing mysql calls * small changes to documentation * suppress pip messages if already installed * tweaks to the installer * add logrotate stuff * bugfixes in installer * tidy up installer * bugfix in key mgmt * move some functionality into new script to tidy up nightly job and simplify rerunning * improve install script * update location of camera count file * move annual bar charts into a more logical location * update test script * add gmaps param to my acct * relocate coverage maps and front page index * tidy up useraudit process * bugfixes in testing * bugfix in createAnnualBarchart * bug in testscript * another small bug in createSummaryTable * still fighting that bug * tidy up lastlog data * remove unused file * update cam status reporting * clear down the old brightness data * simplification of logging and of the nightlyJob script * bugfixes in process to gather consumed image ifo * update getUncal to work for historic data * typo * improvements in getUncalImages * bugfix * add python to get unused images * move script to right place * comment out unnecessary echo * bugfixes in camMetrics while migrating user accts * fix #448 * make sure window title is sensible * bugfix in replot and get unused * bugfix in removeDeletedTraj for search index * remove deprecation warning issue #450 * whoops naive vs tzaware dates * remove warning in cameraStatusReport issue #453 * remove warning issue #454 * widen constraints on analysing pickles to get images * add migration script * add sudo * actually do it * update sftp migration script * more changes to migration script * moving sftp migration script * update messages and docos * slight tweak to migration script * further work on sftp account migration * update ukmon ini files after migration * typo * collect old server login records integration with new * update migration instructions * update cam metrics report to include hostname * bugfix as $USER not available in cron * removing unused files * some tidying up * motre reorg * remove disused template rename file to follow convention * simplifying logging and removing unused aws profile * removing profile from python * adding executable bit * typo * bugfix to work around typo * print message when done * bugfix to get trajectories from s3 before trying to check for missing trajectories... * improve to support running for past dates * errors in bashrc and logrotate config * prevent email being sent for anything other than current days report * bugfix: make sure we use the most recent stats * improvement in reportOfLatestMatches to handle past dates * bugfix * small tweak to support reportOfLatestMatches * tweak getMatchStats to handle historic data better * add mariadb and ping to the sec grp so that the database can be accessed by apis * update the db servername * bugfix in match stats * prevent bogus renaming of matchJob.log * bumping version * bump version 2026.04.1 -> 2026.05.0
1 parent 8a4a7f2 commit 5e52f07

128 files changed

Lines changed: 2808 additions & 1623 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# UK Meteor Data Analysis Shared code and libraries
2-
version: 2026.04.1
2+
version: 2026.05.0
33

44
This repository contains the code behind the UK Meteors data archive and data processing pipeline.
55

archive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Data Processing and Flows
22
==========================
33

4-
version: 2026.04.1
4+
version: 2026.05.0
55

66
This diagram shows the overall flow of data from Cameras to websites and out to the public.
77

archive/analysis/findAllMatches.sh

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ here="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
2323
source $here/../config.ini >/dev/null 2>&1
2424
conda activate $HOME/miniconda3/envs/${WMPL_ENV}
2525

26-
# logstream name inherited from parent environment but set it if not
27-
if [ "$NJLOGSTREAM" == "" ]; then
28-
NJLOGSTREAM=$(date +%Y%m%d-%H%M%S)
29-
aws logs create-log-stream --log-group-name $NJLOGGRP --log-stream-name $NJLOGSTREAM --profile ukmonshared
30-
fi
31-
log2cw $NJLOGGRP $NJLOGSTREAM "start findAllMatches" findAllMatches
26+
logger -s -t findAllMatches "starting"
3227

3328
[ -f $DATADIR/rundate.txt ] && rundate=$(cat $DATADIR/rundate.txt) || rundate=$(date +%Y%m%d)
3429

@@ -52,40 +47,39 @@ mkdir -p $SRC/logs/distrib > /dev/null 2>&1
5247

5348
startdt=$(date --date="-$MATCHSTART days" '+%Y%m%d-080000')
5449
enddt=$(date --date="-$MATCHEND days" '+%Y%m%d-080000')
55-
log2cw $NJLOGGRP $NJLOGSTREAM "solving for ${startdt} to ${enddt}" findAllMatches
5650

57-
log2cw $NJLOGGRP $NJLOGSTREAM "start runDistrib" findAllMatches
58-
$SRC/analysis/runDistrib.sh $MATCHSTART $MATCHEND
51+
logger -s -t findAllMatches "solving for ${startdt} to ${enddt}"
52+
logger -s -t findAllMatches "start runDistrib"
5953

60-
log2cw $NJLOGGRP $NJLOGSTREAM "clean duplicate/deleted trajs" findAllMatches
54+
$SRC/analysis/runDistrib.sh $MATCHSTART $MATCHEND
6155
$SRC/utils/cleanupDeletedTrajs.sh
6256

63-
log2cw $NJLOGGRP $NJLOGSTREAM "start checkForFailures" findAllMatches
57+
logger -s -t findAllMatches "Solving Run Done"
58+
6459
success=$(grep "Total run time:" $SRC/logs/matchJob.log)
6560

6661
if [ "$success" == "" ]
6762
then
68-
python -c "from meteortools.utils import sendAnEmail ; sendAnEmail('markmcintyre99@googlemail.com','problem with matching','Error in UKMON matching', mailfrom='ukmonhelper@ukmeteors.co.uk')"
63+
python -c "from utils.sendAnEmail import sendAnEmail ; sendAnEmail('markmcintyre99@googlemail.com','problem with matching','Error in UKMON matching', mailfrom='ukmonhelper@ukmeteors.co.uk')"
6964
echo problems with solver
7065
fi
71-
log2cw $NJLOGGRP $NJLOGSTREAM "Solving Run Done" findAllMatches
7266

73-
log2cw $NJLOGGRP $NJLOGSTREAM "start rerunFailedLambdas" findAllMatches
7467
python -m maintenance.rerunFailedLambdas
7568

7669
cd $here
77-
log2cw $NJLOGGRP $NJLOGSTREAM "start reportOfLatestMatches" findAllMatches
70+
71+
logger -s -t findAllMatches "start reportOfLatestMatches"
72+
7873
matchlog=${SRC}/logs/matchJob.log
79-
python -m reports.reportOfLatestMatches $DATADIR/latest/contdbs $DATADIR/dailyreports $MATCHEND $rundate
80-
python -m metrics.getMatchStats $matchlog
74+
python -m reports.reportOfLatestMatches $DATADIR/latest/contdbs $DATADIR/dailyreports $rundate
75+
python -m metrics.getMatchStats $matchlog $rundate
8176

8277
# copy stats to S3 so the daily report can run
8378
if [ "$RUNTIME_ENV" == "PROD" ] ; then
8479
aws s3 sync $DATADIR/dailyreports/ $UKMONSHAREDBUCKET/matches/RMSCorrelate/dailyreports/ --quiet
8580
fi
8681

87-
log2cw $NJLOGGRP $NJLOGSTREAM "start purgeLogs" findAllMatches
8882
find $SRC/logs -name "matches*" -mtime +7 -exec gzip {} \;
8983
find $SRC/logs -name "matches*" -mtime +30 -exec rm -f {} \;
9084

91-
log2cw $NJLOGGRP $NJLOGSTREAM "finished findAllMatches" findAllMatches
85+
logger -s -t findAllMatches "finished"

archive/analysis/getLogData.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if [ "$1" != "" ] ; then
1010
logfile=$DATADIR/lastlogs/lastlog-${rundate}.html
1111
else
1212
rundate=$(date +%Y%m%d)
13-
logfile=$DATADIR/lastlog.html
13+
logfile=$DATADIR/lastlogs/lastlog.html
1414
fi
1515

1616
# create performance metrics
@@ -78,7 +78,7 @@ echo "<p><a href=/reports/batchcharts/$rundate-perfNightly.jpg><img src=/reports
7878

7979
cat $TEMPLATES/footer.html >> $logfile
8080

81-
if [ ! -d $DATADIR/lastlogs ] ; then mkdir $DATADIR/lastlogs ; fi
81+
mkdir -p $DATADIR/lastlogs
8282
if [ "$1" == "" ] ; then
8383
aws s3 cp $logfile $WEBSITEBUCKET/reports/ --quiet
8484
cp $logfile $DATADIR/lastlogs/lastlog-${rundate}.html
@@ -92,3 +92,5 @@ ls -1r $DATADIR/lastlogs/last*.html | head -90 | while read i ; do
9292
done
9393
cat $TEMPLATES/footer.html >> $DATADIR/lastlogs/index.html
9494
aws s3 cp $DATADIR/lastlogs/index.html $WEBSITEBUCKET/reports/lastlogs/ --quiet
95+
96+
find $DATADIR/lastlogs -name "lastlog*" -mtime +90 -exec rm -f {} \;

archive/analysis/reportActiveShowers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fi
3030
logger -s -t reportActiveShowers "report on active showers"
3131
python -m reports.reportActiveShowers -m
3232

33-
python -c "from meteortools.utils import getActiveShowers; getActiveShowers('$rundt', inclMinor=True)" | while read shwr
33+
python -c "from utils.getActiveShowers import getActiveShowers;getActiveShowers('$rundt', inclMinor=True)" | while read shwr
3434
do
3535
aws s3 sync $DATADIR/reports/${yr}/$shwr $WEBSITEBUCKET/reports/${yr}/${shwr} --quiet
3636
done

archive/analysis/runDistrib.sh

Lines changed: 34 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -20,129 +20,110 @@ here="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
2020
# load the configuration
2121
source $here/../config.ini >/dev/null 2>&1
2222

23-
# logstream name inherited from parent environment but set it if not
24-
if [ "$NJLOGSTREAM" == "" ]; then
25-
NJLOGSTREAM=$(date +%Y%m%d-%H%M%S)
26-
aws logs create-log-stream --log-group-name $NJLOGGRP --log-stream-name $NJLOGSTREAM --profile ukmonshared
27-
fi
28-
log2cw $NJLOGGRP $NJLOGSTREAM "starting runDistrib" runDistrib
29-
30-
# set the profile to the UKMDA account so we can run the server and monitor progress
31-
export AWS_PROFILE=ukmonshared
23+
logger -s -t runDistrib "starting runDistrib"
3224

3325
if [ $# -gt 0 ] ; then
3426
if [ "$1" != "" ] ; then
35-
log2cw $NJLOGGRP $NJLOGSTREAM "selecting range" runDistrib
3627
MATCHSTART=$1
3728
fi
3829
if [ "$2" != "" ] ; then
3930
MATCHEND=$2
4031
else
41-
log2cw $NJLOGGRP $NJLOGSTREAM "matchend was not supplied, using 2 days" runDistrib
4232
MATCHEND=$(( $MATCHSTART - 2 ))
4333
fi
4434
fi
4535
begdate=$(date --date="-$MATCHSTART days" '+%Y%m%d')
4636
rundate=$(date --date="-$MATCHEND days" '+%Y%m%d')
4737

48-
log2cw $NJLOGGRP $NJLOGSTREAM "start correlation server" runDistrib
38+
logger -s -t runDistrib "running phase 1 for dates ${begdate} to ${rundate}"
4939

40+
logger -s -t runDistrib "start correlation server"
5041
aws ec2 start-instances --instance-ids $SERVERINSTANCEID
5142
stat=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].State.Code --output text)
5243
while [ "$stat" -ne 16 ]; do
5344
sleep 5
54-
log2cw $NJLOGGRP $NJLOGSTREAM "checking server status" runDistrib
5545
stat=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].State.Code --output text)
5646
done
5747

58-
log2cw $NJLOGGRP $NJLOGSTREAM "running phase 1 for dates ${begdate} to ${rundate}" runDistrib
59-
6048
conda activate $HOME/miniconda3/envs/${WMPL_ENV}
6149

62-
log2cw $NJLOGGRP $NJLOGSTREAM "creating the run script" runDistrib
50+
logger -s -t runDistrib "creating the run script"
6351

6452
execdist=execdistrib.sh
6553
execMatchingsh=/tmp/$execdist
6654
python -m traj.createDistribMatchingSh $MATCHSTART $MATCHEND $execMatchingsh $TESTMODE
6755
chmod +x $execMatchingsh
6856

69-
log2cw $NJLOGGRP $NJLOGSTREAM "get server details" runDistrib
70-
privip=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].PrivateIpAddress --output text)
71-
while [ "$privip" == "" ] ; do
72-
sleep 5
73-
log2cw $NJLOGGRP $NJLOGSTREAM "getting IP address" runDistrib
74-
privip=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].PrivateIpAddress --output text)
75-
done
76-
77-
log2cw $NJLOGGRP $NJLOGSTREAM "deploy the script to the server $privip and run it" runDistrib
57+
logger -s -t runDistrib "deploy the script to the server $CALCSERVERIP and run it"
7858

79-
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$privip:data/distrib/$execdist
59+
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execdist
8060
while [ $? -ne 0 ] ; do
8161
# in case the server isn't responding to ssh sessions yet
8262
sleep 10
83-
log2cw $NJLOGGRP $NJLOGSTREAM "server not responding yet, retrying" runDistrib
84-
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$privip:data/distrib/$execdist
63+
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execdist
8564
done
8665
# push the python code and ECS templates required
87-
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/clusdetails-* $SERVERUSERID@$privip:src/ukmon_pylib/traj
88-
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/taskrunner*.json $SERVERUSERID@$privip:src/ukmon_pylib/traj
89-
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/consolidateDistTraj.py $SERVERUSERID@$privip:src/ukmon_pylib/traj
90-
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/distributeCandidates.py $SERVERUSERID@$privip:src/ukmon_pylib/traj
91-
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/pickleAnalyser.py $SERVERUSERID@$privip:src/ukmon_pylib/traj
66+
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/clusdetails-* $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
67+
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/taskrunner*.json $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
68+
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/consolidateDistTraj.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
69+
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/distributeCandidates.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
70+
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/pickleAnalyser.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
71+
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/ShowerAssociation.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
72+
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/utils/convertSolLon.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/utils/
9273

9374
# now run the script
94-
log2cw $NJLOGGRP $NJLOGSTREAM "start distributed processing" runDistrib
95-
ssh -i $SERVERSSHKEY $SERVERUSERID@$privip "data/distrib/$execdist"
75+
logger -s -t runDistrib "start distributed processing"
76+
ssh -i $SERVERSSHKEY $SERVERUSERID@$CALCSERVERIP "data/distrib/$execdist"
9677

97-
rsync -avz -e "ssh -i $SERVERSSHKEY" $SERVERUSERID@$privip:ukmon-shared/matches/RMSCorrelate/candidates/processed/*.tgz $DATADIR/distrib/candidates
78+
rsync -avz -e "ssh -i $SERVERSSHKEY" $SERVERUSERID@$CALCSERVERIP:ukmon-shared/matches/RMSCorrelate/candidates/processed/*.tgz $DATADIR/distrib/candidates
9879

99-
rsync -avz -e "ssh -i $SERVERSSHKEY" $SERVERUSERID@$privip:ukmon-shared/matches/RMSCorrelate/logs/*${rundate}*.log $SRC/logs/distrib/
100-
ssh -i $SERVERSSHKEY $SERVERUSERID@$privip "find ukmon-shared/matches/RMSCorrelate/logs -name '*.log' -mtime +30 -exec rm -f {} \;"
80+
rsync -avz -e "ssh -i $SERVERSSHKEY" $SERVERUSERID@$CALCSERVERIP:ukmon-shared/matches/RMSCorrelate/logs/*${rundate}*.log $SRC/logs/distrib/
81+
ssh -i $SERVERSSHKEY $SERVERUSERID@$CALCSERVERIP "find ukmon-shared/matches/RMSCorrelate/logs -name '*.log' -mtime +30 -exec rm -f {} \;"
10182

102-
log2cw $NJLOGGRP $NJLOGSTREAM "job run, stop the server again" runDistrib
83+
logger -s -t runDistrib "job run, stop the server again"
10384
aws ec2 stop-instances --instance-ids $SERVERINSTANCEID
10485

105-
log2cw $NJLOGGRP $NJLOGSTREAM "monitoring and waiting for completion" runDistrib
86+
logger -s -t runDistrib "monitoring and waiting for completion"
10687

10788
python -c "from traj.distributeCandidates import monitorProgress as mp; mp('${rundate}', '${TESTMODE}'); "
10889

10990
mkdir -p $DATADIR/distrib
11091
cd $DATADIR/distrib
11192

112-
log2cw $NJLOGGRP $NJLOGSTREAM "restarting server to consolidate results" runDistrib
93+
logger -s -t runDistrib "restarting server to consolidate results"
94+
11395
stat=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].State.Code --output text)
11496
if [ $stat -eq 80 ]; then
11597
aws ec2 start-instances --instance-ids $SERVERINSTANCEID
11698
fi
117-
log2cw $NJLOGGRP $NJLOGSTREAM "waiting for the server to be ready" runDistrib
11899
while [ "$stat" -ne 16 ]; do
119100
sleep 30
120101
if [ $stat -eq 80 ]; then
121102
aws ec2 start-instances --instance-ids $SERVERINSTANCEID
122103
fi
123-
log2cw $NJLOGGRP $NJLOGSTREAM "checking - status is ${stat}" runDistrib
124104
stat=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].State.Code --output text)
125105
done
126-
privip=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].PrivateIpAddress --output text)
127106

128107
execcons=execconsol.sh
129108
execConsolsh=/tmp/$execcons
130109
python -c "from traj.createDistribMatchingSh import createExecConsolSh;createExecConsolSh($MATCHSTART, $MATCHEND, '$execConsolsh', '$TESTMODE')"
131110
chmod +x $execConsolsh
132111

133-
log2cw $NJLOGGRP $NJLOGSTREAM "running consolidation" runDistrib
134-
scp -i $SERVERSSHKEY $execConsolsh $SERVERUSERID@$privip:data/distrib/$execcons
135-
ssh -i $SERVERSSHKEY $SERVERUSERID@$privip "data/distrib/$execcons"
112+
logger -s -t runDistrib "running consolidation"
113+
114+
scp -i $SERVERSSHKEY $execConsolsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execcons
115+
ssh -i $SERVERSSHKEY $SERVERUSERID@$CALCSERVERIP "data/distrib/$execcons"
136116

137-
log2cw $NJLOGGRP $NJLOGSTREAM "finished consolidation, copying databases" runDistrib
138-
rsync -avz -e "ssh -i $SERVERSSHKEY" $SERVERUSERID@$privip:ukmon-shared/matches/RMSCorrelate/dbs/*.db $DATADIR/distrib
117+
logger -s -t runDistrib "finished consolidation, copying databases"
139118

140-
# remote temporary files
141-
ssh -i $SERVERSSHKEY $SERVERUSERID@$privip "find /tmp -maxdepth 1 -name "*.pickle" -mtime +7 -exec rm -f {} \;"
119+
rsync -avz -e "ssh -i $SERVERSSHKEY" $SERVERUSERID@$CALCSERVERIP:ukmon-shared/matches/RMSCorrelate/dbs/*.db $DATADIR/distrib
120+
ssh -i $SERVERSSHKEY $SERVERUSERID@$CALCSERVERIP "find /tmp -maxdepth 1 -name "*.pickle" -mtime +7 -exec rm -f {} \;"
142121

143-
log2cw $NJLOGGRP $NJLOGSTREAM "stopping calcserver again" runDistrib
122+
logger -s -t runDistrib "stopping calcserver again"
144123
aws ec2 stop-instances --instance-ids $SERVERINSTANCEID
145124

125+
logger -s -t runDistrib "copying data to batch server and tidying up"
126+
146127
# grab a copy of the indvidual container dbs so we can get a list of new solutions
147128
rm -Rf $DATADIR/latest/contdbs/
148129
mkdir -p $DATADIR/latest/contdbs/
@@ -154,8 +135,6 @@ aws s3 mv $UKMONSHAREDBUCKET/matches/distrib${TESTSUFF}/${rundate}.pickle $DATAD
154135
aws s3 sync $UKMONSHAREDBUCKET/matches/distrib${TESTSUFF}/ $SRC/logs/distrib/ --exclude "*" --include "correl*.log" --exclude "logs/" --quiet
155136
aws s3 rm $UKMONSHAREDBUCKET/matches/distrib${TESTSUFF}/ --exclude "*" --include "correl*.log" --exclude "logs/" --recursive --quiet
156137

157-
log2cw $NJLOGGRP $NJLOGSTREAM "compressing the processed data" runDistrib
158-
159138
mkdir -p $DATADIR/trajdb
160139
tar czvf $DATADIR/trajdb/databases_${rundate}.tgz $DATADIR/distrib/*.db
161140
mkdir -p $DATADIR/distrib/containers
@@ -168,7 +147,4 @@ find $DATADIR/distrib/containers/ -name "cont*.tgz" -mtime +30 -exec rm -f {} \;
168147
find $DATADIR/distrib/ -maxdepth 1 -name "20*.tgz" -mtime +30 -exec rm -f {} \;
169148
rm -f $DATADIR/distrib/${rundate}.pickle
170149

171-
172-
# and then clear the profile again
173-
unset AWS_PROFILE
174-
log2cw $NJLOGGRP $NJLOGSTREAM "finished runDistrib" runDistrib
150+
logger -s -t "finished runDistrib"

0 commit comments

Comments
 (0)