Any way to inspect the contents of the accelerator server?

Most of the issues we have around accelerator comes down to “Is that asset cached or not?” Quite often it’s not and we have to trigger reimport to get it to upload.

I’d like to know if there is an api to ping the server to see if the asset exists in cache or not, and if not then we can upload it ourselves ideally. It must exist since unity must be using this to query the cache itself. However it’s not documented. Why not open this api up for everyone to use. It would be quite quick to make a debug window showing which assets are in cache and which are not.

If you don’t mind, can you tell me the reason for checking if it’s cached or not? I’ve just started using Unity Accelerator. As I understand it, the process is automatic, if the client does not have the file, then it will request the server to download that file and then store it on the server, then send it to the client.

We have had a lot of issues with corrupted caches and other such things like packages not caching properly. Also it won’t automatically upload it. You have to manually reimport an asset to get it to upload to the cache. I may want to upload any uncached assets rather than reimport the whole project. I think it would just be a useful tool for debugging these kinda issues

The unity-accelerator command line tool has a lot of usefull sub commands you can use to interact with a running accelerator instance.
You can query for cached keys, clear individual keys or whole namespaces and lots more. Run the tool with no args and check the usage instructions

I’ve used this quite a bit just for purging corrupted caches and such.
Is there a way to get the key of an asset inside unity? It’s not as simple as it’s asset guid. If so I can make some tools to check by using the cli tool to check individual assets

what could possibly cause corrupt cache in the first place? Do you use old hard drive or wrong drive format? I used to use exFAT drive format for Unity projects and it caused a lot of errors so I reformatted the drive to Mac OS Extended and it fixed the errors.

Any import bug can corrupt a cache, are you telling me you’ve never had to reimport an asset or a whole project or something? It happens quite frequently. In recent versions of unity we have had real issues with upgrading a package version in the package manager. The packages didn’t reimport properly meaning the cache didn’t get populated. This is a problem on our headless build machines. If they don’t import the new package they don’t have correct cache unless it’s in the cache server. Every time we upgraded a packages we’d need to purge the cache server and manually reimport the assets in question in order to populate it properly

My coworker setup a Docker and the build process is ran on it through Gitlab CI/CD. Every time a build is initiated, the Docker load an image and then it clones the git repo or load the cached Unity project if it’s run before, then fetch from git again to update the project; then it runs the Unity build command. I’ve never had any cache problems.

You can find the artifact key uploaded to the cache from the cache’s unity-accelerator.log file, then find the file corresponding to that hash in the project /Library/artifacts/ folder.
You can then run the tool binary2text found on Windows under your Unity install folder /Editor/Data/Tools/binary2text.exe or on MacOS under Unity.app/Contents/Tools/binary2text.exe to see the text representation of the asset, or use the Editor.log file to see what asset resulted in that artifact key.

You can use the unity-accelerator.exe binary to query if a cache key is present on the cache, and it also has commands to generate the cache key from the artifact to make this easier. As you say, its not possible to reverse the cache key to get the artifact key.
The tool has a fairly good usage instructions describing all the available sub-commands, the ones you’ll want are most likely under the ‘cache’ or ‘tool’ sub-command

> ./unity-accelerator cache --help
./unity-accelerator cache <subcommand> [args]...

The cache subcommand contains tools for working with the actual cache contents.

Options:
    -? -h --help  Output this help text.
    --all-help    Output this help text and the help text for all subcommands.

Subcommands:
    delete            Delete an item from the cache.
    delete-namespace  Delete all items under a namespace from the cache.
    get               Get an item from the cache.
    head              Check the cache for an item's existence.
    info              Send an info request to the cache.
    keys-since        Lists keys in use in the cache, within a namespace, created after a timestamp.
    list-namespaces   Lists namespaces in use in the cache.
    perf              Tools for quick cache performance tests.
    pull              Retrieve cached data from another agent or agents.
    push              Send all cached data to another agent.
    put               Put an item into the cache.
> ./unity-accelerator tool --help
./unity-accelerator tool <subcommand> [args]...

Advanced debugging tools.

WARNING: These commands and their arguments may change or be removed in future releases.

Options:
    -? -h --help  Output this help text.
    --all-help    Output this help text and the help text for all subcommands.

Subcommands:
    bbolt             Debug access to the bbolt.db (cache tracking).
    blob-hash         Calculate the blob hash for content.
    cdp               Post JSON data to CDP endpoint.
    cert              TLS certificate commands.
    delete-multi      Delete multiple items from cache.
    get-multi         Get multiple items from cache.
    head-multi        Check for value existence of multiple items.
    load-test         Load testing coordinator.
    load-test-client  Load testing client.
    put-multi         Put multiple items into cache.
    wrun              Run the agent (called by "unity-accelerator run" usually).
2 Likes