Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
274 commits
Select commit Hold shift + click to select a range
65411e2
add a comment to explain what the code does
markmac99 Apr 7, 2026
515692e
remove json db
markmac99 Apr 7, 2026
38d09c6
update consolidation to handle sqlite dbs
markmac99 Apr 7, 2026
3310c1b
remove unused function
markmac99 Apr 7, 2026
f549695
create data for daily report
markmac99 Apr 7, 2026
6693f81
remove unused file
markmac99 Apr 8, 2026
ae06c61
update to call new version of reportOfLatestMatches
markmac99 Apr 8, 2026
74064e6
add test variables
markmac99 Apr 8, 2026
c24044d
mildly improve doco
markmac99 Apr 8, 2026
0cac512
put test logs in the right CW log group
markmac99 Apr 8, 2026
0300137
handle missing log groups better
markmac99 Apr 8, 2026
a65af98
extra value in TrajQualityParams
markmac99 Apr 8, 2026
62a2d97
bugfixes revealed in testing
markmac99 Apr 8, 2026
f938114
fix issues in reportOfLatestMatches
markmac99 Apr 8, 2026
c999492
put container dbs in a sensible place
markmac99 Apr 9, 2026
c71392d
catch logging errors
markmac99 Apr 9, 2026
65b72f0
tidy up file locations
markmac99 Apr 9, 2026
f20072b
simplify calcserver start up
markmac99 Apr 9, 2026
6eb8a9f
sorting out errors in container logging
markmac99 Apr 10, 2026
c9dcdc2
update container logging info
markmac99 Apr 10, 2026
5383816
avoid unnecessary error
markmac99 Apr 10, 2026
8c55c71
fix bugs in log capture process
markmac99 Apr 10, 2026
27edcd9
add MAX_STNS so i can experiement with limits
markmac99 Apr 11, 2026
8d850ed
add logging.
markmac99 Apr 11, 2026
42c0407
don't pull or push the databases from S3 during distribution
markmac99 Apr 11, 2026
3d1a5c1
catch error if trajpickle can't be found
markmac99 Apr 12, 2026
13d110c
set rundate more safely
markmac99 Apr 12, 2026
55de128
tidy up backup file names and housekeep backup folder
markmac99 Apr 12, 2026
a90bee3
move some processes from findAllMatches to nightlyJob to make testing…
markmac99 Apr 12, 2026
2265a18
support for testing of createExecReplot
markmac99 Apr 12, 2026
4535a89
pass testmode to createExecReplot
markmac99 Apr 12, 2026
38fba77
ensure logs are unique and capture container logs
markmac99 Apr 12, 2026
daf8255
realigning createFireballPage with prod. Updating gitignore
markmac99 Apr 12, 2026
982b067
remove verbosity flag from one tar operation
markmac99 Apr 13, 2026
a62ec24
fixup to handle new style log with datestamps
markmac99 Apr 13, 2026
c8d8fa8
get privip after restarting calcserver
markmac99 Apr 13, 2026
e5779d4
temporarily don't run rerunFailedLambdas in test
markmac99 Apr 13, 2026
431f6ec
update to work in a test env too
markmac99 Apr 13, 2026
f2440ea
add 'period' to the match summary api
markmac99 Apr 13, 2026
7a5374c
add period to match summary api
markmac99 Apr 13, 2026
f091a39
re-enabling rerunFailedLambdas
markmac99 Apr 13, 2026
5763ced
quieten an S3 transfer
markmac99 Apr 14, 2026
e141777
include the foldername when reporting on container progress
markmac99 Apr 14, 2026
7ffa200
put daily trajdb in a safe place
markmac99 Apr 14, 2026
bb4f9fb
be more specific when finding the daily log
markmac99 Apr 15, 2026
19aad0e
only tar the current container logs
markmac99 Apr 15, 2026
28080f6
save daily obsdb in the right place
markmac99 Apr 15, 2026
b02c7df
rename ec2.tf to calcserver.tf
markmac99 Apr 16, 2026
70359b8
quieten some s3 transfers
markmac99 Apr 16, 2026
4a3b726
rename ec2.tf in my acct to ukmonhelper_ec2.tf to make it clearer wha…
markmac99 Apr 16, 2026
b7badb9
update SSM params to reflect new serverid
markmac99 Apr 16, 2026
dd92ad0
bugfix in distributeCandidates - using wrong path
markmac99 Apr 16, 2026
9d3464e
add newline to getCostMetrics
markmac99 Apr 16, 2026
3d173c2
weird bug in statsToMqtt
markmac99 Apr 16, 2026
78217c4
bugfix in update_wmpl.sh for traj container
markmac99 Apr 16, 2026
2e20b0f
Script to create an AMI for the calcengine
markmac99 Apr 16, 2026
fdf117a
exclude test data when syncing from s3
markmac99 Apr 17, 2026
c834da0
writing databases and logs to the wrong target
markmac99 Apr 17, 2026
0168530
bad test on istest
markmac99 Apr 17, 2026
ad1b19b
typo in serveruserid
markmac99 Apr 17, 2026
b2ca89d
adding to server migration notes
markmac99 Apr 17, 2026
5502f23
purge old rawcsvs and fullcsvs older than 180 days
markmac99 Apr 17, 2026
d1ffcbb
improved housekeeping of old data
markmac99 Apr 17, 2026
e98ea05
make sure we scoop up data for 31/12
markmac99 Apr 17, 2026
8da5954
stop creation of an unused set of files
markmac99 Apr 17, 2026
70761a4
change default locations for container data
markmac99 Apr 21, 2026
0f861e9
put container logs in the right place
markmac99 Apr 21, 2026
b99e6ba
update dockerfile syntax
markmac99 Apr 21, 2026
b7bd066
change locations of test container data and output
markmac99 Apr 21, 2026
c9df319
remove incorrect comments
markmac99 Apr 21, 2026
41756b7
Add script to clean up deleted/duplicate trajs
markmac99 Apr 21, 2026
fc4fd1a
simplify the stats gathering and move to python
markmac99 Apr 22, 2026
0df6c0a
comment out unused files
markmac99 Apr 22, 2026
fd68a67
update reportOfLatestMatches to exclude deleted trajectories
markmac99 Apr 22, 2026
78ef3fd
add scp to requirements
markmac99 Apr 22, 2026
a40ecee
add SQL database maintenance to dataMaintenance
markmac99 Apr 22, 2026
a8c6645
incorrect default for datadir
markmac99 Apr 22, 2026
d9ec08f
update call to pymysql.connect
markmac99 Apr 22, 2026
a3e8752
ensure consolidateOutput rerunnable for prior years
markmac99 Apr 22, 2026
fd719d7
upgrading WMPL
markmac99 Apr 22, 2026
769e685
update gitignore a bit
markmac99 Apr 22, 2026
6c26cf4
bugfix to catch data from 31/12 each year
markmac99 Apr 22, 2026
f89c69c
add paramiko to dependencies for matchPickle to support wmpl upgrade
markmac99 Apr 22, 2026
b4b4f28
update getpickle to newest WMPL
markmac99 Apr 22, 2026
f90ebaa
bugfix in api tests
markmac99 Apr 22, 2026
fc7b2e1
bugfix - changes to dailydb not saved
markmac99 Apr 23, 2026
d611e56
improvements to process to cleanup deleted trajs
markmac99 Apr 23, 2026
db558a3
after merging, check and remove any duplicate trajectories from the s…
markmac99 Apr 23, 2026
784c73d
Adding version
markmac99 Apr 23, 2026
dad925b
bump version 2025.11.1 -> 2026.04.0
markmac99 Apr 23, 2026
3ba5cfb
update files containing vesion
markmac99 Apr 23, 2026
284de96
bump version 2026.04.0 -> 2026.04.1
markmac99 Apr 23, 2026
7eee632
Merge branch 'master' into markmac99
markmac99 Apr 23, 2026
a319dd2
unmangling side effets of automerge
markmac99 Apr 23, 2026
89f2aa1
correct usage message
markmac99 Apr 23, 2026
bf376f8
decommission old calcserver and add new batchserver
markmac99 Apr 23, 2026
21eb2be
add calcserver IP to ssm variables and use it
markmac99 Apr 23, 2026
9159b41
Update my branch with the latest from master (#436)
markmac99 Apr 23, 2026
8f8b4f2
changes to ansible scripts
markmac99 Apr 23, 2026
26cc096
remove irrelevant file
markmac99 Apr 23, 2026
6ca8795
Adding SSM variables for the new batchserver in the ukmda account
markmac99 Apr 23, 2026
40d76bc
attempt to add logging to consolidateDistTraj
markmac99 Apr 24, 2026
f4e9ff0
remove reference to ee account
markmac99 Apr 24, 2026
b9b1353
temporarily add mariadb deets to ssm in mjmm account
markmac99 Apr 24, 2026
a582121
bugfixes in dataMaintenance and cleanupDeletedTrajs to avoid deleting…
markmac99 Apr 24, 2026
da410f6
updating migration instructions
markmac99 Apr 24, 2026
2010c05
more work on deduplication for ukmon
markmac99 Apr 24, 2026
6424937
remove username-specific stuff
markmac99 Apr 24, 2026
db3448e
remove the old deployment scripts
markmac99 Apr 24, 2026
a926e33
update install script
markmac99 Apr 24, 2026
59292b4
updates to improve server migration process
markmac99 Apr 25, 2026
1a43eed
add bashrc to the installer
markmac99 Apr 25, 2026
efc9fbb
slight tweak to installer
markmac99 Apr 25, 2026
66801ae
add a few installer messages
markmac99 Apr 25, 2026
44b1ae6
remove an echo
markmac99 Apr 25, 2026
74923b5
be less verbose in the rsyncs
markmac99 Apr 25, 2026
8f2ab42
oops need -a for one of the rsyncs
markmac99 Apr 25, 2026
25ad585
rename requirements file for ukmda
markmac99 Apr 27, 2026
b712fb2
remove dependencies on MeteorTools
markmac99 Apr 27, 2026
6e89edc
add utils to ukmon_pylib
markmac99 Apr 27, 2026
2ea77b5
more removal of dependencies on MeteorTools
markmac99 Apr 27, 2026
9cb4867
updating how shower data is obtained
markmac99 Apr 27, 2026
646f5e7
corercting location of IMO and gmn shower data
markmac99 Apr 27, 2026
c1ed84f
bugfixes
markmac99 Apr 27, 2026
e8e2247
fixes in imoWorkinShowerlist
markmac99 Apr 27, 2026
ed8eb85
small error in install_or_update
markmac99 Apr 27, 2026
5118b18
bugfix when no data found in imo set
markmac99 Apr 27, 2026
030dbaa
retrieve IMO data after each code update
markmac99 Apr 27, 2026
772f912
fixing up getShowerDets
markmac99 Apr 27, 2026
1bd0033
improve installer
markmac99 Apr 27, 2026
127b814
fix createShowerExtracts
markmac99 Apr 27, 2026
9a6a393
update extractors and showeranalysis
markmac99 Apr 27, 2026
f45a037
bug in extractor thats existed since 2023 but nobody noticed...
markmac99 Apr 27, 2026
48e51c9
trying to fix matplotlib bug
markmac99 Apr 27, 2026
b524e94
more working on matplotlib issue
markmac99 Apr 27, 2026
5a8aa03
oops overfixed a bug
markmac99 Apr 27, 2026
383dd74
another incorrect bugfix!
markmac99 Apr 27, 2026
c2e8b1f
make bars wider
markmac99 Apr 27, 2026
550afbe
more removal of MeteorTools
markmac99 Apr 27, 2026
66a7fa4
bugfix in createannualbarchart
markmac99 Apr 27, 2026
d55eb05
working on bug
markmac99 Apr 27, 2026
e074739
more work on lenght bug
markmac99 Apr 27, 2026
c944a17
remove some debugging
markmac99 Apr 27, 2026
a069e8a
oops forgot to push the fixed version of createReportIndex
markmac99 Apr 27, 2026
d21bdd0
segregating function to get list of images that weren't calibrated by…
markmac99 Apr 27, 2026
5fc7920
reorganize stuff a bit
markmac99 Apr 27, 2026
0a8d203
add email sending functionality to ukmon_pylib
markmac99 Apr 27, 2026
12a05c3
use send email functionality in code
markmac99 Apr 27, 2026
cfd7111
add database and gmaps keys/passwords as secure variables
markmac99 Apr 27, 2026
2e7d4b2
update to use secure keys
markmac99 Apr 27, 2026
3d511d3
remove dbpw from environment
markmac99 Apr 27, 2026
1d4b6df
remove dbpw from environment
markmac99 Apr 27, 2026
67b026c
add script to retrieve db passwd
markmac99 Apr 27, 2026
b283c2f
add script to retrieve db passwords
markmac99 Apr 27, 2026
9e212e5
bug in createTables
markmac99 Apr 27, 2026
814368f
updates to migration instructions
markmac99 Apr 27, 2026
d2594c2
include pip installs in the script
markmac99 Apr 27, 2026
1e79073
tweak installer
markmac99 Apr 27, 2026
474434d
remove glob.glob1
markmac99 Apr 27, 2026
2b1c332
move unused scripts - will delete later
markmac99 Apr 28, 2026
f8bf444
fix mariadb connections
markmac99 Apr 28, 2026
7e4a62e
typo
markmac99 Apr 28, 2026
6643b2b
tidy up docs
markmac99 Apr 28, 2026
0df64d2
fixing mysql calls
markmac99 Apr 28, 2026
8184c80
small changes to documentation
markmac99 Apr 28, 2026
99dc404
suppress pip messages if already installed
markmac99 Apr 28, 2026
378da82
tweaks to the installer
markmac99 Apr 28, 2026
c3392e1
add logrotate stuff
markmac99 Apr 28, 2026
2ea7fd1
bugfixes in installer
markmac99 Apr 28, 2026
c73fe55
tidy up installer
markmac99 Apr 28, 2026
6f7c51e
bugfix in key mgmt
markmac99 Apr 28, 2026
db8e111
move some functionality into new script to tidy up nightly job and si…
markmac99 Apr 29, 2026
7cf10c9
improve install script
markmac99 Apr 29, 2026
d4fa638
update location of camera count file
markmac99 Apr 29, 2026
f8165a3
move annual bar charts into a more logical location
markmac99 Apr 29, 2026
b1e7187
update test script
markmac99 Apr 29, 2026
531d817
add gmaps param to my acct
markmac99 Apr 29, 2026
ef54c94
relocate coverage maps and front page index
markmac99 Apr 29, 2026
91dc688
tidy up useraudit process
markmac99 Apr 29, 2026
8cc2ed4
bugfixes in testing
markmac99 Apr 29, 2026
47fd55b
bugfix in createAnnualBarchart
markmac99 Apr 29, 2026
aacc917
bug in testscript
markmac99 Apr 29, 2026
b141904
another small bug in createSummaryTable
markmac99 Apr 29, 2026
564b655
still fighting that bug
markmac99 Apr 29, 2026
55872fa
tidy up lastlog data
markmac99 Apr 29, 2026
cceb1a4
remove unused file
markmac99 Apr 29, 2026
c467a9c
update cam status reporting
markmac99 Apr 29, 2026
5757d2c
clear down the old brightness data
markmac99 Apr 29, 2026
043986a
simplification of logging and of the nightlyJob script
markmac99 Apr 29, 2026
0e748e9
bugfixes in process to gather consumed image ifo
markmac99 Apr 29, 2026
6b25760
update getUncal to work for historic data
markmac99 Apr 29, 2026
57e4486
typo
markmac99 Apr 29, 2026
192f366
improvements in getUncalImages
markmac99 Apr 29, 2026
4d1eb92
bugfix
markmac99 Apr 29, 2026
06b2b19
add python to get unused images
markmac99 Apr 29, 2026
c6d4893
move script to right place
markmac99 Apr 29, 2026
db3e093
comment out unnecessary echo
markmac99 Apr 30, 2026
44c07e9
bugfixes in camMetrics while migrating user accts
markmac99 Apr 30, 2026
99ff82f
fix #448
markmac99 Apr 30, 2026
57d9bf3
make sure window title is sensible
markmac99 Apr 30, 2026
3eed2b2
bugfix in replot and get unused
markmac99 Apr 30, 2026
46ef42f
bugfix in removeDeletedTraj for search index
markmac99 Apr 30, 2026
2e511b4
remove deprecation warning issue #450
markmac99 Apr 30, 2026
41c37c0
whoops naive vs tzaware dates
markmac99 Apr 30, 2026
f68185d
remove warning in cameraStatusReport issue #453
markmac99 Apr 30, 2026
7ed5362
remove warning issue #454
markmac99 Apr 30, 2026
f981ef5
widen constraints on analysing pickles to get images
markmac99 Apr 30, 2026
36a8ed9
add migration script
markmac99 Apr 30, 2026
0dedbe6
add sudo
markmac99 Apr 30, 2026
0235adf
actually do it
markmac99 Apr 30, 2026
dc95620
update sftp migration script
markmac99 Apr 30, 2026
4b559f0
more changes to migration script
markmac99 Apr 30, 2026
a91ac87
moving sftp migration script
markmac99 Apr 30, 2026
27ab535
update messages and docos
markmac99 Apr 30, 2026
b829c17
slight tweak to migration script
markmac99 Apr 30, 2026
54324dc
further work on sftp account migration
markmac99 Apr 30, 2026
c65b741
update ukmon ini files after migration
markmac99 Apr 30, 2026
dbd346c
typo
markmac99 Apr 30, 2026
1daa675
collect old server login records
markmac99 Apr 30, 2026
995c886
update migration instructions
markmac99 Apr 30, 2026
d16a0e2
update cam metrics report to include hostname
markmac99 May 1, 2026
b565e4d
bugfix as $USER not available in cron
markmac99 May 3, 2026
ac0923b
removing unused files
markmac99 May 3, 2026
44e8481
some tidying up
markmac99 May 3, 2026
968b396
motre reorg
markmac99 May 3, 2026
b410ced
remove disused template
markmac99 May 3, 2026
94dd416
simplifying logging and removing unused aws profile
markmac99 May 3, 2026
df4aa81
removing profile from python
markmac99 May 3, 2026
3e9d8f6
adding executable bit
markmac99 May 4, 2026
32353bc
typo
markmac99 May 4, 2026
a07908f
bugfix to work around typo
markmac99 May 4, 2026
55bae43
print message when done
markmac99 May 4, 2026
a5617a3
bugfix to get trajectories from s3 before trying to check for missing…
markmac99 May 4, 2026
f56b37e
improve to support running for past dates
markmac99 May 4, 2026
7f20a70
errors in bashrc and logrotate config
markmac99 May 4, 2026
8333f03
prevent email being sent for anything other than current days report
markmac99 May 4, 2026
5445404
bugfix: make sure we use the most recent stats
markmac99 May 4, 2026
8c63165
improvement in reportOfLatestMatches to handle past dates
markmac99 May 4, 2026
ab5fd5a
bugfix
markmac99 May 4, 2026
3429919
small tweak to support reportOfLatestMatches
markmac99 May 4, 2026
398ab0b
tweak getMatchStats to handle historic data better
markmac99 May 4, 2026
abd0ed2
add mariadb and ping to the sec grp so that the database can be acces…
markmac99 May 4, 2026
31affc2
update the db servername
markmac99 May 4, 2026
ca9ad30
bugfix in match stats
markmac99 May 5, 2026
accfc82
prevent bogus renaming of matchJob.log
markmac99 May 5, 2026
7163bee
bumping version
markmac99 May 5, 2026
c002178
bump version 2026.04.1 -> 2026.05.0
markmac99 May 5, 2026
7c57fd8
Merge branch 'master' into markmac99
markmac99 May 5, 2026
86d7e54
update matchapi to use indexed column
markmac99 May 5, 2026
c7eec3a
add api readme
markmac99 May 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# UK Meteor Data Analysis Shared code and libraries
version: 2026.04.1
version: 2026.05.0

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

Expand Down
6 changes: 6 additions & 0 deletions api_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Available APIs and Examples

We have a number of APIs which can be used to retrieve our data programatically, either using commandline tools like curl and wget, or from programming languages such as Python.

Data are returned in JSON format which can readily be converted into a python list, array or Pandas DataFrame. Simple examples are shown on our main website (here)[https://ukmeteornetwork.org/our-data-apis/], and a set of Python examples are available here. A Data Dictionary in Excel format can be downloaded from (here)[https://archive.ukmeteors.co.uk/browse/datadictionary.xlsx].

2 changes: 1 addition & 1 deletion archive/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Data Processing and Flows
==========================

version: 2026.04.1
version: 2026.05.0

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

Expand Down
32 changes: 13 additions & 19 deletions archive/analysis/findAllMatches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ here="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
source $here/../config.ini >/dev/null 2>&1
conda activate $HOME/miniconda3/envs/${WMPL_ENV}

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

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

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

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

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

log2cw $NJLOGGRP $NJLOGSTREAM "clean duplicate/deleted trajs" findAllMatches
$SRC/analysis/runDistrib.sh $MATCHSTART $MATCHEND
$SRC/utils/cleanupDeletedTrajs.sh

log2cw $NJLOGGRP $NJLOGSTREAM "start checkForFailures" findAllMatches
logger -s -t findAllMatches "Solving Run Done"

success=$(grep "Total run time:" $SRC/logs/matchJob.log)

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

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

cd $here
log2cw $NJLOGGRP $NJLOGSTREAM "start reportOfLatestMatches" findAllMatches

logger -s -t findAllMatches "start reportOfLatestMatches"

matchlog=${SRC}/logs/matchJob.log
python -m reports.reportOfLatestMatches $DATADIR/latest/contdbs $DATADIR/dailyreports $MATCHEND $rundate
python -m metrics.getMatchStats $matchlog
python -m reports.reportOfLatestMatches $DATADIR/latest/contdbs $DATADIR/dailyreports $rundate
python -m metrics.getMatchStats $matchlog $rundate

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

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

log2cw $NJLOGGRP $NJLOGSTREAM "finished findAllMatches" findAllMatches
logger -s -t findAllMatches "finished"
6 changes: 4 additions & 2 deletions archive/analysis/getLogData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [ "$1" != "" ] ; then
logfile=$DATADIR/lastlogs/lastlog-${rundate}.html
else
rundate=$(date +%Y%m%d)
logfile=$DATADIR/lastlog.html
logfile=$DATADIR/lastlogs/lastlog.html
fi

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

cat $TEMPLATES/footer.html >> $logfile

if [ ! -d $DATADIR/lastlogs ] ; then mkdir $DATADIR/lastlogs ; fi
mkdir -p $DATADIR/lastlogs
if [ "$1" == "" ] ; then
aws s3 cp $logfile $WEBSITEBUCKET/reports/ --quiet
cp $logfile $DATADIR/lastlogs/lastlog-${rundate}.html
Expand All @@ -92,3 +92,5 @@ ls -1r $DATADIR/lastlogs/last*.html | head -90 | while read i ; do
done
cat $TEMPLATES/footer.html >> $DATADIR/lastlogs/index.html
aws s3 cp $DATADIR/lastlogs/index.html $WEBSITEBUCKET/reports/lastlogs/ --quiet

find $DATADIR/lastlogs -name "lastlog*" -mtime +90 -exec rm -f {} \;
2 changes: 1 addition & 1 deletion archive/analysis/reportActiveShowers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi
logger -s -t reportActiveShowers "report on active showers"
python -m reports.reportActiveShowers -m

python -c "from meteortools.utils import getActiveShowers; getActiveShowers('$rundt', inclMinor=True)" | while read shwr
python -c "from utils.getActiveShowers import getActiveShowers;getActiveShowers('$rundt', inclMinor=True)" | while read shwr
do
aws s3 sync $DATADIR/reports/${yr}/$shwr $WEBSITEBUCKET/reports/${yr}/${shwr} --quiet
done
Expand Down
92 changes: 34 additions & 58 deletions archive/analysis/runDistrib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,129 +20,110 @@ here="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# load the configuration
source $here/../config.ini >/dev/null 2>&1

# logstream name inherited from parent environment but set it if not
if [ "$NJLOGSTREAM" == "" ]; then
NJLOGSTREAM=$(date +%Y%m%d-%H%M%S)
aws logs create-log-stream --log-group-name $NJLOGGRP --log-stream-name $NJLOGSTREAM --profile ukmonshared
fi
log2cw $NJLOGGRP $NJLOGSTREAM "starting runDistrib" runDistrib

# set the profile to the UKMDA account so we can run the server and monitor progress
export AWS_PROFILE=ukmonshared
logger -s -t runDistrib "starting runDistrib"

if [ $# -gt 0 ] ; then
if [ "$1" != "" ] ; then
log2cw $NJLOGGRP $NJLOGSTREAM "selecting range" runDistrib
MATCHSTART=$1
fi
if [ "$2" != "" ] ; then
MATCHEND=$2
else
log2cw $NJLOGGRP $NJLOGSTREAM "matchend was not supplied, using 2 days" runDistrib
MATCHEND=$(( $MATCHSTART - 2 ))
fi
fi
begdate=$(date --date="-$MATCHSTART days" '+%Y%m%d')
rundate=$(date --date="-$MATCHEND days" '+%Y%m%d')

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

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

log2cw $NJLOGGRP $NJLOGSTREAM "running phase 1 for dates ${begdate} to ${rundate}" runDistrib

conda activate $HOME/miniconda3/envs/${WMPL_ENV}

log2cw $NJLOGGRP $NJLOGSTREAM "creating the run script" runDistrib
logger -s -t runDistrib "creating the run script"

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

log2cw $NJLOGGRP $NJLOGSTREAM "get server details" runDistrib
privip=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].PrivateIpAddress --output text)
while [ "$privip" == "" ] ; do
sleep 5
log2cw $NJLOGGRP $NJLOGSTREAM "getting IP address" runDistrib
privip=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].PrivateIpAddress --output text)
done

