-
Notifications
You must be signed in to change notification settings - Fork 360
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
WX-1530 Strip pesky URL bits when creating local paths for HTTP inputs #7404
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4071133
Strip query params and fragments from http paths when turning them in…
jgainerdewar 7cccade
Tests
jgainerdewar 529d151
Merge branch 'develop' into jgd_WX-1530_goawaykvparams
jgainerdewar c80ec62
Merge branch 'develop' into jgd_WX-1530_goawaykvparams
jgainerdewar 9f1ad30
Merge branch 'develop' into jgd_WX-1530_goawaykvparams
jgainerdewar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ import cromwell.core.retry.Retry._ | |
import cromwell.core.retry.SimpleExponentialBackoff | ||
import cromwell.filesystems.blob.{BlobPath, WSMBlobSasTokenGenerator} | ||
import cromwell.filesystems.drs.{DrsPath, DrsResolver} | ||
import cromwell.filesystems.http.HttpPath | ||
import net.ceedubs.ficus.Ficus._ | ||
import wom.values.WomFile | ||
|
||
|
@@ -176,6 +177,46 @@ object TesAsyncBackendJobExecutionActor { | |
) | ||
) | ||
} | ||
|
||
def mapInputPath(path: Path, tesJobPaths: TesJobPaths, commandDirectory: Path): String = | ||
path match { | ||
case drsPath: DrsPath => | ||
val filepath = DrsResolver.getContainerRelativePath(drsPath).unsafeRunSync() | ||
tesJobPaths.containerExec(commandDirectory, filepath) | ||
case httpPath: HttpPath => | ||
// Strip the query params and anything after a # from http paths when turning them into local paths | ||
tesJobPaths.callInputsDockerRoot | ||
.resolve(httpPath.pathWithoutSchemeOrQueryOrFragment.stripPrefix("/")) | ||
.pathAsString | ||
Comment on lines
+186
to
+190
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. This is the part that changed. |
||
case path: Path if path.startsWith(tesJobPaths.workflowPaths.DockerRoot) => | ||
path.pathAsString | ||
case path: Path if path.equals(tesJobPaths.callExecutionRoot) => | ||
commandDirectory.pathAsString | ||
case path: Path if path.startsWith(tesJobPaths.callExecutionRoot) => | ||
tesJobPaths.containerExec(commandDirectory, path.name) | ||
case path: Path if path.startsWith(tesJobPaths.callRoot) => | ||
tesJobPaths.callDockerRoot.resolve(path.name).pathAsString | ||
case path: BlobPath if path.startsWith(tesJobPaths.workflowPaths.workflowRoot) => | ||
// Blob paths can get really long, which causes problems for some tools. If this input file | ||
// lives in the workflow execution directory, strip off that prefix from the path we're | ||
// generating inside `inputs/` to keep the total path length under control. | ||
// In Terra on Azure, this saves us 200+ characters. | ||
tesJobPaths.callInputsDockerRoot | ||
.resolve( | ||
path.pathStringWithoutPrefix(tesJobPaths.workflowPaths.workflowRoot) | ||
) | ||
.pathAsString | ||
case path: BlobPath if path.startsWith(tesJobPaths.workflowPaths.executionRoot) => | ||
// See comment above... if this file is in the execution root, strip that off. | ||
// In Terra on Azure, this saves us 160+ characters. | ||
tesJobPaths.callInputsDockerRoot | ||
.resolve( | ||
path.pathStringWithoutPrefix(tesJobPaths.workflowPaths.executionRoot) | ||
) | ||
.pathAsString | ||
case _ => | ||
tesJobPaths.callInputsDockerRoot.resolve(path.pathWithoutScheme.stripPrefix("/")).pathAsString | ||
} | ||
} | ||
|
||
class TesAsyncBackendJobExecutionActor(override val standardParams: StandardAsyncExecutionActorParams) | ||
|
@@ -262,37 +303,8 @@ class TesAsyncBackendJobExecutionActor(override val standardParams: StandardAsyn | |
override def mapCommandLineJobInputWomFile(womFile: WomFile): WomFile = | ||
womFile.mapFile(value => | ||
getPath(value) match { | ||
case Success(drsPath: DrsPath) => | ||
val filepath = DrsResolver.getContainerRelativePath(drsPath).unsafeRunSync() | ||
tesJobPaths.containerExec(commandDirectory, filepath) | ||
case Success(path: Path) if path.startsWith(tesJobPaths.workflowPaths.DockerRoot) => | ||
path.pathAsString | ||
case Success(path: Path) if path.equals(tesJobPaths.callExecutionRoot) => | ||
commandDirectory.pathAsString | ||
case Success(path: Path) if path.startsWith(tesJobPaths.callExecutionRoot) => | ||
tesJobPaths.containerExec(commandDirectory, path.name) | ||
case Success(path: Path) if path.startsWith(tesJobPaths.callRoot) => | ||
tesJobPaths.callDockerRoot.resolve(path.name).pathAsString | ||
case Success(path: BlobPath) if path.startsWith(tesJobPaths.workflowPaths.workflowRoot) => | ||
// Blob paths can get really long, which causes problems for some tools. If this input file | ||
// lives in the workflow execution directory, strip off that prefix from the path we're | ||
// generating inside `inputs/` to keep the total path length under control. | ||
// In Terra on Azure, this saves us 200+ characters. | ||
tesJobPaths.callInputsDockerRoot | ||
.resolve( | ||
path.pathStringWithoutPrefix(tesJobPaths.workflowPaths.workflowRoot) | ||
) | ||
.pathAsString | ||
case Success(path: BlobPath) if path.startsWith(tesJobPaths.workflowPaths.executionRoot) => | ||
// See comment above... if this file is in the execution root, strip that off. | ||
// In Terra on Azure, this saves us 160+ characters. | ||
tesJobPaths.callInputsDockerRoot | ||
.resolve( | ||
path.pathStringWithoutPrefix(tesJobPaths.workflowPaths.executionRoot) | ||
) | ||
.pathAsString | ||
case Success(path: Path) => | ||
tesJobPaths.callInputsDockerRoot.resolve(path.pathWithoutScheme.stripPrefix("/")).pathAsString | ||
TesAsyncBackendJobExecutionActor.mapInputPath(path, tesJobPaths, commandDirectory) | ||
case _ => | ||
value | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Pulled this logic out so I could test it "easily"