-
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
Workflow url in run mode #3988
Workflow url in run mode #3988
Conversation
docs/CommandLine.md
Outdated
@@ -40,7 +41,7 @@ The Cromwell jar file can be built as described in [Building](Building). | |||
`run` mode executes a single workflow in Cromwell and then exits. | |||
|
|||
* **`workflow-source`** | |||
The single required argument for the workflow source file. | |||
The single required argument. It can either be a workflow source file or a url pointing to the workflow (The maximum length of url can be 2000 characters). |
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.
Not sure I would bother with the part between parentheses since that limit is so high it's unlikely anyone would ever hit it.
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.
Makes sense. Will remove it 👍
} | ||
|
||
workflowUrl.length match { | ||
case l if l > 2000 => s"Invalid workflow url. Length of the url:$l is more than 2000 characters".invalidNel |
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.
TOL something like val MaxWorkflowUrlLength = 2000
in the companion object would be nice.
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.
TOL suggestion: Invalid workflow url: url has length $l, longer than the maximum allowed $MaxWorkflowUrlLength characters.
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.
Good point!
logger.info("Pre Processing Workflow...") | ||
lazy val preProcessedCwl = cwlPreProcessor.preProcessCwlFileToString(workflowPath, None) | ||
|
||
imports match { | ||
case Some(explicitImports) => readOptionContent("Workflow source", workflowSource).map((_, Option(File(explicitImports.pathAsString)), workflowRoot)) | ||
case None => Try(preProcessedCwl.map((_, None, None)).value.unsafeRunSync()) | ||
case Some(_) => readContent("Workflow source", workflowSourcePath) |
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'm not following what's going on here with imports. If they're present the logic reads the workflow source from the source path but ignores the imports. If the imports are missing this returns the preprocessed CWL.
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 have tried to keep this CWL part of logic same as it was before workflow url was introduced. I thought it was better to keep it the same way as before.
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.
Talked with @Horneth, and it does make sense to send CWL file path as workflow url if imports are present (in Run mode). Will change it. :)
case (None, Some(url)) => PartialWorkflowSources.convertStringToUrl(url) | ||
case (Some(_), Some(_)) => "Both Workflow source and Workflow url can't be supplied".invalidNel | ||
case (None, None) => "Workflow source and Workflow url needs to be supplied".invalidNel | ||
def getWorkflowSourceFromPath(workflowPath: Path): ErrorOr[(Option[String], Option[String])] = { |
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.
TOL This 2-tuple of optional Strings would probably be better as a proper type, something like
case class SourceOrUrl(source: Option[String], url: Option[String])
but there are other options for representing this as well.
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.
Makes sense! Thank you! I have implemented the case class :)
workflowSource = w, | ||
workflowUrl = u, | ||
workflowSource = finalWorkflowSourceAndUrl._1, | ||
workflowUrl = finalWorkflowSourceAndUrl._2, |
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.
if you do the case class
thing above you can unapply:
val SourceOrUrl(source, url) = {
if (w.isDefined) (w, u)
.
.
.
}
.
.
.
WorkflowSingleSubmission(
workflowSource = source,
workflowUrl = url,
.
.
.
)
7bdddb4
to
9c6560c
Compare
9c6560c
to
757617f
Compare
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.
Just a few minor nit-picks
docs/CommandLine.md
Outdated
@@ -40,7 +41,7 @@ The Cromwell jar file can be built as described in [Building](Building). | |||
`run` mode executes a single workflow in Cromwell and then exits. | |||
|
|||
* **`workflow-source`** | |||
The single required argument for the workflow source file. | |||
The single required argument. It can either be a workflow source file or a url pointing to the workflow. |
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 would say "it can be either a local path or a remote URL pointing to the workflow source file"
} | ||
|
||
workflowUrl.length match { | ||
case l if l > MaxWorkflowUrlLength => s"Invalid workflow url: url has length $l, longer than the maximum allowed $MaxWorkflowUrlLength characters".invalidNel |
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.
Minor point but this whole match
/case
could be restructured as a simpler if (l > MaxWorkflowUrlLength) {} else {}
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.
It sure can! 👍
@@ -175,17 +176,24 @@ object CromwellEntryPoint extends GracefulStopSupport { | |||
import spray.json._ | |||
|
|||
val validation = args.validateSubmission(EntryPointLogger) map { | |||
case ValidSubmission(w, u, r, i, o, l, z) => | |||
case ValidSubmission(w, u, r, i, o, l, z) =>{ |
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.
The {
and }
are redundant on a case
(but maybe you want them to make things easier to read?)
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.
Yeah I like to add braces if it make things easier to read. But, here it does not matter as there is just one case! So, will remove it.
validation.get.workflowUrl shouldBe Some(threeStep.wdl) | ||
} | ||
|
||
it should "run single when supplying workflow using url" in { |
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.
what does "run single" mean?
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.
Run single workflow/submission. The test is meant for Run
mode.
* Workflow url support in Run mode
This PR adds the remaining functionality of submitting workflow url to run a workflow in
Run
mode.Closes #3849
Closes #3986