-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a1fd0b2
draft
rugeli be9629e
formatting
rugeli 608e5a1
revise return message
rugeli 598a85a
update documentation
rugeli 805db23
remove logger from upload script
rugeli e04a42f
add a function to retrieve readme link
rugeli 8dce09d
Merge branch 'main' of https://github.com/mesoscope/cellpack into fea…
rugeli ecdfde5
Merge branch 'main' of https://github.com/mesoscope/cellpack into fea…
rugeli 555e8f4
provide readme url when db not initialized
rugeli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
) | ||
db_handler = DBRecipeLoader(initialize_db) | ||
recipe_id = file_path.split("/")[-1] | ||
db_doc, _ = db_handler.collect_docs_by_id( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import sys | ||
import fire | ||
|
||
from cellpack.autopack.FirebaseHandler import FirebaseHandler | ||
from cellpack.autopack.DBRecipeHandler import DBUploader | ||
|
||
|
@@ -18,11 +20,16 @@ def upload( | |
if db_id == DATABASE_IDS.FIREBASE: | ||
# fetch the service key json file | ||
db_handler = FirebaseHandler() | ||
recipe_loader = RecipeLoader(recipe_path) | ||
recipe_full_data = recipe_loader._read(resolve_inheritance=False) | ||
recipe_meta_data = recipe_loader.get_only_recipe_metadata() | ||
recipe_db_handler = DBUploader(db_handler) | ||
recipe_db_handler.upload_recipe(recipe_meta_data, recipe_full_data) | ||
if FirebaseHandler._initialized: | ||
recipe_loader = RecipeLoader(recipe_path) | ||
recipe_full_data = recipe_loader._read(resolve_inheritance=False) | ||
recipe_meta_data = recipe_loader.get_only_recipe_metadata() | ||
recipe_db_handler = DBUploader(db_handler) | ||
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." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could link to the readme/instructions here similar to AWS |
||
) | ||
|
||
|
||
def main(): | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very useful!