Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions samples/personalized_learning/quickstart_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ echo " OpenStax bucket: gs://${OPENSTAX_BUCKET}"

# Step 6: Upload learner context
echo -e "${YELLOW}[6/6]${NC} Uploading learner context files..."
# Note: Using -o flag to disable multiprocessing on macOS to avoid Python multiprocessing issues
gcloud storage cp learner_context/*.txt "gs://${CONTEXT_BUCKET}/learner_context/" 2>/dev/null || \
gcloud storage cp learner_context/*.txt "gs://${CONTEXT_BUCKET}/learner_context/" 2>/dev/null || true
gcloud storage cp learner_context/*.txt "gs://${CONTEXT_BUCKET}/learner_context/" 2>/dev/null|| true
echo " Learner context uploaded to gs://${CONTEXT_BUCKET}/learner_context/"
Comment on lines +138 to 139
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation suppresses errors and continues execution, which means a failure to upload files will go unnoticed while the script reports success. This can be misleading and make debugging difficult. It's better to check the exit code of the command and provide appropriate feedback to the user.

Suggested change
gcloud storage cp learner_context/*.txt "gs://${CONTEXT_BUCKET}/learner_context/" 2>/dev/null|| true
echo " Learner context uploaded to gs://${CONTEXT_BUCKET}/learner_context/"
if gcloud storage cp learner_context/*.txt "gs://${CONTEXT_BUCKET}/learner_context/" >/dev/null 2>&1; then
echo " Learner context uploaded to gs://${CONTEXT_BUCKET}/learner_context/"
else
echo -e "${YELLOW}Warning: Failed to upload learner context files. The demo may not be fully functional without them.${NC}"
fi

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, ideally this wouldn't ignore errors, but the original script did. Should we just take off the || true?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah maybe. I am not sure where this sample came from


# Get project number for .env
Expand Down
Loading