pepkit / looper

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

improve error on bad presubmit hook script #295

Closed nsheff closed 3 years ago

nsheff commented 3 years ago

I got this error:

Executing pre-submit command: /sfs/qumulo/qproject/shefflab/deploy/plantref/plantref/pipeline_interfaces/build-compute-params.py -a fasta -g Aureococcus_anophagefferens_JGI_1_0
Traceback (most recent call last):
  File "/home/ns5bc/.local/bin/looper", line 10, in <module>
    sys.exit(main())
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/looper.py", line 743, in main
    run(args, rerun=(args.command == "rerun"), **compute_kwargs)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/looper.py", line 351, in __call__
    curr_pl_fails = cndtr.add_sample(sample, rerun=rerun)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/conductor.py", line 294, in add_sample
    self.submit()
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/conductor.py", line 352, in submit
    script = self.write_script(self._pool, self._curr_size)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/conductor.py", line 529, in write_script
    namespaces = _exec_pre_submit(self.pl_iface, namespaces)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/conductor.py", line 640, in _exec_pre_submit
    _update_namespaces(namespaces, json)
  File "/home/ns5bc/.local/lib/python3.6/site-packages/looper/conductor.py", line 611, in _update_namespaces
    for attr, val in list(mapping.items()):
AttributeError: 'str' object has no attribute 'items'

it's because I'm using the old dynamic variables approach and need to put it into the namespace approach expected by the presubmit hook processor.

we can make this message nicer to explain something about what this part is expecting.

stolarczyk commented 3 years ago

Are you suggesting to validate the returned object from the pre submission command?

nsheff commented 3 years ago

yeah! that's an even better way to put it. I guess just somehow notify if the object doesn't follow protocol with an informative message.