Repository navigation
feat: Host.Directory dagOp migration (localSource) - #10995
Conversation
74c3dd8 to
8c7394b
Compare
600952e to
aac284a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
6a90d53 to
3541386
Compare
Host.Directory dagOp migration (localSource)
| id.Differ = fsutil.DiffNone | ||
| } | ||
| } | ||
| // TODO: Write a dummy local source to verify that we never use llb.Local anymore |
| // If relPath is ".", we want to use the root path so we can unset it | ||
| // because `"."` leads to unnecessary complications inside snapshot. |
There was a problem hiding this comment.
Does it? That's strange.
The only type of path cleaning I'd expect to see here would be with filepath.Clean.
There was a problem hiding this comment.
filepath.Clean(".") returns "." and that makes local.Sync quite complex to do.
For example strings.CutPrefix("bar", ".") will return "bar", false while technically which will skip the cache change even though we should do it.
Same in copier.copy, if srcComponents = ".", that will change the logic etc...
So I have 2 choices:
- Set
relPathto""if it's"." - Do a bunch of
if relpath == "."to adapt the logic in localfs & copy.
I took the choice of simplicity there, but if you see a reason to go the other way or have another idea, I'm happy to discuss about it :D
There was a problem hiding this comment.
Nope, that's a good explanation.
So either:
- update the comment to replace "unneccessary complications" with that detail
- or just remove "unneccessary complications" entirely, imo, that's fairly clear
| // The operation is not wrapped in dagOp at the schema level, so we manually handle | ||
| // it inside the resolver. | ||
| // That's because it's more convenient to call `MakeDirectoryContentHashed` here | ||
| // that having an option in the `dagOpDirectoryWrapper` |
There was a problem hiding this comment.
As we discussed previously - we should add an arg to the wrapper to call MakeDirectoryContentHashed on the result - that should simplify the need to mess around with args.InDagOp here.
There was a problem hiding this comment.
There's no other function that host.Directory that actually calls MakeDirectoryContentHashed so I thought it would not be useful to add an arg in the wrapper for a single case.
Do you think it's worth going the general way for a single function?
There was a problem hiding this comment.
It'll hugely simplify this function :) so worth it IMO.
Just because we're only using it one place now, doesn't mean we won't want to use it in more places in the future.
There was a problem hiding this comment.
This comment is not true anymore.
a4429da to
6766583
Compare
There was a problem hiding this comment.
We could simplify by removing the windows files and just consolidate entirely under one file.
This is all engine-side, we only support Linux. If we ever extend to support Windows, IMO, there's a lot of bigger issues.
@sipsma any reason to keep these around?
6766583 to
7e19608
Compare
jedevc
left a comment
There was a problem hiding this comment.
Couple nits, merge when fixed!
| dagql.NodeFuncWithCacheKey("directory", | ||
| DagOpDirectoryWrapper( | ||
| srv, s.directory, | ||
| WithHashContentDir[*core.Host, hostDirectoryArgs](), |
There was a problem hiding this comment.
I think you can omit the generic args here, they should be implied from the context?
| // The operation is not wrapped in dagOp at the schema level, so we manually handle | ||
| // it inside the resolver. | ||
| // That's because it's more convenient to call `MakeDirectoryContentHashed` here | ||
| // that having an option in the `dagOpDirectoryWrapper` |
There was a problem hiding this comment.
This comment is not true anymore.
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
…itignore` Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
- move `engine/sources/local` to `engine/filesync` - Rename `LocalSource` to `FileSyncer` Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
Signed-off-by: Tom Chauveau <[email protected]>
7e19608 to
748fbc9
Compare

Convert
Host.Directoryto adagOpoperation.Changes
llb.Localusage and directly calllocalSource.SnapshotinsteadlocalSourceon the dagQL serverlocalSourceoption so it can support new option likeGitIgnorelocalSource.Snapshotbehaviour so it can directly return a snapshot of the expected directory instead of doing extra job after the snapshot to move to the directory (basically we don't need to call.Directoryafter snapshot)Host.Directoryinto a DagOpTODO
TestHost/TestDirectoryGitIgnore/don't_load_files_ignored_by_.gitignore