Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
b7370c0
migration support scripts
markmac99 May 15, 2026
e4730be
migration support scripts
markmac99 May 15, 2026
9f74d2f
tweaks to migration scripts
markmac99 May 15, 2026
a438f1b
more tweaks
markmac99 May 15, 2026
0a8a363
bugfix
markmac99 May 15, 2026
5f9dade
bugfixes
markmac99 May 15, 2026
d029f09
typo
markmac99 May 15, 2026
5cb579d
bugfix in routine to clean up deleted trajectories
markmac99 May 16, 2026
f7ea813
add status column to matches table
markmac99 May 17, 2026
0f21ab8
add statusflag to full_csv file
markmac99 May 17, 2026
3b747e3
updated match dta api to use status flag in database
markmac99 May 17, 2026
eaac453
add traj_id to csv, parquet and mariadb tables
markmac99 May 17, 2026
c42acbd
add index on traj_id to matches table
markmac99 May 17, 2026
c38148f
simplify and update dataMaintenance to handle mariadb
markmac99 May 17, 2026
3fa5331
push an extra file to the calcserver
markmac99 May 17, 2026
52da05f
add function to remove reprocessed trajs from the calcserver and s3
markmac99 May 17, 2026
a5431e5
add support to cleardown recalced trajectories #474
markmac99 May 17, 2026
986d6fe
make sure sqlite is also in line
markmac99 May 17, 2026
fd53b87
missed a newline
markmac99 May 17, 2026
8e91d25
missing qnotemarks
markmac99 May 17, 2026
224ed29
incorrect location of databases
markmac99 May 17, 2026
24b7934
add some messaging
markmac99 May 17, 2026
b436cad
pin maps api to 3.65 to prevent coverage map issues after May 2026
markmac99 May 17, 2026
0244e8c
handle TERM better on Ubuntu
markmac99 May 19, 2026
c1c5e04
handle case when no deleted traj in date range
markmac99 May 19, 2026
50af4cb
make logging more consistent
markmac99 May 19, 2026
630944a
add calcserver config and build info to github
markmac99 May 19, 2026
ee48554
add readme for calcengine rebuilds
markmac99 May 19, 2026
56c1db3
move runtime distib scripts to a sensible place
markmac99 May 19, 2026
e3ac168
update cost notes
markmac99 May 19, 2026
c9fd2c8
fix typo
markmac99 May 19, 2026
b33cf8a
Updating meteor shower analysis code as per issue 477
markmac99 May 19, 2026
91f7ca6
updtate the installer
markmac99 May 19, 2026
655b63a
typo
markmac99 May 19, 2026
a424b5a
add missing requirement
markmac99 May 19, 2026
bbc229d
avoid creating reports for every single minor shower
markmac99 May 19, 2026
86a27e9
remove disused file
markmac99 May 19, 2026
1280e9d
relocate data dictionary
markmac99 May 19, 2026
7f7f929
Restore original major/minor filter
markmac99 May 19, 2026
7085d16
restore reporting on less major showers
markmac99 May 19, 2026
0677349
tidy up shower stats page
markmac99 May 19, 2026
5a3e121
typo
markmac99 May 19, 2026
431af52
anothe typo
markmac99 May 19, 2026
c0f567f
small bugfixes
markmac99 May 19, 2026
ed8e97b
add some debug
markmac99 May 19, 2026
91e47bc
update paired/unpaired process
markmac99 May 20, 2026
cb035b5
bugfix in timing metrics calcs
markmac99 May 20, 2026
930549b
more work on #383 to get a list of used and unused detections
markmac99 May 20, 2026
18acf2d
typo
markmac99 May 20, 2026
0157c55
add index to singles table
markmac99 May 20, 2026
2538e57
remove unused file
markmac99 May 20, 2026
ecd1f2f
update mariadb directly with uncalibrated status
markmac99 May 20, 2026
f9e9909
typo
markmac99 May 20, 2026
b806f88
another typo
markmac99 May 20, 2026
f16a96f
add index on status
markmac99 May 20, 2026
c769f35
support processing historical uncal data
markmac99 May 20, 2026
4fe459c
forgot to readlines
markmac99 May 20, 2026
48f3431
need to strop newlines
markmac99 May 20, 2026
c79c2ec
add debug
markmac99 May 20, 2026
dbdcab5
working now
markmac99 May 20, 2026
4b9e0df
add code to update matched images in the sql database
markmac99 May 20, 2026
3fa9c56
update mariadb each day with matched and uncal status
markmac99 May 20, 2026
98738ae
performance improvement
markmac99 May 20, 2026
a51c888
another tweak to the script that checks account status
markmac99 May 21, 2026
0ebf8cc
remove unnecessary code
markmac99 May 21, 2026
57eee8a
minor fixes
markmac99 May 21, 2026
9032bd4
Updates to pause livestream refreshes if daterange selected
markmac99 May 21, 2026
1c66c58
add ukmeteors gmail app key to SSM
markmac99 May 22, 2026
cb9caf4
update email sender to use ukmeteors account
markmac99 May 22, 2026
61ca707
ping paho-mqtt version
markmac99 May 22, 2026
9d08b78
remove unused code to post to MQ - doesn't work
markmac99 May 22, 2026
d32f875
remove unused EC2 instance 'adminserver'
markmac99 May 23, 2026
a7a84bd
support for creating contact sheets from a list of images
markmac99 May 23, 2026
1dbf600
update code to send ad-hoc message
markmac99 May 27, 2026
17a630d
bugfixes in faily report issue #479
markmac99 May 27, 2026
ac087fc
closing #479
markmac99 May 27, 2026
98d0093
bump version 2026.05.3 -> 2026.05.4
markmac99 May 27, 2026
f47a9bd
Update scripts that still mention the old server
markmac99 May 27, 2026
ccaef61
update the readme
markmac99 May 27, 2026
dfc96f3
disable peering and start removing ukmon resources from my account
markmac99 May 27, 2026
7dd438f
update ref to old batch server
markmac99 May 27, 2026
ed0c2e5
remove unused permissions and roles
markmac99 Jun 1, 2026
4bcfcec
remove support for old server
markmac99 Jun 1, 2026
3341b70
remove unused SSM params
markmac99 Jun 1, 2026
8599588
removing further disused perms set up by terraform
markmac99 Jun 1, 2026
a5c25a4
further removal of unused terraform artefacts
markmac99 Jun 1, 2026
c6c173a
removing mjmm assets from project as server migrated to ukmda account
markmac99 Jun 8, 2026
3e66dc4
removing vestiges of mjmm aws account and reorging terraform code
markmac99 Jun 8, 2026
126e0ed
upgrade ddb GSIs to use key_schemas
markmac99 Jun 8, 2026
1507853
update readme to remove mentions of mjmm account
markmac99 Jun 8, 2026
17fc149
removing unused files
markmac99 Jun 8, 2026
0186d53
put server setup files for batchserver in its own folder
markmac99 Jun 8, 2026
1665294
missing fields sts and traj_id
markmac99 Jun 24, 2026
3768e27
Changes to support email receipt and rules
markmac99 Jul 1, 2026
e9ef65e
ignore aws sam build folders
markmac99 Jul 1, 2026
631f078
initial build of viduploader lambda
markmac99 Jul 1, 2026
c5c5bad
initial pass at vid uploader
markmac99 Jul 1, 2026
b2df3ad
support for testing coverage-maps
markmac99 Jul 9, 2026
e4b14e4
support for test coverage maps
markmac99 Jul 9, 2026
8059b19
testing switch to geoJSON
markmac99 Jul 9, 2026
406e201
relocate latest coverage maps
markmac99 Jul 9, 2026
5c7bfba
minor debugging
markmac99 Jul 9, 2026
ed14939
tweaking use of geoJSON
markmac99 Jul 9, 2026
c59f3a1
spelling misstake
markmac99 Jul 9, 2026
7f32d5f
more testing
markmac99 Jul 9, 2026
fc13c1a
plugging away
markmac99 Jul 9, 2026
e27bd2e
typo
markmac99 Jul 9, 2026
0af0bd8
more tweakery
markmac99 Jul 9, 2026
1eed509
fetch local for kml
markmac99 Jul 9, 2026
2f13352
remove some premature changes
markmac99 Jul 9, 2026
0797d87
fix tests for stations
markmac99 Jul 9, 2026
a3cf789
keep on trying
markmac99 Jul 9, 2026
607fbcf
moar
markmac99 Jul 9, 2026
c170d0c
more work on replacing kmllayer
markmac99 Jul 9, 2026
625e16e
missed semicolons
markmac99 Jul 9, 2026
f53e771
i hate javascript
markmac99 Jul 9, 2026
ed79b23
twatting about with js
markmac99 Jul 9, 2026
52334fd
more effort
markmac99 Jul 9, 2026
cfd7fa7
starting to lose the will
markmac99 Jul 9, 2026
0cffe35
rubbish
markmac99 Jul 9, 2026
78f3749
more work
markmac99 Jul 9, 2026
d88b05a
add correct url
markmac99 Jul 9, 2026
7ea5a98
add test
markmac99 Jul 9, 2026
2d509bd
another go
markmac99 Jul 9, 2026
1f595c0
add full url
markmac99 Jul 10, 2026
0ddb0cb
more testing
markmac99 Jul 10, 2026
55b1920
try async
markmac99 Jul 10, 2026
8e0bda1
may have got it working with async
markmac99 Jul 10, 2026
a566c2f
typo and re-add circles
markmac99 Jul 10, 2026
bf16238
correct station ids
markmac99 Jul 10, 2026
c69856a
tweaking
markmac99 Jul 10, 2026
4ad5160
recentre
markmac99 Jul 10, 2026
d5cbf35
Bump to python 3.14 and fix a few small bugs
markmac99 Jul 12, 2026
964c344
Updating to python 3.14
markmac99 Jul 12, 2026
d56bf9a
adding tests for fetchECSV
markmac99 Jul 13, 2026
a779eb4
add informative messages
markmac99 Jul 13, 2026
969d0f2
workaround for missing logins file #487
markmac99 Jul 13, 2026
81501ca
fix for issue #486 invalid escape seq in costMetrics.py
markmac99 Jul 13, 2026
3fdfc93
update fireballapi to python 3.14 and create test case
markmac99 Jul 13, 2026
f578a37
migrate searcharchive to python3.14 update test
markmac99 Jul 13, 2026
4744bb0
update getLiveImages to python 3.14
markmac99 Jul 13, 2026
18920fc
Update matchdataapi to py314
markmac99 Jul 13, 2026
aa18f2d
update matchpickleapi to Pytthon 3.13 - note not 3.14 as no compatibl…
markmac99 Jul 13, 2026
fa33d36
updating to python 3.14
markmac99 Jul 13, 2026
8871404
function to backfill missing traj ids
markmac99 Jul 13, 2026
accee0f
Add triggers for video upload process
markmac99 Jul 15, 2026
3fe1ca9
slight docstring change to cameraStatusReport
markmac99 Jul 15, 2026
8c4073f
add log group retention for lambda log groups
markmac99 Jul 15, 2026
a41cdba
improvements to mergeNewOrbit
markmac99 Jul 15, 2026
65ced1e
Add functonality to add notes to the orbit pages based on video uploads
markmac99 Jul 15, 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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -617,3 +617,8 @@ fbcollector/config.ini
usermgmt/windows/stationmaint.ini
usermgmt/windows/README.md
fbCollector/README.html
archive/share/combined_shower_table.parquet
archive/share/gmn_shower_table_20230518.txt
archive/share/IMO_Working_Meteor_Shower_List.xml
**/.aws-sam/**
archive/lambdas/*/tests/new_output.txt
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
# UK Meteor Data Analysis Shared code and libraries
version: 2026.05.3
version: 2026.05.4

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

## ARCHIVE folder
The code for archive.ukmeteors.co.uk, including the data processing pipeline.

### Software Deployment
The software is a mix of Python and Bash shell scripts. All software deployment uses Ansible.
The software is a mix of Python and Bash shell scripts. Deployment is via an install script.

#### Scripts and Python
The shell scripts and python code are deployed with `deploy-analysis.yml`. Use the "prod" tag to push to production, and the "dev" tag to push to a development environment. Deployments target the batch server in the MM account.
The shell scripts and python code are deployed with `install_or_update.sh`. First, clone the repository onto the target server then run `install_or_update.sh` with an argument "PROD" to create/update a production environment, or "DEV" for a development environment. .

```bash
ansible-playbook deploy-analysis.yml -t prod
```
#### Configuration Files
Parameters are created with Terraform and stored in the AWS Systems Manager Parameter Store.
The configuration is then deployed with `deploy-config.yml` which runs a script to create the `config.ini` file.
The configuration is then deployed with `utils/makeConfig.sh` which runs a script to create the `config.ini` file.

#### Website
Much of the website is dynamically created by the Python and Bash scripts or by AWS Lambda functions.
Expand All @@ -30,7 +27,3 @@ Done with Terraform - see the Terraform folder readme for details.

## TESTS folder
This folder contains tests for the APIs and some of the Python code. Further tests are being developed and will be added to this folder. See the README in the folder for more details.

