oppia / oppia/oppia-web-developer-docs

Add info to wiki explaining how to probe local emulated GCS

Open
#423 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Impact: Medium Work: Low
Dominant language
Python
Stars
18
Forks
133
PR merge metrics
No merged PRs in 30d

Description

When working on code that interacts with Google Cloud Storage (GCS), it's often useful to be able to explore the files that exist in our local emulated GCS. You can do this as follows:

  1. Run the local dev server
  2. Open a shell to the oppia-dev-server container: make shell.oppia-dev-server
  3. Start a Python session python
  4. Depending on what Oppia tools you want to use, you may need to run import scripts.start to get Python to look in the correct folders for imports.
  5. import models: from core.platform import models
  6. Set up storage_services: storage_services = models.Registry.import_storage_services()

Now you can explore GCS as follows:

# The `abc` is the GCS bucket name, which you can put anything for.
>>> storage_services.listdir('abc', 'exploration_suggestions/25/assets')
[EmulatorBlob(name=exploration_suggestions/25/assets/image/img_20241203_121203_tn09emjdm7_height_472_width_314_micro.svg, content_type=image/svg+xml), EmulatorBlob(name=exploration_suggestions/25/assets/image/img_20241203_121203_tn09emjdm7_height_472_width_314_compressed.svg, content_type=image/svg+xml), EmulatorBlob(name=exploration_suggestions/25/assets/image/img_20241203_121203_tn09emjdm7_height_472_width_314.svg, content_type=image/svg+xml)]

You can also mutate files in GCS. See the available functions here: https://github.com/oppia/oppia/blob/develop/core/platform/storage/dev_mode_storage_services.py

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Add the supplied local GCS exploration steps to the appropriate Oppia developer wiki page. Start by reviewing core/platform/storage/dev_mode_storage_services.py and the make shell.oppia-dev-server and scripts.start entry points referenced in the issue. Done means the page explains listing and mutating emulator files and links to the available storage functions.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, google-cloud, python
Domain
cloud, documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.