log2cw $NJLOGGRP $NJLOGSTREAM "deploy the script to the server $privip and run it" runDistrib
logger -s -t runDistrib "deploy the script to the server $CALCSERVERIP and run it"

scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$privip:data/distrib/$execdist
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execdist
while [ $? -ne 0 ] ; do
# in case the server isn't responding to ssh sessions yet
sleep 10
log2cw $NJLOGGRP $NJLOGSTREAM "server not responding yet, retrying" runDistrib
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$privip:data/distrib/$execdist
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execdist
done
# push the python code and ECS templates required
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/clusdetails-* $SERVERUSERID@$privip:src/ukmon_pylib/traj
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/taskrunner*.json $SERVERUSERID@$privip:src/ukmon_pylib/traj
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/consolidateDistTraj.py $SERVERUSERID@$privip:src/ukmon_pylib/traj
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/distributeCandidates.py $SERVERUSERID@$privip:src/ukmon_pylib/traj
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/pickleAnalyser.py $SERVERUSERID@$privip:src/ukmon_pylib/traj
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/clusdetails-* $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/taskrunner*.json $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/consolidateDistTraj.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/distributeCandidates.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/pickleAnalyser.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/ShowerAssociation.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/utils/convertSolLon.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/utils/

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

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

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

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

log2cw $NJLOGGRP $NJLOGSTREAM "monitoring and waiting for completion" runDistrib
logger -s -t runDistrib "monitoring and waiting for completion"

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