## USERMGMT folder
A python app that is used to add/modify contributors' camera details and grant them permission to upload.
Not intended for general use, this tool can only be used if you have SSH and AWS keys for the admin role.
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.05.3
version: 2026.05.4

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

Expand Down
21 changes: 11 additions & 10 deletions archive/analysis/consolidateOutput.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ fi

cd ${DATADIR}
# consolidate UFO and RMS original CSVs.
logger -s -t consolidateOutput "starting"
logger -s -t $(basename $0 .sh) "starting"

# note - copying from production S3 even in dev so we have the latest data
aws s3 sync s3://ukmda-shared/consolidated/ ${DATADIR}/consolidated --exclude "temp/*" --quiet
aws s3 mv s3://ukmda-shared/consolidated/temp/ ${DATADIR}/consolidated/temp --recursive --quiet

logger -s -t consolidateOutput "Consolidating RMS and UFO CSVs"
logger -s -t $(basename $0 .sh) "Consolidating RMS and UFO CSVs"
consdir=${DATADIR}/consolidated/temp
mkdir -p ${DATADIR}/single/rawcsvs
ls -1 $consdir/*.csv | while read csvf
do
flen=$(wc -l $csvf | awk '{print $1}')
if [ $flen -lt 2 ] ; then
logger -s -t consolidateOutput "skipping empty file $csvf"
logger -s -t $(basename $0 .sh) "skipping empty file $csvf"
rm $csvf
else
bn=$(basename $csvf)
Expand All @@ -62,14 +63,14 @@ do
fi
done

logger -s -t consolidateOutput "purging older raw data which is on S3 anyway"
logger -s -t $(basename $0 .sh) "purging older raw data which is on S3 anyway"
find ${DATADIR}/single/rawcsvs -mtime +180 -exec rm -f {} \;


logger -s -t consolidateOutput "pushing consolidated information back"
logger -s -t $(basename $0 .sh) "pushing consolidated information back"
aws s3 sync ${DATADIR}/consolidated ${UKMONSHAREDBUCKET}/consolidated/ --exclude 'UKMON*' --quiet

logger -s -t consolidateOutput "Getting latest trajectory data"
logger -s -t $(basename $0 .sh) "Getting latest trajectory data"

# collect the latest trajectory CSV files
# make sure target folders exist
Expand All @@ -82,19 +83,19 @@ aws s3 sync s3://ukmda-shared/matches/RMSCorrelate/trajectories/${yr}/plots/ $DA
aws s3 mv ${UKMONSHAREDBUCKET}/matches/${yr}/fullcsv/ ${DATADIR}/orbits/${yr}/fullcsv --recursive --exclude "*" --include "*.csv" --quiet

# get the latest matched data generated by WMPL
logger -s -t consolidateOutput "getting matched detections for $yr"
logger -s -t $(basename $0 .sh) "getting matched detections for $yr"
if [ ! -f ${DATADIR}/matched/matches-full-$yr.csv ] ; then
cp $SRC/analysis/templates/match_hdr_full.txt ${DATADIR}/matched/matches-full-$yr.csv
fi
logger -s -t consolidateOutput "getting new matched detections for today"
logger -s -t $(basename $0 .sh) "getting new matched detections for today"
if [ ! -f ${DATADIR}/searchidx/matches-full-$yr-new.csv ] ; then
cp $SRC/analysis/templates/match_hdr_full.txt ${DATADIR}/searchidx/matches-full-$yr-new.csv
fi
cat ${DATADIR}/orbits/$yr/fullcsv/$yr*.csv >> ${DATADIR}/matched/matches-full-$yr.csv
cat ${DATADIR}/orbits/$yr/fullcsv/$yr*.csv >> ${DATADIR}/searchidx/matches-full-$yr-new.csv
mv ${DATADIR}/orbits/$yr/fullcsv/$yr*.csv ${DATADIR}/orbits/${yr}/fullcsv/processed

logger -s -t consolidateOutput "purging older raw data"
logger -s -t $(basename $0 .sh) "purging older raw data"
find ${DATADIR}/orbits/${yr}/fullcsv/processed -mtime +180 -exec rm -f {} \;
# and last year, because the data is split across dated folders
lyr=$(date -d 'last year' +%Y)
Expand All @@ -119,4 +120,4 @@ aws s3 sync $DATADIR/matched/ $UKMONSHAREDBUCKET/matches/matchedpq/ --quiet --ex
aws s3 sync $DATADIR/matched/ $WEBSITEBUCKET/browse/parquet/ --exclude "*" --include "*.snap" --exclude "*.bkp" --exclude "*.gzip" --quiet
aws s3 sync $DATADIR/single/ $WEBSITEBUCKET/browse/parquet/ --exclude "*" --include "*.snap" --exclude "*.bkp" --exclude "*.gzip" --quiet

logger -s -t consolidateOutput "finished"
logger -s -t $(basename $0 .sh) "finished"
4 changes: 2 additions & 2 deletions archive/analysis/createSearchable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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}
logger -s -t createSearchable "starting"
logger -s -t $(basename $0 .sh) "starting"

yr=$1
whichpass=$2
Expand All @@ -38,4 +38,4 @@ fi

aws s3 sync $DATADIR/searchidx/ $WEBSITEBUCKET/search/indexes/ --exclude "*" --include "*allevents.csv" --quiet

logger -s -t createSearchable "finished"
logger -s -t $(basename $0 .sh) "finished"
14 changes: 7 additions & 7 deletions archive/analysis/findAllMatches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +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}

logger -s -t findAllMatches "starting"
logger -s -t $(basename $0 .sh) "starting"

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

Expand All @@ -48,27 +48,27 @@ 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')

logger -s -t findAllMatches "solving for ${startdt} to ${enddt}"
logger -s -t findAllMatches "start runDistrib"
logger -s -t $(basename $0 .sh) "solving for ${startdt} to ${enddt}"
logger -s -t $(basename $0 .sh) "start runDistrib"

$SRC/analysis/runDistrib.sh $MATCHSTART $MATCHEND
$SRC/utils/cleanupDeletedTrajs.sh

logger -s -t findAllMatches "Solving Run Done"
logger -s -t $(basename $0 .sh) "Solving Run Done"

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

if [ "$success" == "" ]
then
python -c "from utils.sendAnEmail 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')"
echo problems with solver
fi

python -m maintenance.rerunFailedLambdas

cd $here

logger -s -t findAllMatches "start reportOfLatestMatches"
logger -s -t $(basename $0 .sh) "running reportOfLatestMatches"

matchlog=${SRC}/logs/matchJob.log
python -m reports.reportOfLatestMatches $DATADIR/latest/contdbs $DATADIR/dailyreports $rundate
Expand All @@ -82,4 +82,4 @@ fi
find $SRC/logs -name "matches*" -mtime +7 -exec gzip {} \;
find $SRC/logs -name "matches*" -mtime +30 -exec rm -f {} \;

logger -s -t findAllMatches "finished"
logger -s -t $(basename $0 .sh) "finished"
4 changes: 2 additions & 2 deletions archive/analysis/getBadStations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ 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}

logger -s -t getBadStations "starting"
logger -s -t $(basename $0 .sh) "starting"
aws s3 sync $UKMONSHAREDBUCKET/admin $DATADIR/admin --dryrun --quiet

python -m reports.reportBadCameras 3
logger -s -t getBadStations "finished"
logger -s -t $(basename $0 .sh) "finished"
4 changes: 4 additions & 0 deletions archive/analysis/getLogData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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}

logger -s -t $(basename $0 .sh) "starting"

if [ "$1" != "" ] ; then
rundate=$1
logfile=$DATADIR/lastlogs/lastlog-${rundate}.html
Expand Down Expand Up @@ -98,3 +100,5 @@ aws s3 cp $DATADIR/lastlogs/index.html $WEBSITEBUCKET/reports/lastlogs/ --quiet
find $DATADIR/failed -mtime +90 -exec rm -f {} \;

find $DATADIR/lastlogs -name "lastlog*" -mtime +90 -exec rm -f {} \;

logger -s -t $(basename $0 .sh) "finished"
9 changes: 5 additions & 4 deletions archive/analysis/getRMSSingleData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ 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}

logger -s -t getRMSSingleData "starting"
logger -s -t $(basename $0 .sh) "starting"

indir=$UKMONSHAREDBUCKET/matches/single/new/
outdir=$DATADIR/single/new
mkdir -p $outdir/processed > /dev/null 2>&1
Expand Down Expand Up @@ -45,7 +46,7 @@ do
mv $i $outdir/processed
done

logger -s -t getRMSSingleData "convert to parquet"
logger -s -t $(basename $0 .sh) "convert to parquet"
if [ -f $mrgfile ] ; then
python -m converters.toParquet $mrgfile
fi
Expand All @@ -55,11 +56,11 @@ if [ -f $newsngl ] ; then
fi

# push to S3 bucket for future use by AWS tools
logger -s -t getRMSSingleData "copy to S3 bucket"
logger -s -t $(basename $0 .sh) "copy to S3 bucket"
aws s3 sync $SRC/data/single/ $UKMONSHAREDBUCKET/matches/single/ --exclude "*" --include "*.csv" --exclude "new/*" --exclude "rawcsvs/*" --exclude "used/*" --quiet
aws s3 sync $SRC/data/single/ $UKMONSHAREDBUCKET/matches/singlepq/ --exclude "*" --include "*.parquet.snap" --exclude "*new.parquet.snap" --quiet

logger -s -t getRMSSingleData "purge processed data"
find $outdir/processed -mtime +180 -exec rm -f {} \;

logger -s -t getRMSSingleData "finished"
logger -s -t $(basename $0 .sh) "finished"
10 changes: 6 additions & 4 deletions archive/analysis/reportActiveShowers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
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}
logger -s -t reportActiveShowers "starting"

logger -s -t $(basename $0 .sh) "starting"

if [ $# -eq 0 ]; then
yr=$(date +%Y)
Expand All @@ -27,16 +28,17 @@ else
rundt=${1}$(date +%m%d)
fi

logger -s -t reportActiveShowers "report on active showers"
logger -s -t $(basename $0 .sh) "start reportActiveShowers"
python -m reports.reportActiveShowers -m

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
logger -s -t reportActiveShowers "updating annual index"
logger -s -t $(basename $0 .sh) "updating annual index"
${SRC}/website/createReportIndex.sh ${yr}

python -m analysis.summaryAnalysis ${yr}
aws s3 sync $DATADIR/reports/${yr}/showers $WEBSITEBUCKET/reports/${yr}/showers --quiet
logger -s -t reportActiveShowers "finished"

logger -s -t $(basename $0 .sh) "finished"
38 changes: 20 additions & 18 deletions archive/analysis/runDistrib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ here="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# load the configuration
source $here/../config.ini >/dev/null 2>&1

logger -s -t runDistrib "starting runDistrib"
logger -s -t $(basename $0 .sh) "starting"

if [ $# -gt 0 ] ; then
if [ "$1" != "" ] ; then
Expand All @@ -35,9 +35,9 @@ fi
begdate=$(date --date="-$MATCHSTART days" '+%Y%m%d')
rundate=$(date --date="-$MATCHEND days" '+%Y%m%d')

logger -s -t runDistrib "running phase 1 for dates ${begdate} to ${rundate}"
logger -s -t $(basename $0 .sh) "running phase 1 for dates ${begdate} to ${rundate}"

logger -s -t runDistrib "start correlation server"
logger -s -t $(basename $0 .sh) "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
Expand All @@ -47,20 +47,20 @@ done

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

logger -s -t runDistrib "creating the run script"
logger -s -t $(basename $0 .sh) "creating the run script"

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

logger -s -t runDistrib "deploy the script to the server $CALCSERVERIP and run it"
logger -s -t $(basename $0 .sh) "deploy the script to the server $CALCSERVERIP and run it"

scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execdist
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:runtime/scripts/$execdist
while [ $? -ne 0 ] ; do
# in case the server isn't responding to ssh sessions yet
sleep 10
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:data/distrib/$execdist
scp -i $SERVERSSHKEY $execMatchingsh $SERVERUSERID@$CALCSERVERIP:runtime/scripts/$execdist
done
# push the python code and ECS templates required
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/clusdetails-* $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/traj/
Expand All @@ -70,17 +70,19 @@ rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/traj/distributeCandidates.py $SERVER
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/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/maintenance/dataMaintenance.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/maintenance/
rsync -avz -e "ssh -i $SERVERSSHKEY" $PYLIB/analysis/getUsedUnused.py $SERVERUSERID@$CALCSERVERIP:src/ukmon_pylib/analysis/

# now run the script
logger -s -t runDistrib "start distributed processing"
ssh -i $SERVERSSHKEY $SERVERUSERID@$CALCSERVERIP "data/distrib/$execdist"
logger -s -t $(basename $0 .sh) "start distributed processing"
ssh -i $SERVERSSHKEY $SERVERUSERID@$CALCSERVERIP "runtime/scripts/$execdist"

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@$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 {} \;"

logger -s -t runDistrib "job run, stop the server again"
logger -s -t $(basename $0 .sh) "job run, stop the server again"
aws ec2 stop-instances --instance-ids $SERVERINSTANCEID

logger -s -t runDistrib "monitoring and waiting for completion"
Expand All @@ -90,7 +92,7 @@ python -c "from traj.distributeCandidates import monitorProgress as mp; mp('${ru
mkdir -p $DATADIR/distrib
cd $DATADIR/distrib

logger -s -t runDistrib "restarting server to consolidate results"
logger -s -t $(basename $0 .sh) "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
Expand All @@ -109,20 +111,20 @@ execConsolsh=/tmp/$execcons
python -c "from traj.createDistribMatchingSh import createExecConsolSh;createExecConsolSh($MATCHSTART, $MATCHEND, '$execConsolsh', '$TESTMODE')"
chmod +x $execConsolsh

logger -s -t runDistrib "running consolidation"
logger -s -t $(basename $0 .sh) "running consolidation"

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

logger -s -t runDistrib "finished consolidation, copying databases"
logger -s -t $(basename $0 .sh) "finished consolidation, copying databases"

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 {} \;"

logger -s -t runDistrib "stopping calcserver again"
logger -s -t $(basename $0 .sh) "stopping calcserver again"
aws ec2 stop-instances --instance-ids $SERVERINSTANCEID

logger -s -t runDistrib "copying data to batch server and tidying up"
logger -s -t $(basename $0 .sh) "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/
Expand All @@ -147,4 +149,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

logger -s -t "finished runDistrib"
logger -s -t $(basename $0 .sh) "finished"
Loading
Loading