-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3123 from broadinstitute/cjl_initial_work_dir_req…
…uirement_7 Allow ECMA script functions as well as expressions in IWDR fields
- Loading branch information
Showing
5 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...src/main/resources/standardTestCases/InitialWorkDirRequirement.input_string_function.test
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: iwdr_input_string_function | ||
testFormat: workflowsuccess | ||
workflowType: CWL | ||
workflowRoot: iwdr_input_string_function | ||
workflowTypeVersion: v1.0 | ||
|
||
files { | ||
wdl: InitialWorkDirRequirement/input_string_function.cwl | ||
} | ||
|
||
metadata { | ||
"submittedFiles.workflowType": CWL | ||
"submittedFiles.workflowTypeVersion": v1.0 | ||
"outputs.iwdr_input_string_function.prime_list": "[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]" | ||
} |
49 changes: 49 additions & 0 deletions
49
.../src/main/resources/standardTestCases/InitialWorkDirRequirement/input_string_function.cwl
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Little tool that uses a prime sieve to generate primes up to 100 | ||
|
||
cwlVersion: v1.0 | ||
$graph: | ||
- id: iwdr_input_string_function | ||
class: CommandLineTool | ||
baseCommand: ['python3'] | ||
requirements: | ||
- class: DockerRequirement | ||
dockerPull: "python:3.5.0" | ||
- class: InitialWorkDirRequirement | ||
listing: | ||
- entryname: ${var result = inputs.script_name + ".py"; return result;} | ||
entry: ${var scr = inputs.script; return scr + "print(result);"} | ||
|
||
stdout: "primes" | ||
inputs: | ||
- id: script | ||
type: string | ||
default: | | ||
import sys | ||
import math | ||
|
||
limit = int(sys.argv[1]) | ||
sieve = [True for i in range(limit)] | ||
for i in range(2, math.floor(limit / 2)): | ||
if sieve[i]: | ||
for j in range(i * 2, limit, i): | ||
sieve[j] = False | ||
|
||
result = "[" | ||
for i in range(2, limit): | ||
if sieve[i]: | ||
if result != "[": | ||
result += ", " | ||
result += str(i) | ||
result += "]" | ||
|
||
- id: script_name | ||
type: string | ||
default: "prime_sieve.py" | ||
arguments: [ '${var result = inputs.script_name + ".py"; return result;}', '100' ] | ||
outputs: | ||
- id: prime_list | ||
type: string | ||
outputBinding: | ||
glob: primes | ||
loadContents: true | ||
outputEval: $(self[0].contents.trim()) |
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
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