Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AossTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
AossTower
Commits
b7cb3efa
Verified
Commit
b7cb3efa
authored
7 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Add starter bash script for legacy db insert
parent
4215322a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aosstower/level_00/legacy_db_insert.py
+4
-1
4 additions, 1 deletion
aosstower/level_00/legacy_db_insert.py
scripts/start_tower_legacy_db_ingest.sh
+28
-0
28 additions, 0 deletions
scripts/start_tower_legacy_db_ingest.sh
with
32 additions
and
1 deletion
aosstower/level_00/legacy_db_insert.py
+
4
−
1
View file @
b7cb3efa
...
...
@@ -78,8 +78,11 @@ def main(*args):
src
=
open
(
args
.
src
,
"
r
"
)
record_gen
=
read_frames
(
src
,
tail
=
args
.
tail
)
for
record
in
record_gen
:
for
idx
,
record
in
enumerate
(
record_gen
)
:
data
=
(
record
[
'
stamp
'
],
record
)
if
args
.
debug
:
print
(
idx
,
data
)
continue
failures
=
legacy_db
.
insert_records
([
data
],
station
=
station
)
if
failures
:
ERR
.
info
(
"
(%s) %s
"
,
failures
[
0
][
0
],
record
)
This diff is collapsed.
Click to expand it.
scripts/start_tower_legacy_db_ingest.sh
0 → 100644
+
28
−
0
View file @
b7cb3efa
#!/usr/bin/env bash
#
# Runs the tower ingest in a screen session named 'tower_db_ingest'.
#
# If a screen session is already running with that name, exit, otherwise start
# a new detached screen session named 'tower_db_ingest'.
#
NAME
=
tower_db_ingest
PYENV
=
/opt/metobs/aoss_tower
#SRC=/mnt/data/ingest/rig_tower/rig_tower.dat
#DBURL=postgresql://buoy_ingest:bu0y1ngest@tahiti.ssec.wisc.edu/buoy
DBURL
=
postgresql://metobs_ingest:m3t0b5@metobs01.instrument/metobs
LOGFN
=
$PYENV
/log/tower_db_ingest.log
export
PGAPPNAME
=
tower_db_ingest
SCRN
=
$(
screen
-list
|
grep
$NAME
|
awk
'{print $1}'
)
if
[
-n
"
$SCRN
"
]
;
then
echo
Screen already running:
$SCRN
else
screen
-S
$NAME
-d
-m
$PYENV
/bin/python
-m
aosstower.level_00.legacy_db_insert
\
--loglvl
info
\
--logfn
$LOGFN
\
--ldmp
\
$DBURL
\
RIGTower
echo
Started
in
screen
$(
screen
-list
|
grep
$NAME
|
awk
'{print $1}'
)
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment