Skip to content

Commit

Permalink
Merge pull request #3 from oceanzus/soh_bug
Browse files Browse the repository at this point in the history
Antelope invalid channels fix and yield update.
  • Loading branch information
oceanzus authored Jun 6, 2023
2 parents 5b44253 + e93b504 commit dae3dc2
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 27 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.0.43

- ANTELOPE - filters out invalid channels

Version 0.0.42

- ZPLSC - yield in every iteration of loop in _submit_unprocessed_files
Expand Down
2 changes: 1 addition & 1 deletion ooi_port_agent/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.42'
__version__ = '0.0.43'
2 changes: 1 addition & 1 deletion ooi_port_agent/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def _heartbeat(self):

for service in self.config['ports']:
name, service_id = self.get_service_name_id(service)
yield get(check_string + service_id)
yield put(check_string + service_id, json.dumps({}))

@inlineCallbacks
def get_consul_host(self):
Expand Down
68 changes: 51 additions & 17 deletions ooi_port_agent/antelope_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,56 @@ def resumeProducing(self):

def create_packets(orb_packet, pktid):
packets = []
for channel in orb_packet.channels:
d = {'calib': channel.calib,
'calper': channel.calper,
'net': channel.net,
'loc': channel.loc,
'sta': channel.sta,
'chan': channel.chan,
'data': channel.data,
'nsamp': channel.nsamp,
'samprate': channel.samprate,
'time': channel.time,
'type_suffix': orb_packet.type.suffix,
'version': orb_packet.version,
'pktid': pktid,
}

packets.extend(Packet.create(pickle.dumps(d, protocol=-1), PacketType.PICKLED_FROM_INSTRUMENT))
invalid_channels = ['SOH']

# Let's test to see if we can access the Packet
if orb_packet:
pass
else:
return packets

# Checking for invalid channels and setting data to empty or zero
try:
for channel in orb_packet.channels:
try:
if channel.chan in invalid_channels:
d = {'calib': channel.calib,
'calper': channel.calper,
'net': channel.net,
'loc': channel.loc,
'sta': channel.sta,
'chan': channel.chan,
'data': [],
'nsamp': 0,
'samprate': channel.samprate,
'time': channel.time,
'type_suffix': orb_packet.type.suffix,
'version': orb_packet.version,
'pktid': pktid,
}
else:
d = {'calib': channel.calib,
'calper': channel.calper,
'net': channel.net,
'loc': channel.loc,
'sta': channel.sta,
'chan': channel.chan,
'data': channel.data,
'nsamp': channel.nsamp,
'samprate': channel.samprate,
'time': channel.time,
'type_suffix': orb_packet.type.suffix,
'version': orb_packet.version,
'pktid': pktid,
}
packets.extend(Packet.create(pickle.dumps(d, protocol=-1), PacketType.PICKLED_FROM_INSTRUMENT))
except Exception as exi:
log.msg('Exception at: create_packets')
log.msg(exi)
pass
except Exception as exo:
log.msg('Exception at: orb_packet.channels')
log.msg(exo)
pass
return packets

3 changes: 2 additions & 1 deletion ooi_port_agent/port_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""
import logging
import os
import os, sys

from docopt import docopt
from twisted.internet import reactor
Expand Down Expand Up @@ -91,6 +91,7 @@ def main():

try:
os.environ['ANTELOPE_PYTHON_GILRELEASE'] = '1'
sys.path.append(os.environ['ANTELOPE'] + "/data/python")
from antelope_agent import AntelopePortAgent
except ImportError:
AntelopePortAgent = None
Expand Down
52 changes: 45 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
twisted
docopt
pyyaml
pysmb
pika
APScheduler==2.1.0
asn1crypto==1.4.0
attrs==21.2.0
Automat==20.2.0
bcrypt==3.1.7
certifi==2020.6.20
cffi==1.14.0
click
cython
scandir
constantly==15.1.0
cryptography==2.3.1
cycler==0.10.0
Cython==0.29.14
docopt==0.6.2
enum34==1.1.6
future==0.15.2
httpie==0.9.3
hyperlink==21.0.0
idna
incremental==17.5.0
ipaddress==1.0.23
matplotlib==1.5.1
meld3==1.0.2
ntplib
numpy==1.11.1
pika==0.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
Pygments==2.1.3
PyHamcrest
pyOpenSSL==19.0.0
pyparsing==2.1.5
pysmb==1.1.18
python-consul==0.6.1
python-dateutil==2.5.3
pytz==2016.6.1
PyYAML==5.2
pyzmq==19.0.2
requests==2.9.1
scandir==1.10.0
scipy==0.18.0
service-identity==18.1.0
six==1.15.0
Twisted==16.1.1
txZMQ==0.8.2
zope.interface==4.1.3

0 comments on commit dae3dc2

Please sign in to comment.