mkdir -p $DATADIR/distrib
cd $DATADIR/distrib

log2cw $NJLOGGRP $NJLOGSTREAM "restarting server to consolidate results" runDistrib
logger -s -t runDistrib "restarting server to consolidate results"

stat=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].State.Code --output text)
if [ $stat -eq 80 ]; then
aws ec2 start-instances --instance-ids $SERVERINSTANCEID
fi
log2cw $NJLOGGRP $NJLOGSTREAM "waiting for the server to be ready" runDistrib
while [ "$stat" -ne 16 ]; do
sleep 30
if [ $stat -eq 80 ]; then
aws ec2 start-instances --instance-ids $SERVERINSTANCEID
fi
log2cw $NJLOGGRP $NJLOGSTREAM "checking - status is ${stat}" runDistrib
stat=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].State.Code --output text)
done
privip=$(aws ec2 describe-instances --instance-ids $SERVERINSTANCEID --query Reservations[*].Instances[*].PrivateIpAddress --output text)

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

log2cw $NJLOGGRP $NJLOGSTREAM "running consolidation" runDistrib
scp -i $SERVERSSHKEY $execConsolsh $SERVERUSERID@$privip:data/distrib/$execcons
ssh -i $SERVERSSHKEY $SERVERUSERID@$privip "data/distrib/$execcons"
logger -s -t runDistrib "running consolidation"

scp -i $SERVERSSHKEY $execConsolsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execcons
ssh -i $SERVERSSHKEY $SERVERUSERID@$CALCSERVERIP "data/distrib/$execcons"

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

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

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

logger -s -t runDistrib "copying data to batch server and tidying up"

# grab a copy of the indvidual container dbs so we can get a list of new solutions
rm -Rf $DATADIR/latest/contdbs/
mkdir -p $DATADIR/latest/contdbs/
Expand All @@ -154,8 +135,6 @@ aws s3 mv $UKMONSHAREDBUCKET/matches/distrib${TESTSUFF}/${rundate}.pickle $DATAD
aws s3 sync $UKMONSHAREDBUCKET/matches/distrib${TESTSUFF}/ $SRC/logs/distrib/ --exclude "*" --include "correl*.log" --exclude "logs/" --quiet
aws s3 rm $UKMONSHAREDBUCKET/matches/distrib${TESTSUFF}/ --exclude "*" --include "correl*.log" --exclude "logs/" --recursive --quiet

log2cw $NJLOGGRP $NJLOGSTREAM "compressing the processed data" runDistrib

mkdir -p $DATADIR/trajdb
tar czvf $DATADIR/trajdb/databases_${rundate}.tgz $DATADIR/distrib/*.db
mkdir -p $DATADIR/distrib/containers
Expand All @@ -168,7 +147,4 @@ find $DATADIR/distrib/containers/ -name "cont*.tgz" -mtime +30 -exec rm -f {} \;
find $DATADIR/distrib/ -maxdepth 1 -name "20*.tgz" -mtime +30 -exec rm -f {} \;
rm -f $DATADIR/distrib/${rundate}.pickle


# and then clear the profile again
unset AWS_PROFILE
log2cw $NJLOGGRP $NJLOGSTREAM "finished runDistrib" runDistrib
logger -s -t "finished runDistrib"
Loading
Loading