Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Issue 2847153002: Cache/retrieve extracted CIPD packages in local isolate cache (Closed)

Created:
3 years, 7 months ago by kjlubick
Modified:
3 years, 7 months ago
Reviewers:
Vadim Sh., M-A Ruel
CC:
chromium-reviews, infra-reviews+luci-py_chromium.org
Target Ref:
refs/heads/master
Project:
luci-py
Visibility:
Public.

Description

Cache/retrieve extracted CIPD packages in local isolate cache BUG=701930

Patch Set 1 #

Patch Set 2 : WIP starting on ensure #

Patch Set 3 : Fix on_error test #

Patch Set 4 : Merge branch 'master' of https://chromium.googlesource.com/external/github.com/luci/luci-py into ci… #

Patch Set 5 : Fix unicode glitch and make assertions less terrible to find #

Total comments: 3

Patch Set 6 : Add docs #

Patch Set 7 : Remove dependency cycle #

Patch Set 8 : Don't cache ./ #

Patch Set 9 : fix windows #

Patch Set 10 : clean up formatting #

Total comments: 22

Patch Set 11 : Handle first round of comments #

Patch Set 12 : Refactor into isolateserver #

Total comments: 10

Patch Set 13 : Cache cipd packages individually (for peak freshness) #

Total comments: 20

