> On July 20, 2016, 8:14 a.m., Joerg Schad wrote: > > src/launcher/fetcher.cpp, line 436 > > <https://reviews.apache.org/r/50199/diff/2/?file=1447745#file1447745line436> > > > > Do we really want to check and fail on this condition? In the previous > > iteration you would have skipped creating the directory in that case. > > Also judging from the code `` const Option<string> cacheDirectory = > > fetcherInfo.get().has_cache_directory() ? > > Option<string>::some(fetcherInfo.get().cache_directory()) : > > Option<string>::none();``` below, it seems it is valid that > > there is no cache_directory. > > Joerg Schad wrote: > just seen your comment on the previous patch set. Does it in that case > make sense to add a check and change the logic of the above mentioned code?
So actually, I do think that I should remove this check :) sorry for the confusion... I'm inclined to leave the code that you mentioned as-is; while our current implementation does guarantee that `FetcherInfo` will always contain a cache directory, there's no reason that this _must_ be the case if the cache is being bypassed, so I don't think we should enforce it in the fetcher binary itself. Since `fetchThroughCache` performs the necessary check when the cache _is_ being used, I think the code you quoted is OK. However, in order to make it so the fetcher binary does not assume that the cache directory is always included, I should remove this CHECK. > On July 20, 2016, 8:14 a.m., Joerg Schad wrote: > > src/launcher/fetcher.cpp, line 510 > > <https://reviews.apache.org/r/50199/diff/2/?file=1447745#file1447745line510> > > > > Does the name `result` make sense at this point? > > Maybe something like `cacheDirectory`? I think this is OK, since `result` doesn't contain the cache directory itself, the `Try` is just used to propagate an error. I wonder if an `Option<Error>` would be better? > On July 20, 2016, 8:14 a.m., Joerg Schad wrote: > > src/launcher/fetcher.cpp, line 438 > > <https://reviews.apache.org/r/50199/diff/2/?file=1447745#file1447745line438> > > > > This comment should move one line down or? (as you now have the create > > logic in the loop as well). I expanded this comment a bit so that it makes sense (I hope) in its current location. > On July 20, 2016, 8:14 a.m., Joerg Schad wrote: > > src/launcher/fetcher.cpp, line 514 > > <https://reviews.apache.org/r/50199/diff/2/?file=1447745#file1447745line514> > > > > I personally would still use this cacheDirectory as parameter to > > createCacheDirectory for the following reason: we need to extract it anyhow > > and otherwise we do that at two different places. Feel free to drop if you > > have a different opinion. With the current diff, the only extra work done in `createCacheDirectory` is `if (fetcherInfo.has_cache_directory())`, which seems OK to me. I think that we could definitely refactor the various fetching functions in this file to clean things up, but perhaps we could do that in separate patches. - Greg ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/50199/#review142913 ----------------------------------------------------------- On July 20, 2016, 7:50 p.m., Greg Mann wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/50199/ > ----------------------------------------------------------- > > (Updated July 20, 2016, 7:50 p.m.) > > > Review request for mesos, Gilbert Song, Jie Yu, and Joerg Schad. > > > Bugs: MESOS-5845 > https://issues.apache.org/jira/browse/MESOS-5845 > > > Repository: mesos > > > Description > ------- > > The fetcher's launcher creates the fetcher cache > directory for each user immediately before an artifact > is fetched. In order to allow this directory to be > created by a different user than the user doing the > fetching, this patch factors out this directory > creation and places it before all fetches occur. > > > Diffs > ----- > > src/launcher/fetcher.cpp 0539b0182bd4a7178f103dddd1ab4fee8fc79eda > > Diff: https://reviews.apache.org/r/50199/diff/ > > > Testing > ------- > > `sudo make check` on both OSX and CentOS 7 was done at the end of this patch > chain. > > > Thanks, > > Greg Mann > >
