Skip to content

Commit ea26d97

Browse files
authored
Fix for no memory + memory expression (#101)
* Fix for no memory + memory expression * Add miniwdl to base reqs to fix tests * Fix fromwdl test
1 parent f1bea16 commit ea26d97

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

janis_core/ingestion/fromwdl.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,15 @@ def container_from_runtime(cls, runtime, inputs: List[WDL.Decl]):
177177

178178
def parse_memory_requirement(self, value):
179179
s = self.translate_expr(value)
180-
if isinstance(s, str):
180+
if s is None:
181+
return 1.074
182+
elif isinstance(s, str):
181183
if s.lower().endswith("g"):
182184
return float(s[:-1].strip())
183185
if s.lower().endswith("gb"):
184186
return float(s[:-2].strip())
185187
elif s.lower().endswith("gib"):
186-
return float(s[:-3].strip()) * 0.931323
188+
return float(s[:-3].strip()) * 1.074
187189
elif s.lower().endswith("mb"):
188190
return float(s[:-2].strip()) / 1000
189191
elif s.lower().endswith("mib"):
@@ -235,7 +237,7 @@ def from_loaded_task(self, obj: WDL.Task):
235237
inputs = obj.inputs
236238

237239
cpus = self.translate_expr(rt.get("cpu"))
238-
if cpus is not None and not isinstance(cpus, (int, float)):
240+
if not isinstance(cpus, j.Selector) and cpus is not None and not isinstance(cpus, (int, float)):
239241
cpus = int(cpus)
240242

241243
c = j.CommandToolBuilder(

janis_core/tests/test_from_wdl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ class TestFromWdl(unittest.TestCase):
88

99
def test_missing_disk(self):
1010
result = self.parser.parse_disk_requirement(None)
11-
self.assertEqual(0.931323, result)
11+
self.assertEqual(2.14748, result)

requirements/base.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ tabulate
66
path
77
cwlformat >= 2020.5.19
88
cwl-utils >= 0.6
9-
graphviz
9+
graphviz
10+
miniwdl

0 commit comments

Comments
 (0)