Patch Set 14 : Address more comments #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+272 lines, -26 lines) Patch
M appengine/swarming/server/bot_archive.py View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M client/cipd.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +175 lines, -12 lines 2 comments Download
M client/isolated_format.py View 1 1 chunk +1 line, -1 line 0 comments Download
M client/isolateserver.py View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +62 lines, -3 lines 1 comment Download
M client/run_isolated.py View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +13 lines, -6 lines 2 comments Download
M client/tests/run_isolated_test.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +16 lines, -0 lines 0 comments Download
M client/utils/fs.py View 1 2 3 4 5 6 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 14 (3 generated)
kjlubick
https://codereview.chromium.org/2847153002/diff/80001/client/cipd.py File client/cipd.py (right): https://codereview.chromium.org/2847153002/diff/80001/client/cipd.py#newcode26 client/cipd.py:26: import isolate This introduces a dependency cycle that I ...
3 years, 7 months ago (2017-05-03 18:28:33 UTC) #3
M-A Ruel
(Pushing a draft I had forgot to publish, will review) https://codereview.chromium.org/2847153002/diff/80001/client/utils/fs.py File client/utils/fs.py (right): https://codereview.chromium.org/2847153002/diff/80001/client/utils/fs.py#newcode124 ...
3 years, 7 months ago (2017-05-08 13:13:14 UTC) #4
kjlubick
PTAL https://codereview.chromium.org/2847153002/diff/80001/client/utils/fs.py File client/utils/fs.py (right): https://codereview.chromium.org/2847153002/diff/80001/client/utils/fs.py#newcode124 client/utils/fs.py:124: assert os.path.isabs(path), '%s must be absolute' % path ...
3 years, 7 months ago (2017-05-08 18:59:29 UTC) #5
M-A Ruel
https://codereview.chromium.org/2847153002/diff/180001/client/cipd.py File client/cipd.py (right): https://codereview.chromium.org/2847153002/diff/180001/client/cipd.py#newcode172 client/cipd.py:172: with open(cipd_isolated , 'r') as f: 'rb' it makes ...
3 years, 7 months ago (2017-05-08 20:43:16 UTC) #6
kjlubick
https://codereview.chromium.org/2847153002/diff/180001/client/cipd.py File client/cipd.py (right): https://codereview.chromium.org/2847153002/diff/180001/client/cipd.py#newcode172 client/cipd.py:172: with open(cipd_isolated , 'r') as f: On 2017/05/08 at ...
3 years, 7 months ago (2017-05-09 17:38:25 UTC) #7
M-A Ruel
https://codereview.chromium.org/2847153002/diff/180001/client/cipd.py File client/cipd.py (right): https://codereview.chromium.org/2847153002/diff/180001/client/cipd.py#newcode325 client/cipd.py:325: versions = [p[1] for p in pkgs] On 2017/05/09 ...
3 years, 7 months ago (2017-05-10 13:31:58 UTC) #8
kjlubick
cipd packages are handled separately now https://codereview.chromium.org/2847153002/diff/220001/client/cipd.py File client/cipd.py (right): https://codereview.chromium.org/2847153002/diff/220001/client/cipd.py#newcode150 client/cipd.py:150: Retrieves the CIPD ...
3 years, 7 months ago (2017-05-10 19:41:01 UTC) #9
M-A Ruel
I also want Vadim to take a look in case I missed anything serious. https://codereview.chromium.org/2847153002/diff/240001/client/cipd.py ...
3 years, 7 months ago (2017-05-10 20:00:57 UTC) #11
kjlubick
https://codereview.chromium.org/2847153002/diff/240001/client/cipd.py File client/cipd.py (right): https://codereview.chromium.org/2847153002/diff/240001/client/cipd.py#newcode203 client/cipd.py:203: os.write(ensure_file_handle, '@Subdir %s\n' % pkg) On 2017/05/10 at 20:00:57, ...
3 years, 7 months ago (2017-05-10 20:21:00 UTC) #12
Vadim Sh.
Sorry, I dislike this CL very much. I believe it adds fragility and complexity in ...
3 years, 7 months ago (2017-05-11 03:09:09 UTC) #13
kjlubick
3 years, 7 months ago (2017-05-11 17:20:43 UTC) #14
Message was sent while issue was closed.
On 2017/05/11 at 03:09:09, vadimsh wrote:
> Sorry, I dislike this CL very much.
> 
> I believe it adds fragility and complexity in already quite complicated code
by tightly coupling different systems.
> 
> I believe if we to pursue this approach we need to add very clear API
boundaries between CIPD client, Isolate client and Isolate cache.
> 
> For example:
> 
> 1. Introduce a notion of CacheHandler (in pseudocode):
> 
> interface CacheHandler {
>   // Hardlinks cached item into 'destinationPath' if it is in the cache.
>   GrabFromCache(digest, destinationPath) => (Success | CacheMiss)
> 
>   // Copies given file into the cache.
>   PutIntoCache(originalPath) => digest
> }
> 
> The API can be as simple as a command line invocations:
> 
> ./cache_handler grab <digest> <dest>
> ./cache_handler put <path>
> 
> 2. Make Swarming bot implement cache_handler API.
> 
> 3. Make run_isolated.py and cipd client accept implementation of the API:
> cipd ensure <...> -cache-handler "./cache_handler"
> 
> (Or something along this lines. APIs don't always mean RPC calls over TCP).
> 
> Without clear concise boundaries we will end up with unmanageable buggy code
(we already very close to this state, TBH).
> 
> https://codereview.chromium.org/2847153002/diff/260001/client/cipd.py
> File client/cipd.py (right):
> 
>
https://codereview.chromium.org/2847153002/diff/260001/client/cipd.py#newcode195
> client/cipd.py:195: cipd_isolated = u'%s.%s.isolated.%s' % (pkg, version,
> how does this look?
> 
> IIUC, it will look like
'infra/tools/luci/kitchen/linux-amd64.git_revision:f027117e5549a5defd39f3f779c3bb9d3856cd0b.isolated.sha1'
which is kind of bad and won't work on Windows at all (due to ':').
> 
> When this files are cleaned up?
> 
> Also, there seem to be no way to use movable references (like 'latest'). Bots
will stuck using whatever version they managed to isolate.
> 
>
https://codereview.chromium.org/2847153002/diff/260001/client/cipd.py#newcode204
> client/cipd.py:204: os.write(ensure_file_handle, '@Subdir %s\n' % pkg)
> this doesn't look right, it should be 'subdir'. This also implies to_isolate
is using wrong key (it should use tuple of subdir and pkg).
> 
> https://codereview.chromium.org/2847153002/diff/260001/client/isolateserver.py
> File client/isolateserver.py (right):
> 
>
https://codereview.chromium.org/2847153002/diff/260001/client/isolateserver.p...
> client/isolateserver.py:372: for f in files.keys():
> nit: .keys() is not necessary. Enumerating a dict already returns its keys.
> 
> https://codereview.chromium.org/2847153002/diff/260001/client/run_isolated.py
> File client/run_isolated.py (right):
> 
>
https://codereview.chromium.org/2847153002/diff/260001/client/run_isolated.py...
> client/run_isolated.py:128: package.add_python_file(os.path.join(BASE_DIR,
'run_isolated.py'))
> note that this file may already be included in the zip as __main__.py
> 
> (depending on 'executable').
> 
> Also, I think run_isolated.zip is kind of dead code now. Nothing is using it
in production (Swarming bot has run_isolated.py copy itself). So I'm surprised
you are modifying it.
> 
>
https://codereview.chromium.org/2847153002/diff/260001/client/run_isolated.py...
> client/run_isolated.py:692: isolate_cache=None):
> please document in Args, at least its type (in all other places where it is
added too)

Abandoning this change in favor of https://skia-review.googlesource.com/c/16490

Powered by Google App Engine
This is Rietveld 408576698