Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Develop Binder for Salt_front_drivers_exploration notebook #41

Open
ted80810 opened this issue Feb 2, 2022 · 4 comments
Open

Develop Binder for Salt_front_drivers_exploration notebook #41

ted80810 opened this issue Feb 2, 2022 · 4 comments
Assignees

Comments

@ted80810
Copy link
Collaborator

ted80810 commented Feb 2, 2022

Questions:
How do users run binder on local machine (outside of web browser)?
Can users make changes to Notebook on Binder?
How do you save notebook with environment to local machine?

Sub-topics:
How to increase start up time.

@ted80810
Copy link
Collaborator Author

ted80810 commented Feb 2, 2022

I started thinking about how to increase the start-up time of the Binder, after @aappling-usgs suggested loading the notebook from a checkpoint. So, the binder loads faster each time a user clicks the link, but there is a way to "static" load the environment. Binder will only need to load the notebook. However, this method requires creating a separate repository to house the environment as a "content repository".

I wanted to know everyone's thoughts about this as an option. I was thinking of only testing it, if the test notebook takes to much time to load. The steps to this are relatively simple and outline here.

@galengorski
Copy link
Collaborator

galengorski commented Feb 2, 2022

I'm not sure I totally understand the idea of a content repository, however if it decreases the binder load time, I think it could be worth testing at least. I think the major goals for this issue are:

  • Create a container with the appropriate environment so the jupyter notebook loads and executes within binder when the binder badge is clicked (I think I have the dependencies right there)
  • Enable a user to download the notebook, and associated environment(?) so that the user load their own data to manipulate and visualize

The second one is where we got stuck yesterday, not sure if binder would allow you to interact with your local file paths while still executing the notebook in the container. Maybe @jds485 might have some ideas?

@jds485
Copy link
Member

jds485 commented Feb 2, 2022

It should be possible to use the container for any file path (where the user has read/write permissions). I can chat with you if that would be helpful. I've not tried with binder before, but I did run code locally from the container

@ted80810
Copy link
Collaborator Author

ted80810 commented Feb 4, 2022

Here is the link to the test binder. It should be working with all the libraries in the conda environment. One thing to note is that I created a requirement.txt file that lists all the libraries needed for the notebook. I found that it was much easier to use a requirement file for Binder to point to when creating the docker image.

In regards to loading local files, Binder deploys the image in the cloud; it searches for files in a cloud workspace (/home/jovan/). However you can upload any of your local files to the workspace folder (/home/jovyan/). You simply have to upload it from the file menu. You can also download any files generated by the notebook (right-click, download) in the workspace. Alternatively, we can opt to store the docker file in the repo. Binder would just build the image from the docker file in the repo. This way we can use the container for any file path, as @jds485 mentioned. On the other hand, the current setup does not require docker to be installed on your machine. Regardless, I would definitely be up for discussing this more with you @jds485 .

You can download the notebook at any time, with changes you make in the Binder. As far as the environment, there are two options. With the current setup, you will have to create an environment on your local machine. I added detailed instruction in the README document on how to load the environment from the yaml file in the repository. The second option requires the user to have docker installed on their computer. This option works if we opt to store the docker file in the repo.

Binder creates a new image every time it detects a change to the notebook, so you just have to push the commits for Binder to recognize them. I tested this out and it worked fine. I saw all the changes when the Binder loaded.

Feel free to test out the Binder and the notebook locally on your machine. Let me know if there are some pain points.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants