pepkit / looper

A job submitter for Portable Encapsulated Projects
http://looper.databio.org
BSD 2-Clause "Simplified" License
20 stars 7 forks source link

CWL plugin requires input schema #309

Closed stolarczyk closed 3 years ago

stolarczyk commented 3 years ago

We say describe the input_schema attribute as "RECOMMENDED" in the pipeline interface spec, but the CWL plugin requires this attribute and does not fail gracefully when it's not defined:

[mstolarczyk@MichalsMBP test_hooks]: looper run -d cfg.yaml -p local
Looper version: 1.3.0-dev
Command: run
Activating compute package 'local'
## [1 of 2] sample: sample1; pipeline: PIPELINE1
Calling pre-submit function: looper.write_sample_yaml_cwl
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/attmap/ordattmap.py", line 45, in __getitem__
    return super(OrdAttMap, self).__getitem__(item)
KeyError: 'input_schema'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/looper", line 10, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/looper/looper.py", line 743, in main
    run(args, rerun=(args.command == "rerun"), **compute_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/looper/looper.py", line 351, in __call__
    curr_pl_fails = cndtr.add_sample(sample, rerun=rerun)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/looper/conductor.py", line 364, in add_sample
    self.submit()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/looper/conductor.py", line 401, in submit
    script = self.write_script(self._pool, self._curr_size)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/looper/conductor.py", line 555, in write_script
    namespaces = _exec_pre_submit(self.pl_iface, namespaces)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/looper/conductor.py", line 653, in _exec_pre_submit
    _update_namespaces(namespaces, func(namespaces))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/looper/conductor.py", line 133, in write_sample_yaml_cwl
    schema_path = get_schema_source(namespaces["pipeline"]["input_schema"])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/attmap/pathex_attmap.py", line 51, in __getitem__
    v = super(PathExAttMap, self).__getitem__(item)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/attmap/ordattmap.py", line 47, in __getitem__
    return AttMap.__getitem__(self, item)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/attmap/attmap.py", line 32, in __getitem__
    return self.__dict__[item]
KeyError: 'input_schema'
stolarczyk commented 3 years ago

Should I make it fail with a more informative error or should it silently just skip the schema-sourced sample attributes ?

nsheff commented 3 years ago

this is related to https://github.com/pepkit/peppy/issues/356#issuecomment-703757580

there's probably a better way to do this. if there's no schema, then the plugin wouldn't need to adjust the yaml and and just output the regular one.

For now, it should simply not fail here, just not do anything. err-- just print out the basic yaml without any cwl-specific updates, since no attributes were specified as files.

In the future, this should be using some other variable, I think, rather than re-parsing the schema.