Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn fleet AGOL feature service updater into a Forklift Pallet #1

Merged
merged 38 commits into from
Jun 11, 2020

Conversation

jacobdadams
Copy link
Member

Ok, I think I've got this properly palletized. I've extended Pallet, implemented logging, and created the stand-alone if __name__ == '__main__' code.

The logging tutorials all use %s-style string formatting, but so far fstrings are working just fine. Does that have an impact when running within the full forklift environment?

I'd appreciate a review of how I'm handling exceptions—I'm not sure if I should be logging the messages as well as re-raising the original exception?

I've also made it bomb out if the latest file is old. This is supposed to be a trigger for us that we're not seeing any new data from Fleet. I'm doing so via sys.exit(message), and if I understand it correctly, including any non-0 number will cause it to exit to the system with a code indicating failure/error (ie, not a successful execution). Is this the right way to have this behavior in forklift?

@jacobdadams jacobdadams requested a review from steveoh June 9, 2020 23:57
@jacobdadams jacobdadams requested a review from stdavis June 9, 2020 23:57
Copy link
Member

@steveoh steveoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks pretty good. Nice work.

.gitignore Show resolved Hide resolved
.pylintrc Show resolved Hide resolved
README.md Show resolved Hide resolved
update_agol_vehicles_pallet.py Show resolved Hide resolved
update_agol_vehicles_pallet.py Show resolved Hide resolved
Comment on lines +143 to +145
raise FileNotFoundError(
f'known_hosts file {secrets.KNOWNHOSTS} not found. Please '
'create with ssh-keyscan.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: I think raising is ok. @stdavis would the other option be to set the pallet status and return from the method? We'd have to see what looks nicer in the logs I suppose.

It does seem like you logged all the other errors so I would continue to be consistent and log this error also before throwing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think that raising is the correct thing to do and I don't think that logging it is necessary since forklift will log it at a higher level. However, it might be good to test this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've changed the excepts to do a log.exception("some custom error message") to capture the custom message and then re-raise the original exception. This seemed to be the least verbose way after a little bit of trial and error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep a note to test that we aren't double logging

update_agol_vehicles_pallet.py Show resolved Hide resolved
update_agol_vehicles_pallet.py Outdated Show resolved Hide resolved
update_agol_vehicles_pallet.py Outdated Show resolved Hide resolved
update_agol_vehicles_pallet.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Member

@stdavis stdavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I think this is really great. I love the thorough docs!

update_agol_vehicles_pallet.py Outdated Show resolved Hide resolved
update_agol_vehicles_pallet.py Show resolved Hide resolved
Comment on lines +143 to +145
raise FileNotFoundError(
f'known_hosts file {secrets.KNOWNHOSTS} not found. Please '
'create with ssh-keyscan.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think that raising is the correct thing to do and I don't think that logging it is necessary since forklift will log it at a higher level. However, it might be good to test this.

update_agol_vehicles_pallet.py Show resolved Hide resolved
@jacobdadams jacobdadams changed the title Turn fleet AGOL feature service updater into a Forklift Pallet WIP Turn fleet AGOL feature service updater into a Forklift Pallet Jun 10, 2020
@jacobdadams jacobdadams changed the title WIP Turn fleet AGOL feature service updater into a Forklift Pallet Turn fleet AGOL feature service updater into a Forklift Pallet Jun 11, 2020
@jacobdadams jacobdadams merged commit 1936f71 into master Jun 11, 2020
@jacobdadams jacobdadams deleted the update-fs branch June 11, 2020 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants