-
-
Notifications
You must be signed in to change notification settings - Fork 233
Reduce bind mounting (and thus --bind args) in containers. #1387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
31e409f
b44af89
22e3d48
c86a522
abf2fc9
14814ae
c361501
8e6e789
44116dd
af0c1da
abf614c
f171a22
664df85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,14 +282,19 @@ def get_from_requirements( | |
def append_volume( | ||
runtime: List[str], source: str, target: str, writable: bool = False | ||
) -> None: | ||
runtime.append("--bind") | ||
runtime.append( | ||
"{}:{}:{}".format( | ||
docker_windows_path_adjust(source), | ||
docker_windows_path_adjust(target), | ||
"rw" if writable else "ro", | ||
) | ||
) | ||
src = docker_windows_path_adjust(source) | ||
dst = docker_windows_path_adjust(target) | ||
writable_flag = "rw" if writable else "ro" | ||
if ( | ||
os.path.isfile(src) | ||
and dst.endswith(os.path.basename(src)) | ||
and writable_flag == "ro" | ||
): | ||
src = os.path.dirname(src) | ||
dst = os.path.dirname(dst) | ||
bind_arg = f"--bind={src}:{dst}:{writable_flag}" | ||
if bind_arg not in runtime: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have tried running this PR after getting the
It seems toil actually produces different parent directories for files that might have originally came from the same Directory object. So if files that came from the same directory can be stored as such in the jobstore, I would expect this change to fix the issue |
||
runtime.append(bind_arg) | ||
|
||
def add_file_or_directory_volume( | ||
self, runtime: List[str], volume: MapperEnt, host_outdir_tgt: Optional[str] | ||
|
@@ -403,17 +408,15 @@ def create_runtime( | |
) | ||
) | ||
else: | ||
runtime.append("--bind") | ||
runtime.append( | ||
"{}:{}:rw".format( | ||
"--bind={}:{}:rw".format( | ||
docker_windows_path_adjust(os.path.realpath(self.outdir)), | ||
self.builder.outdir, | ||
) | ||
) | ||
runtime.append("--bind") | ||
tmpdir = "/tmp" # nosec | ||
runtime.append( | ||
"{}:{}:rw".format( | ||
"--bind={}:{}:rw".format( | ||
docker_windows_path_adjust(os.path.realpath(self.tmpdir)), tmpdir | ||
) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uuid5 is deterministic. This groups together files that were previously grouped together by providing the same uuid for each file with the same
os.path.dirname
, so it violates completely separating files. This should avoid conflicts.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok! Why
s5g
instead ofstg
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you be passing something to
uuid.uuid5
related to thefob.location
?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed
s5g
just in case this needs to distinguish behavior in the future based on versions. Though it's not necessary.And
fob['location']
is line 176, the comment blurb doesn't make it visible here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So
"s5g%s" % uuid.uuid5(uuid.UUID('6a56ca02-b6f0-4c1a-a4b0-fb0068ce80ad'
generates a static string that will never change, to which you make a subdir based upon the directory name of thelocation
field. So why not skip to the directory name itself? Or use it to see theuuid5
generator?What if there are location URIs that end in the same directory name but are otherwise unrelated? This could lead to files overwriting each other. Or files being adjacent to one another when they should not be.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go through my thinking on this, and please point out any flaws.
Uuid5 generates different uuids for different seeds, the seed in this PR being both the file's directory and a static uuid. So
uuid.uuid5(arg1, arg2) = uuid_a
anduuid.uuid5(arg1, arg3) = uuid_b
. The difference is that ifuuid.uuid5(arg1, arg2) = uuid_a
occurs again, it will generate the sameuuid_a
output.The idea being that all pre-existing paths cannot conflict since they co-existed together peacefully in the first place.
So files:
would map to these inside of the container:
If I understand your question correctly, we could use the same directory names as the files originally had, but they might conflict with folders that already exist within the container.
If I understand this to be to "seed" the uuid5 generator with the directory, I'm using
os.path.dirname(fob['location']))
to seed the uuid5. Though I'm not sure if that's the question here.I was wondering about this, and was trying to reason if this could happen if the input files were writable in a an input dir outside of the workdir. I haven't tested this.
Some of this too is that I tried to switch to a simpler strategy and it may just not work.