azavea / ism-watershed-wellness-snapshot

A tool to collect and display watershed wellness indicators for the International Seaport Museum
1 stars 2 forks source link

Initial fetch and save sensor data #57

Closed fungjj92 closed 5 years ago

fungjj92 commented 5 years ago

Overview

The app markers will change their display depending on sensor data read regularly from real USGS sensors/data feeds. This app puts into place the initial work connecting the sensors to the app. Certainly more work will follow in terms of error handling, using back up data sources, persisting data, etc.

The requests to the 3 sensors are batch requested and handled at once. There's notably no error handling yet.

Sensors set to poll every 10 minutes, subj to change.

Connects #20

Demo

screen shot 2019-02-12 at 5 00 57 pm

Sensors polling at 1 minute for testing: screen shot 2019-02-12 at 2 00 28 pm

Notes

I decided to try out async/await. I don't know that the implementation is more readable or effective than the standard request/then/catch promise workflow. Let me know your thoughts!

Also, I added changes to the Vagrantfile that helped my VM stop freezing -- it's the same set of change I've been applying to other projects. Matt noted this same change that helps me, to mount files via nfs, broke the VM on his linux machine so hopefully this change should work for linux machines too -- untested.

Testing Instructions

vagrant reload ./scripts/update ./scripts/server Upon starting or refreshing the app the requests should fire

caseycesari commented 5 years ago

I'm having trouble getting the VM to start-up on this branch due to the NFS changes. Using NFS has worked in the past for me without issue and I'm generally a fan of using it to avoid the VM locking up. Is there something different about the setup here? Here's the error message:

==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
Password:
tee: /etc/exports: Operation not permitted
tee: /etc/exports: Operation not permitted
tee: /etc/exports: Operation not permitted
tee: /etc/exports: Operation not permitted
The nfsd service does not appear to be running.
Starting the nfsd service
==> default: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp,vers=3,udp,actimeo=1 192.168.110.1:/Users/ccesari/projects/ism-watershed-wellness-snapshot /vagrant

Stdout from the command:

Stderr from the command:

mount.nfs: Connection timed out
fungjj92 commented 5 years ago

Hm I'll look into it. For testing this PR, perhaps drop that commit de9d129 on your local branch for now.

caseycesari commented 5 years ago

@fungjj92 this https://github.com/hashicorp/vagrant/issues/10234#issuecomment-424305964 combined with https://github.com/hashicorp/vagrant/issues/10234#issuecomment-427051144 fixed it for me. Thanks for the suggestion.

fungjj92 commented 5 years ago

Thanks for reviews. I believe everything should be addressed, including the ghost multiple requests / 2n logs.

screen shot 2019-02-20 at 2 12 34 pm