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

Skip staging db and aws on missing credentials #243

Merged
merged 9 commits into from
May 13, 2024
Merged

Conversation

rugeli
Copy link
Collaborator

@rugeli rugeli commented Apr 16, 2024

Problem

What is the problem this work solves, including
closes #238

Solution

To address the issue of missing aws or firebase credentials when running local packings, the following changes were made:
- skipped the saving process for staging database and aws s3 bucket
- disabled the automatic opening of new browser tabs related to aws urls
- updated documentation

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • documentation update

Steps to Verify:

  1. Temporarily remove your credentials
  2. Pack a local recipe to ensure the system behaves as expected without credentials.
  3. Optionally, upload or pack a remote recipe to verify that the process functions as intended with/without credentials in place

@rugeli rugeli changed the title Feature/bypass db Skip staging db and aws on missing credentials Apr 16, 2024
Copy link

github-actions bot commented Apr 16, 2024

Packing analysis report

Analysis for packing results located at cellpack/tests/outputs/test_spheres/spheresSST

Ingredient name Encapsulating radius Average number packed
ext_A 25 236.0

Packing image

Packing image

Distance analysis

Expected minimum distance: 50.00
Actual minimum distance: 50.01

Ingredient key Pairwise distance distribution
ext_A Distance distribution ext_A

@rugeli rugeli requested review from mogres and meganrm April 16, 2024 17:34
from cellpack.autopack.FirebaseHandler import FirebaseHandler
from cellpack.autopack.DBRecipeHandler import DBUploader

from cellpack.autopack.interface_objects.database_ids import DATABASE_IDS
from cellpack.autopack.loaders.recipe_loader import RecipeLoader

###############################################################################
log_file_path = Path(__file__).parent.parent / "logging.conf"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we using the logger anywhere in this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for catching that! I ended up using sys instead of log and forgot to clean up the logger setup, will remove it now

* Create a Firebase project in test mode with your google account, select `firebase_admin` as the SDK. [Firebase Firestore tutorial](https://firebase.google.com/docs/firestore)
* Generate a new private key by navigating to "Project settings">"Service account" in the project's dashboard.
* For dev database:
* Create a Firebase project in test mode with your google account, select `firebase_admin` as the SDK. [Firebase Firestore tutorial](https://firebase.google.com/docs/firestore)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is very useful!

@@ -387,6 +387,10 @@ def load_file(filename, destination="", cache="geometries", force=None):
if database_name == "firebase":
db = DATABASE_IDS.handlers().get(database_name)
initialize_db = db()
if not initialize_db._initialized:
sys.exit(
"The selected database is not initialized. Please set up Firebase credentials to pack remote recipes."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could link to the readme/instructions here similar to how we do for missing AWS credentials

recipe_db_handler.upload_recipe(recipe_meta_data, recipe_full_data)
else:
sys.exit(
"The selected database is not initialized. Please set up Firebase credentials to upload recipes."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could link to the readme/instructions here similar to AWS

@rugeli rugeli merged commit 560b01e into main May 13, 2024
7 checks passed
@rugeli rugeli deleted the feature/bypass-db branch May 13, 2024 21:01
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.

Improve user experience: Automatically bypass data storage when credentials are not provided
3 participants