Updating G-Cubed 2R running on your own computer
Table of contents
Updating your devcontainer definition
If you are using the public 2R model, your devcontainer definition is provided in your fork of the gcubed-2R repository.
Log into Github and on the homepage of your forked gcubed-2R repository, tap on the “Sync Fork” button and then tap on the green “Update branch” button.
That will update your fork of the devcontainer definition with the changes made in the upstream repository. Your devcontainer definition is now up to date. You just need to apply the updates by pulling them down to your local repository from the Github remote repository.
-
Open a command prompt or terminal so that the current folder is the root folder of your cloned local gcubed-2R repository.
-
Pull down the devcontainer updates from Github by running the following command:
git pull
This will copy the devcontainer definition updates from the Github repository to your local repository.
Updating your G-Cubed software
-
Open a command prompt or terminal so that the current folder is the root folder of your cloned local gcubed-2R repository.
-
Start VS Code by running the following command:
code .
VS Code will prompt you to open in a container. Do so.
VS Code may then prompt you to rebuild the container. If it does, accept the rebuild and wait for it to finish.
If VS code does not prompt you to rebuild the container, you need to start a devcontainer rebuild from within VS Code by running the VS Code task called Devcontainers: Rebuild Without Cache and Reopen in Container
. This task can be found in VS Code by typing Command + SHIFT + P
in macOS or CTRL + SHIFT + P
in Windows to access the task list and then typing rebuild to find the right task. Click on the task to run it. Alternatively, if using a Github Codespace, click on the blue button in the lower left corner (the one you use to close devcontainer) and select the Rebuild Container
option from the menu of options that are shown. If asked, select the “Full Rebuild” option to ensure that caches are cleared and you get the latest updates of software.
This will cause the codespace to close and then set up the virtual machine again, while keeping all of the data (e.g. results and experiments) in your existing codespace intact.
Once the Codespace has rebuilt and reopened, your G-Cubed software will be up to date.
Updating your G-Cubed model
-
Open a command prompt or terminal so that the current folder is the root folder of your cloned local gcubed-2R repository.
-
Pull down model updates from Github:
git checkout main
git pull
The first command ensures you are on the main branch - where updates are supplied.
Use git to merge the updates to the main branch with any other branches you are working with. Instruction on how to do these merges is out of scope for this documentation.
At this point your devcontainer, your G-Cubed software, and your G-Cubed model will all be updated.
Updating your baseline projections
Updates will often have an impact on your baseline projections. Once the updates have been done, rerun the model baseline. To do this, delete all of the files in the /results/<VERSION>/<BUILD>/run_fast_baseline
folder. Then run the run_fast_baseline.py Python script as you did before.
Some of the operations above use Git, a powerful but complex tool for version control of text documents (source code and, for us, data files). VS Code does provide quite a bit of help with using Git, but understanding Git itself is helpful. Github provides excellent resources to develop this understanding if Git.