Bug #11681

[SDK] Cannot compare newstr() and str()

Added by Peter Amstutz 4 months ago. Updated 4 months ago.

Status:ResolvedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:2017-05-24 sprint
Story points-
Velocity based estimate-

Description

arvados-cwl-runner crashes on Python 2.7 since merging Python 3 compatability:

2017-05-11 13:46:02 arvados.cwl-runner ERROR: Execution failed: unorderable types: str() and <type 'str'>
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/arvados_cwl/__init__.py", line 464, in arv_executor
    runnable.run(**kwargs)
  File "build/bdist.linux-x86_64/egg/arvados_cwl/arvcontainer.py", line 70, in run
    rf.sort(key=lambda k: k.resolved)
  File "/home/peter/work/scripts/venv/lib/python2.7/site-packages/future/types/newstr.py", line 306, in __lt__
    raise TypeError(self.unorderable_err.format(type(other)))
TypeError: unorderable types: str() and <type 'str'>

I added logging to print out the types that were being compared (the string contents are all keep references):

[<type 'str'>,
 <class 'future.types.newstr.newstr'>,
 <type 'str'>,
 <type 'str'>,
 <type 'unicode'>,
 <type 'str'>,
 <type 'str'>]

So the problem is that str is comparable to unicode, unicode is comparable to newstr, but newstr is not comparable to str.

Tentatively it looks like KeepLocator.__str__ might be where the newstr is coming from, but I haven't established that definitively.

It seems that KeepLocator.__str__ or something similar previously used to return str and is now returning newstr.

Associated revisions

Revision 93e4548d
Added by Tom Clegg 4 months ago

Merge branch '11681-str-newstr'

refs #11681

Revision 75953fd3
Added by Peter Amstutz 4 months ago

Merge branch '11681-str-newstr' refs #11681

History

#1 Updated by Peter Amstutz 4 months ago

  • Description updated (diff)

#2 Updated by Peter Amstutz 4 months ago

Possible solutions:

  • Fix the SDK to be consistent with old behavior on Python 2
  • Fix arvados-cwl-runner to coerce everything to unicode
  • ???

#3 Updated by Peter Amstutz 4 months ago

On further examination, it looks like Collection.portable_data_hash() is the most likely culprit.

#5 Updated by Peter Amstutz 4 months ago

This is the right line of thinking, except... 11681-str-newstr commit:9cd1bd27bada41cd13fb9813144fe694a67c2d00 update @CollectionWriter.portable_data_hash() and not Collection.portable_data_hash() which is what the arvados-cwl-runner code is using.

#6 Updated by Peter Amstutz 4 months ago

  • Status changed from New to Resolved

Also available in: Atom PDF