toil icon indicating copy to clipboard operation
toil copied to clipboard

toil-wdl-runner does not handle string to file coercion properly for optional file types

Open stxue1 opened this issue 8 months ago • 0 comments

version 1.1
workflow testWorkflow {
  input {
  }
  call testTask
  output {
    Array[File?] array_in_output = testTask.array_in_output
    Int len_in_output = testTask.len_in_output
    Array[File?] array_in_body_out = testTask.array_in_body_out
    Int len_in_body_out = testTask.len_in_body_out
    Array[File?] array_in_input_out = testTask.array_in_input_out
    Int len_in_input_out = testTask.len_in_input_out
  }
}

task testTask {
  input {
    Array[File?] array_in_input = ["example1.txt", "example2.txt"]
    Int len_in_input = length(select_all(array_in_input))
  }
  command <<<>>>
  Array[File?] array_in_body = ["example1.txt", "example2.txt"]
  Int len_in_body = length(select_all(array_in_body))
  output {
    Array[File?] array_in_output = ["example1.txt", "example2.txt"]
    Int len_in_output = length(select_all(array_in_output))
    Array[File?] array_in_body_out = array_in_body
    Int len_in_body_out = len_in_body
    Array[File?] array_in_input_out = array_in_input
    Int len_in_input_out = len_in_input
  }
}
Workflow Progress 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 (2 failures) [00:06<00:00, 0.31 jobs/s]
Traceback (most recent call last):
  File "/home/heaucques/Documents/toil/venv3.12/bin/toil-wdl-runner", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/heaucques/Documents/toil/src/toil/wdl/wdltoil.py", line 143, in decorated
    return decoratee(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/heaucques/Documents/toil/src/toil/wdl/wdltoil.py", line 3401, in main
    output_bindings = toil.start(root_job)
                      ^^^^^^^^^^^^^^^^^^^^
  File "/home/heaucques/Documents/toil/src/toil/common.py", line 940, in start
    return self._runMainLoop(rootJobDescription)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/heaucques/Documents/toil/src/toil/common.py", line 1427, in _runMainLoop
    jobCache=self._jobCache).run()
                             ^^^^^
  File "/home/heaucques/Documents/toil/src/toil/leader.py", line 293, in run
    raise FailedJobsException(self.jobStore, failed_jobs, exit_code=self.recommended_fail_exit_code)
toil.exceptions.FailedJobsException: The job store '/tmp/tmphms0zesx/tree' contains 1 failed jobs: 'WDLTaskWrapperJob' testWorkflow.testTask.inputs kind-WDLRootJob/instance-zx1nkxjy v12
Log from job "'WDLTaskWrapperJob' testWorkflow.testTask.inputs kind-WDLRootJob/instance-zx1nkxjy v12" follows:
=========>
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.worker] ---TOIL WORKER OUTPUT LOG---
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil] Running Toil version 7.1.0a1-ccf57e6071e32675daabdcbacb91988e871745a9 on host pop-os.
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.worker] Working on job 'WDLTaskWrapperJob' testWorkflow.testTask.inputs kind-WDLRootJob/instance-zx1nkxjy v10
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.worker] Loaded body Job('WDLTaskWrapperJob' testWorkflow.testTask.inputs kind-WDLRootJob/instance-zx1nkxjy v10) from description 'WDLTaskWrapperJob' testWorkflow.testTask.inputs kind-WDLRootJob/instance-zx1nkxjy v10
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.wdl.wdltoil] Evaluating inputs and runtime for task testTask (['testTask']) called as testWorkflow.testTask
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.wdl.wdltoil] Defaulting array_in_input to ["example1.txt", "example2.txt"]
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.wdl.wdltoil] Defaulting len_in_input to length(select_all(array_in_input))
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.wdl.wdltoil] Defaulting array_in_body to ["example1.txt", "example2.txt"]
	[2024-06-26T18:59:44-0700] [MainThread] [I] [toil.wdl.wdltoil] Defaulting len_in_body to length(select_all(array_in_body))
	[2024-06-26T18:59:44-0700] [MainThread] [C] [toil.wdl.wdltoil] Could not evaluate task code because:
	
	🚨🚨🚨
	[Errno 2] No such file or directory: '/tmp/toilwf-a8a916d9dc5a5a028892a55718782ccc/9777/job/example1.txt'
	🚨🚨🚨
	
	[2024-06-26T18:59:44-0700] [MainThread] [E] [toil.worker] Exiting the worker because of a failed job on host pop-os

The above workflow does not work as Toil attempts to check that example1.txt exists despite the type being declared as optional. This should mean the array becomes [null, null].

This is related to https://github.com/chanzuckerberg/miniwdl/issues/696. MiniWDL handles this case only on task outputs (workflows do not work) by running a check at file exports.

┆Issue is synchronized with this Jira Story ┆Issue Number: TOIL-1605

stxue1 avatar Jun 27 '24 02:06 stxue1