SMART icon indicating copy to clipboard operation
SMART copied to clipboard

WIP: Database daily ingest

Open AstridKery opened this issue 3 years ago • 2 comments

This MR adds the daily ingest option to the External database in the project creation and update forms, and information for how to add this as a cron job.

@peridoteagle I've marked this MR as WIP since I haven't been able to test the cron command on the server. I like the way the DB dump emails the logs, and I think that sounds like a great idea if we can have this do that as well.

AstridKery avatar Jun 29 '22 21:06 AstridKery

Pulled this branch to our staging site on http://cds-mallard.rtp.rti.org:8088/. Branch is still active if you want to try to replicate. There is a Database Connection project in root. Here's what I did:

  1. Pulled branch and migrated DB

  2. Attempted to go to Details -> Update Project -> Update/Remove Database Connection

  3. Filled in test database credentials and selected box for Scheduled Ingest

  4. Got these errors Screen Shot 2022-07-22 at 12 47 34 PM Screen Shot 2022-07-22 at 12 47 38 PM /180490659-0b337b49-cb4c-4ad7-bfb7-18dbe0e7c521.png">

  5. Confirmed that I can see the column in the DB Screen Shot 2022-07-22 at 12 41 39 PM

peridoteagle avatar Jul 22 '22 17:07 peridoteagle

@peridoteagle looks like there were some database conflicts between this branch and npsas main. Not sure if that was the issue, but I pulled in the branch and resolved them. Would you mind pulling, migrating, and trying again?

AstridKery avatar Jul 27 '22 16:07 AstridKery

@peridoteagle This should be ready for you to test now, it's up to date with dev and migrations have been merged

AstridKery avatar Oct 16 '22 15:10 AstridKery

Summary of my process here: Had some issues with the cron jobs not working. Alex H suggested using schedule. So I started digging into the python schedule package, and then thought about how it might be annoying to introduce a new package and that I should revisit the cron issue. Realized cron logging wasn't work how I thought it would. Added logging specifically for this and discovered that the major issue was to remove the -t flag. I updated the cron command and instructions and it now works! Let me know if this looks good @AstridKery. Looks like there may be some merge conflicts?

peridoteagle avatar Oct 25 '22 18:10 peridoteagle