Skip to content

Cache-only execution

Tristan Maat requested to merge tlater/recc:tlater/local-but-cache into master

What is this?

This adds cache-only execution mode (part of #68 (closed)).

It slightly changes what happens when recc tries to execute a build from:

  1. Check if our command is a (valid) build action
    1. If not, execute the build locally (exit)
  2. Check if the action and its result are already remotely cached
    1. If so, return the result of the cached build (exit)
  3. Upload the action and wait for the remote to execute it (exit)

to:

  1. Check if our command is a (valid) build action
    1. If not, execute the build locally (exit)
  2. Check if the action and its result are already remotely cached
    1. If so, return the result of the cached build (exit)
  3. Check if cache only mode is active
    1. If not, upload the action and wait for the remote to execute it (exit)
    2. Otherwise, execute the build locally (exit)

Cache only mode will be active if:

  • The user sets RECC_CACHE_ONLY
  • A RECC_CACHE_SERVER is set, but RECC_SERVER is not

Comments

  • Currently, even if RECC_CACHE_ONLY is set to 0 explicitly by the user (i.e., RECC_CACHE_ONLY=0 in env), recc will still enter cache-only mode on the second condition. This is the test failure. I'm not sure what the expected behavior should be here, or if RECC_CACHE_ONLY should even be supported. Since it's a bit of effort to actually get it to work the behavior I wanted when designing this, I'd appreciate some comments on what others think.
  • The main function is a bit bloated with complex flow, and this patch makes it worse. Would you expect a refactor with this?
  • The first commit is a refactor of something I thought I'd need to change but didn't. Do tell if I should break this out.
  • I don't think the main path is currently tested, so I didn't add an explicit test to go through the RECC_CACHE_ONLY path; only checking if the environment settings will behave correctly. Do tell if I'm missing a test.
Edited by Tristan Maat

Merge request reports