-
Notifications
You must be signed in to change notification settings - Fork 359
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-966 Add Cascades, remove Directory from Biscayne #7105
Changes from 13 commits
0076eea
0778940
88233b3
8c287c7
299406e
0a0b64b
c9bd54f
588dca2
5097cd4
d812b7d
6164bf3
7248929
df18c8c
265e7e6
a4d2d63
672c056
f482c41
176de35
d5fa2fc
a738ca3
a3351bf
5995dca
fecdc12
45aefa7
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: directory_type_local_denied | ||
testFormat: workflowfailure | ||
tags: [localdockertest, "wdl_biscayne"] | ||
backends: [Local, LocalNoDocker] | ||
|
||
files { | ||
workflow: wdl_biscayne/biscayne_prohibits_directory/directory_type.wdl | ||
inputs: wdl_biscayne/biscayne_prohibits_directory/directory_type_local_inputs.json | ||
} | ||
|
||
metadata { | ||
status: Failed | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version development | ||
version development-1.1 | ||
|
||
workflow biscayne_new_engine_functions { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
version development-1.1 | ||
|
||
workflow directory_type { | ||
input { | ||
String text2loc = "text2" | ||
} | ||
call make_directory { input: text2loc = text2loc } | ||
call read_from_directory { input: d = make_directory.d, text2loc = text2loc } | ||
|
||
output { | ||
Array[String] out = read_from_directory.contents | ||
} | ||
} | ||
|
||
task make_directory { | ||
input { | ||
String text2loc | ||
} | ||
String text2dir = sub("foo/~{text2loc}", "/[^/]*$", "") | ||
command { | ||
mkdir foo | ||
mkdir -p ~{text2dir} | ||
echo "foo text" > foo/text | ||
echo "foo text2" > foo/~{text2loc} | ||
} | ||
runtime { | ||
docker: "ubuntu:latest" | ||
} | ||
output { | ||
Directory d = "foo/" | ||
} | ||
} | ||
|
||
task read_from_directory { | ||
input { | ||
String text2loc | ||
Directory d | ||
} | ||
command { | ||
cat ~{d}/text | ||
cat ~{d}/~{text2loc} | ||
} | ||
runtime { | ||
docker: "ubuntu:latest" | ||
} | ||
output { | ||
Array[String] contents = read_lines(stdout()) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version development | ||
version development-1.1 | ||
|
||
workflow default_default { | ||
call default_default_task | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version development | ||
version development-1.1 | ||
|
||
struct JsonObj { | ||
String field1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory_type.text2loc": "bar/text2" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -461,13 +461,21 @@ languages { | |
} | ||
} | ||
"biscayne" { | ||
# WDL biscayne is our in-progress name for what will (probably) become WDL 1.1 | ||
# WDL biscayne is our in-progress name for what will become WDL 1.1 | ||
language-factory = "languages.wdl.biscayne.WdlBiscayneLanguageFactory" | ||
config { | ||
strict-validation: true | ||
enabled: true | ||
} | ||
} | ||
"cascades" { | ||
# WDL cascades is our in-progress name for what will (probably) become WDL 2.0 | ||
language-factory = "languages.wdl.cascades.WdlCascadesLanguageFactory" | ||
config { | ||
strict-validation: true | ||
enabled: true | ||
} | ||
} | ||
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 suspect the answer is "yes" but want to confirm - this is all the config needed to support this change, right? We don't need to adjust anything in Terra deployments? 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. For the sake of completeness, filed https://github.com/broadinstitute/firecloud-develop/pull/3349. Also fixes the current |
||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,7 @@ object LanguageFactoryUtil { | |
} | ||
|
||
val firstCodeLine = fileWithoutInitialWhitespace.headOption.map(_.dropWhile(_.isWhitespace)) | ||
firstCodeLine.exists { line => startsWithOptions.exists(line.startsWith) } | ||
firstCodeLine.exists { line => startsWithOptions.contains(line) } | ||
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. Does this catch things we don't want, like ?
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. The |
||
} | ||
|
||
def chooseFactory(workflowSource: WorkflowSource, wsfc: WorkflowSourceFilesCollection): ErrorOr[LanguageFactory] = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package languages.wdl.cascades | ||
|
||
import java.util.concurrent.Callable | ||
|
||
import cats.syntax.either._ | ||
import cats.instances.either._ | ||
import cats.data.EitherT.fromEither | ||
import cats.effect.IO | ||
import com.typesafe.config.Config | ||
import common.Checked | ||
import common.transforms.CheckedAtoB | ||
import common.validation.ErrorOr.ErrorOr | ||
import common.validation.IOChecked.IOChecked | ||
import cromwell.core._ | ||
import cromwell.languages.util.ImportResolver._ | ||
import cromwell.languages.util.{LanguageFactoryUtil, ParserCache} | ||
import cromwell.languages.util.ParserCache.ParserCacheInputs | ||
import cromwell.languages.{LanguageFactory, ValidatedWomNamespace} | ||
import wdl.transforms.base.wdlom2wom.WomBundleToWomExecutable._ | ||
import wdl.transforms.base.wdlom2wom._ | ||
import wdl.transforms.cascades.ast2wdlom._ | ||
import wdl.transforms.cascades.parsing._ | ||
import wdl.transforms.cascades.wdlom2wom._ | ||
import wom.ResolvedImportRecord | ||
import wom.core.{WorkflowJson, WorkflowOptionsJson, WorkflowSource} | ||
import wom.executable.WomBundle | ||
import wom.expression.IoFunctionSet | ||
import wom.transforms.WomExecutableMaker.ops._ | ||
|
||
class WdlCascadesLanguageFactory(override val config: Config) extends LanguageFactory with ParserCache[WomBundle] { | ||
|
||
override val languageName: String = "WDL" | ||
override val languageVersionName: String = "Cascades" | ||
|
||
override def validateNamespace(source: WorkflowSourceFilesCollection, | ||
workflowSource: WorkflowSource, | ||
workflowOptions: WorkflowOptions, | ||
importLocalFilesystem: Boolean, | ||
workflowIdForLogging: WorkflowId, | ||
ioFunctions: IoFunctionSet, | ||
importResolvers: List[ImportResolver]): IOChecked[ValidatedWomNamespace] = { | ||
|
||
val factories: List[LanguageFactory] = List(this) | ||
|
||
val checked: Checked[ValidatedWomNamespace] = for { | ||
_ <- enabledCheck | ||
bundle <- getWomBundle(workflowSource, workflowSourceOrigin = None, source.workflowOptions.asPrettyJson, importResolvers, factories) | ||
executable <- createExecutable(bundle, source.inputsJson, ioFunctions) | ||
} yield executable | ||
|
||
fromEither[IO](checked) | ||
|
||
} | ||
|
||
override def getWomBundle(workflowSource: WorkflowSource, | ||
workflowSourceOrigin: Option[ResolvedImportRecord], | ||
workflowOptionsJson: WorkflowOptionsJson, | ||
importResolvers: List[ImportResolver], | ||
languageFactories: List[LanguageFactory], | ||
convertNestedScatterToSubworkflow : Boolean = true): Checked[WomBundle] = { | ||
|
||
val converter: CheckedAtoB[FileStringParserInput, WomBundle] = stringToAst andThen wrapAst andThen astToFileElement.map(FileElementToWomBundleInputs(_, workflowOptionsJson, convertNestedScatterToSubworkflow, importResolvers, languageFactories, workflowDefinitionElementToWomWorkflowDefinition, taskDefinitionElementToWomTaskDefinition)) andThen fileElementToWomBundle | ||
|
||
lazy val validationCallable = new Callable[ErrorOr[WomBundle]] { | ||
def call: ErrorOr[WomBundle] = converter | ||
.run(FileStringParserInput(workflowSource, workflowSourceOrigin.map(_.importPath).getOrElse("input.wdl"))) | ||
.map(b => b.copyResolvedImportRecord(b, workflowSourceOrigin)).toValidated | ||
} | ||
|
||
lazy val parserCacheInputs = ParserCacheInputs(Option(workflowSource), workflowSourceOrigin.map(_.importPath), None, importResolvers) | ||
|
||
for { | ||
_ <- enabledCheck | ||
womBundle <- retrieveOrCalculate(parserCacheInputs, validationCallable).toEither | ||
} yield womBundle | ||
} | ||
|
||
override def createExecutable(womBundle: WomBundle, inputsJson: WorkflowJson, ioFunctions: IoFunctionSet): Checked[ValidatedWomNamespace] = { | ||
for { | ||
_ <- enabledCheck | ||
executable <- womBundle.toWomExecutable(Option(inputsJson), ioFunctions, strictValidation) | ||
validated <- LanguageFactoryUtil.validateWomNamespace(executable, ioFunctions) | ||
} yield validated | ||
} | ||
|
||
override def looksParsable(content: String): Boolean = LanguageFactoryUtil.simpleLooksParseable(List("version development"), List("#"))(content) | ||
} |
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.
Assuming this change will be reverted before merge?