Hi Alex,
Op di 20 apr. 2021 om 21:15 schreef 'Alex Jurkowski' via bazel-dev
<
baze...@googlegroups.com>:
> First of all, hello and thank you for the excellent contribution! Both the document and the PR is very high quality! I would like to apologize for the delay and let you know that I would love to work together on this change. I would like to kick off the discussion here and share some initial thoughts.
Awesome! Looking forward to collaborating with you on this. Would it
make sense to have a meeting next week or so to come up with a full
list of action items? Be sure to share your availability and I'll
organise something.
> I really like how your change integrates with Bazel -- OutputService is definitely a good place to plug the new feature in.
>
> One high-level issue I would like to discuss with you is local execution. What I mean is builds like:
>
> bazel build --strategy=foo=standalone --strategy=bar=remote //foo //bar
>
> The problem here is that are runners like standalone, as you mentioned in the document, will write directly under blaze-out, which means that the FUSE/NFS/ProjFS implementation will need to support writes. I was wondering if it would be desirable to be able to mount the output tree as a read-only file system (OS, not Bazel's FileSystem class)? It seems that if we restricted the strategies to sandboxed ones, it could be feasible to make the runners go through OutputService for their outputs -- that would be trading implementing the write part of the OS file system API for an API to inject the files over gRPC.
Oh, man. I'd love that. Right now the FUSE file system needs to be
pretty complex because of all the POSIXness you need to provide
(renames, hardlinks, random access writes, appending to files, etc.).
Because Bazel is also oblivious of what changes, we need to provide
things like ModifiedFileSet.
Also in terms of snapshotting/persisting data in the FUSE file system
things can be complex. For example, I've noticed that files like
stable-status.txt and volatile-status.txt are updated by doing an
open(O_CREAT|O_TRUNC) instead of unlink();open(O_CREAT|O_EXCL),
meaning you can't just let those be read-only files backed by some
snapshot. Letting file writes go through gRPC would make that easier,
as you could translate it to a removal/replacement under the hood.
> Problems I can see with this:
>
> It looks like sandboxing is not supported on Windows.
> Custom actions writing to outputs directly like the build info action (technically virtualization at the level of Bazel FileSystem could solve that, but that's extra work)
> Implementing writes at the level of OS file system may not be that much more work than adding support for outputs injection.
I'm not sure, but it may also require us to make some changes to
stdout & stderr handling. I've observed that temporary files for those
are written into bazel-out/_tmp/.
> Probably, these reasons are good enough to say no to that, maybe it's worth adding a footnote to the doc? Do you have more thoughts on that?
Yeah, unfortunately I also need support for non-sandboxed actions for
my intended use case for now.
You know what? Let's not add it initially, but at least describe that
we should investigate it in the future. A transition to it could look
like this:
1. We add dedicated RPCs to let Bazel write files straight into the
FUSE file system.
2. We add a boolean to StartBuildRequest that Bazel can set as a hint,
indicating that the remote output service is permitted to offer a
read-only output path.
I'll send out a PR for this, hopefully later today.
Thanks,
--
Ed Schouten <
e...@nuxi.nl>