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

Python package errors during setup #602

Closed
Tracked by #604
rogerthatdev opened this issue Aug 4, 2022 · 3 comments · Fixed by #685
Closed
Tracked by #604

Python package errors during setup #602

rogerthatdev opened this issue Aug 4, 2022 · 3 comments · Fixed by #685
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@rogerthatdev
Copy link
Contributor

from @glasnt feedback

Problem

When setup.sh calls seed_test_approver.py there is a python import error that causes setup.sh to fail

Steps to Reproduce

Steps to reproduce the behavior:

  1. Run through setup.sh until 'Seeding default content..'

Expected behavior

No import errors.

Additional context

ImportError: cannot import name 'firestore' from 'google.cloud' (unknown location)
Exited [1] at line 118 setup.sh:
cat: setup.sh: No such file or directory

User environment:

  • OS: cloud shell

Proposal

Replace python used in setup with bash gcloud CLI commands

@rogerthatdev rogerthatdev added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Aug 4, 2022
@rogerthatdev rogerthatdev mentioned this issue Aug 4, 2022
10 tasks
@engelke engelke self-assigned this Aug 8, 2022
@engelke
Copy link
Contributor

engelke commented Aug 15, 2022

Using bash won't help in this case, because actually interacting with Firestore is going to require code using a Cloud client of some kind. I can think of three approaches:

Option 1 - It might as well be Python. We can either have the setup script install google-cloud-firestore in the user's default Python environment, which would be rude, or create and use a virtual environment with it installed.

Option 2 - Use the gcloud CLI which can import data into Firestore from a Cloud Storage bucket.

Option 3 - Use Terraform to create Firestore documents one at a time, or load from a text file. One at a time would work well for the approver seeding, not so much for the rest of the data.

This is going to need discussion and a decision record.

@rogerthatdev
Copy link
Contributor Author

rogerthatdev commented Aug 25, 2022

Option 3 - Use Terraform to create Firestore documents one at a time, or load from a text file. One at a time would work well for the approver seeding, not so much for the rest of the data.

I took a look at what the possible solution here looks like and submitted PR #644 to start. Here's a break down of the changes we'll need to submit to replace the python seeding scripts with Terraform resources:

Other notes:

  • Because the creation of these resources can be toggled by the seed_test_data tf var, there is no need to make this one big PR merge. The work can be broken down so long as the resources added to Terraform include a count parameter with a conditional expression using seed_test_data that is set to false by default.
  • Terraform will deploy a new resource for each document in every collection, therefore the Terraform plan and apply output will include a very high number of resources.
  • While testing the creation of the donor documents went well, there was at least one test where it ran into a concurrency error from Firestore after creating 100 documents. I have not been able to consistently recreate this error, but warrants further investigation.

@rogerthatdev rogerthatdev added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Sep 29, 2022
@rogerthatdev
Copy link
Contributor Author

Due to the concurrency errors that occur when Terraform creates a large amount of Firestore documents, the Terraform solution may not be the best one at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants