Skip to content

Indexes 5: Adds spk repo index subcommand for index generation and updates#1340

Open
dcookspi wants to merge 1 commit intoindex-4-indexed-repository-and-fbindexfrom
index-5-repo-cmds-config-and-cli-flags
Open

Indexes 5: Adds spk repo index subcommand for index generation and updates#1340
dcookspi wants to merge 1 commit intoindex-4-indexed-repository-and-fbindexfrom
index-5-repo-cmds-config-and-cli-flags

Conversation

@dcookspi
Copy link
Collaborator

@dcookspi dcookspi commented Mar 20, 2026

This adds a new repo index subcommand to spk for index generation and updates. It adds the --use-indexes and --no-indexes flags for repository index usage. This also updates resolvo solver to get global variables data from an indexed repository. This allows resolvo to solve without needing to restart its solves.

Indexing

The index is design to help the solvers with solves. It doesn't contain enough data to help with other spk operations like building and testing a package. Indexing can be enabled or disabled in the spk config file. If indexing is enabled, you also have to generate an index, with spk repo index, prior to trying to use it.

To generate an index (for the origin):

  • spk repo index --disable-repo local

To update an existing index, e.g. after a new python package was published:

  • spk repo index --disable-repo local --update python

If index use is enabled in the config file, it can be disabled with the --no-indexes command line flag. If index use is disabled by default, it can be enbled with the --use-indexes flag. If index use is enabled but no index has been generated, spk will fallback to using the underlying repo directly (as it does before this change).

Speed Diferences

Generating the index file on our repo (sizes below) takes about 2 minutes. Updating a package in an existing index, such as after a new build is published, takes a few seconds.

Sample solver time improvements using this indexing with:

  • an origin repo that has 2245 packages, 23540 versions, 82517 builds (11 erroring), and 141 global vars
  • the index loads in ~0.0003 seconds unverified, or ~0.2 seconds verified, and is about 76 MB on disk
  • these times were using an unverified index
  • a "toolset" below is a set of requests for the named DCC and our typical in-house plugins and tools
Requests        | Solution size | Num.    | Solve time  |  Indexed solve time, no retries
                | (# packages)  | Retries | (seconds)   |  (seconds)
-----------------------------------------------------------------------------------------
python          |        4      |    1    |     0.17    |   0.03 
boost-python    |        8      |    1    |     0.31    |   0.05 
python-torch    |       37      |    2    |     0.58    |   0.15 
widget toolset  |       60      |    2    |     3.44    |   0.48 
katana toolset  |      181      |   10    |    18.32    |   2.97 
nuke toolset    |      280      |   12    |    24.32    |   4.55 
houdini toolset |      211      |   19    |    37.24    |   6.58 
maya toolset    |      403      |   20    |    59.50    |   9.52 

The indexing doesn't have a noticable impact (to users) on smaller solves. But it allows our larger solves to finish in under 10 seconds.

This is the final 5 of 5 chained PRs for adding indexes to spk solves:

  1. Indexes 1: Change Package and related traits to not return references to fields #1336
  2. Indexes 2: Add new_unchecked() constructors to spk schema objects #1337
  3. Indexes 3: Adds flatbuffers schema and SolverPackageSpec for indexes to spk #1338
  4. Indexes 4: Adds Indexes for SPK repositories #1339
  5. this PR

@dcookspi dcookspi self-assigned this Mar 20, 2026
@dcookspi dcookspi added enhancement New feature or request SPI AOI Area of interest for SPI pr-chain This PR doesn't target the main branch, don't merge! labels Mar 20, 2026
@dcookspi dcookspi changed the title Indexes 5: Adds 'spk repo index' subcommand for index generation and updates Indexes 5: Adds spk repo index subcommand for index generation and updates Mar 20, 2026
@dcookspi dcookspi force-pushed the index-5-repo-cmds-config-and-cli-flags branch from 9da2f7c to d88602e Compare March 20, 2026 01:22
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 40.67797% with 70 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spk-cli/cmd-repo/src/cmd_repo.rs 0.00% 43 Missing ⚠️
crates/spk-cli/common/src/flags.rs 42.10% 22 Missing ⚠️
crates/spk-storage/src/storage/indexed.rs 0.00% 4 Missing ⚠️
crates/spk-storage/src/storage/flatbuffer_index.rs 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@dcookspi dcookspi requested review from jrray and rydrman March 20, 2026 19:15
@dcookspi dcookspi force-pushed the index-5-repo-cmds-config-and-cli-flags branch from d88602e to 027a156 Compare March 20, 2026 19:27
@dcookspi dcookspi force-pushed the index-4-indexed-repository-and-fbindex branch from 8530adc to 68bb519 Compare March 20, 2026 19:30
Comment on lines +118 to +121
// There isn't an existing index, so generate one from scratch that
// will also include the update package version.
// TODO: could also just error out and say run a full index first,
// or ask the user "are you sure?" before continuing.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let me know if this should error rather than generate a full index.

Comment on lines +1178 to +1180
// Local repo only case does not use indexes because they
// are typically small and not indexed. If local repos
// became large and were indexed, this might change.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the default we intend to use, but maybe it should be configurable.

Comment on lines +784 to +788
// TODO: does not handle packages from indexes. This will
// crash if --use-indexes was used. Those packages would need
// to be converted to something that could be serialized, or
// pieces extracted individually from the index packages, for
// this to work.
Copy link
Collaborator Author

@dcookspi dcookspi Mar 20, 2026

Choose a reason for hiding this comment

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

The plan is not to address this in this PR-chain. Users can specify --no-indexes if they want info when indexes are the default. Although, perhaps we should disable index use for spk info ? That would probably be better.

@dcookspi dcookspi force-pushed the index-4-indexed-repository-and-fbindex branch from 68bb519 to 1e28bf4 Compare March 20, 2026 19:53
@dcookspi dcookspi force-pushed the index-5-repo-cmds-config-and-cli-flags branch from 027a156 to cdaf8f9 Compare March 20, 2026 19:55
index.check_fb_index()?;
tracing::debug!(
"'{name}' repo index checked as flatb RepositoryIndex: {} secs",
"'{name}' repo index verified before use : {} secs",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change and the next one make the times line up in the output.

Adds --use-indexes and --no-indexes flags to repository.
Updates resolvo solver to get global variables data from an indexed repository.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi force-pushed the index-4-indexed-repository-and-fbindex branch from 1e28bf4 to 854446a Compare March 21, 2026 01:07
@dcookspi dcookspi force-pushed the index-5-repo-cmds-config-and-cli-flags branch from cdaf8f9 to b70cba2 Compare March 21, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pr-chain This PR doesn't target the main branch, don't merge! SPI AOI Area of interest for SPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant