Merged
Conversation
Collaborator
Author
|
Running on a fresh Google Cloud Compute Engine instance with no local files. Notice how much faster it runs the second time since the test files and kernels have been cached locally. rfrench@instance-20241022-192743:~$ git clone https://github.com/SETI/rms-oops
Cloning into 'rms-oops'...
remote: Enumerating objects: 11377, done.
remote: Counting objects: 100% (4560/4560), done.
remote: Compressing objects: 100% (1374/1374), done.
remote: Total 11377 (delta 3359), reused 4090 (delta 3144), pack-reused 6817 (from 1)
Receiving objects: 100% (11377/11377), 12.27 MiB | 27.08 MiB/s, done.
Resolving deltas: 100% (8172/8172), done.
rfrench@instance-20241022-192743:~$ cd rms-oops
rfrench@instance-20241022-192743:~/rms-oops$ git checkout rf_241004_filecache
Branch 'rf_241004_filecache' set up to track remote branch 'rf_241004_filecache' from 'origin'.
Switched to a new branch 'rf_241004_filecache'
rfrench@instance-20241022-192743:~/rms-oops$ python3 -m venv venv
rfrench@instance-20241022-192743:~/rms-oops$ source venv/bin/activate
(venv) rfrench@instance-20241022-192743:~/rms-oops$ pip install -r requirements.txt -q
(venv) rfrench@instance-20241022-192743:~/rms-oops$ export OOPS_RESOURCES=gs://rms-node-oops-resources
(venv) rfrench@instance-20241022-192743:~/rms-oops$ python -m unittest tests/unittester_with_hosts.py
........................................................
----------------------------------------------------------------------
Ran 56 tests in 202.970s
OK
(venv) rfrench@instance-20241022-192743:~/rms-oops$ python -m unittest spicedb
./home/rfrench/rms-oops/spicedb/__init__.py:1531: RuntimeWarning: SPICE kernel not found: gs://rms-node-oops-resources/SPICE/Neptune/SPK/nep081xl.bsp
warnings.warn(f'SPICE kernel not found: {pfx.prefix}{filepath}',
.
----------------------------------------------------------------------
Ran 2 tests in 183.296s
OK
(venv) rfrench@instance-20241022-192743:~/rms-oops$ python -m unittest tests/unittester_with_hosts.py
........................................................
----------------------------------------------------------------------
Ran 56 tests in 130.646s
OK
(venv) rfrench@instance-20241022-192743:~/rms-oops$ python -m unittest spicedb
./home/rfrench/rms-oops/spicedb/__init__.py:1531: RuntimeWarning: SPICE kernel not found: gs://rms-node-oops-resources/SPICE/Neptune/SPK/nep081xl.bsp
warnings.warn(f'SPICE kernel not found: {pfx.prefix}{filepath}',
.
----------------------------------------------------------------------
Ran 2 tests in 6.221s
OK |
jnspitale
approved these changes
Oct 30, 2024
Collaborator
jnspitale
left a comment
There was a problem hiding this comment.
Looks good, no comments.
markshowalter
approved these changes
Oct 31, 2024
Collaborator
markshowalter
left a comment
There was a problem hiding this comment.
We've discussed all my comments
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The primary goal of this PR is to support the
rms-filecachepackage, which abstracts reading and writing of files that could be on the local filesystem or in the cloud. This means that people usingspicedboroopsno longer need to have a copy of the OOPS-Resources DropBox on their local disk; files are downloaded into a local cache from a remote cloud source on an as-needed basis. Cached files are kept across runs so that they don't need to be downloaded again. For examples of how to userms-filecacheand full documentation see: https://rms-filecache.readthedocs.io/en/latest/You should see no changes with your existing setup. Current environment variables are supported in exactly the same way and local file accesses, although they go through
filecachemethods, still access the local filesystem unimpeded. However, if you want to use the cloud, you can do something like:export OOPS_RESOURCES=gs://rms-node-oops-resourcesand now all files will be downloaded from the Google Cloud
rms-node-oops-resourcesbucket, which contains all of the SPICE kernels, test data, and golden masters. Note that you need to have a Google Cloud account and be authenticated locally for this to work, since the bucket is not currently publicly accessible.Pathobjects instead of strings.spicedbto usefilecache. Kernels are downloaded in parallel when possible. All tests have been updated and pass. This also fixes spicedb tests don't work #137 .test_datadirectory and kernels from thetest_data/SPICEdirectory usingfilecache; these are downloaded into the same cache, distinct from the one used by spicedb. Retrieval is done in parallel for maximum download efficiency, and then the resultant local paths are supplied tocspyce.furnshone at a time. Even tests that are not currently operational have been modified for future use. All tests have been updated and pass.filecache:obspathattribute in a "standard obs" is no longer an absolute path, but is relative to the prefix specified by theOOPS_TEST_DATA_PATHenvironment variable. This is required because it's never permitted to access files outside of the roots defined by these variables.os.path.join, which doesn't play nicely with non-local-filesystem URIs.import os.pathstatements that are no longer (or were never) needed to remind us not to useos.path.joinin the future.makedirscalls, since directories are now automatically created as necessary byfilecache.summary.pyandtask.logfiles requires downloading the old version, changing its name, uploading the new name, and then overwriting the old file with the current run._basenameto use the "Linux-safe" filename format when writing to a cloud destination.SPICE_PATHdirectory rather than usingtest_data/../SPICE. Note these hosts should really be getting these kernels through thespicedbdatabase mechanism.OOPS_RESOURCES.SPICE_PATHis derived fromOOPS_RESOURCESif not specified, andSPICE_SQLITE_DB_NAMEis derived fromSPICE_PATHif not specified.OOPS_TEST_DATA_PATHis derived fromOOPS_RESOURCESif not specified.OOPS_GOLD_MASTER_PATHis derived fromOOPS_RESOURCESif not specified.OOPS_BACKPLANE_OUTPUT_PATHexplicitly uses the current working directory if not specified. BTW I hate this default because it puts a bunch of directories into the repo which aren't in.gitignore.filecachehandles this internally.rms-filecache.README.mddescribing the use of environment variables and how to run tests.