Project

General

Profile

Actions

Bug #11681

closed

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

Added by Peter Amstutz over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Story points:
-

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.

Actions #1

Updated by Peter Amstutz over 7 years ago

  • Description updated (diff)
Actions #2

Updated by Peter Amstutz over 7 years ago

Possible solutions:

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

Updated by Peter Amstutz over 7 years ago

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

Actions #5

Updated by Peter Amstutz over 7 years 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.

Actions #6

Updated by Peter Amstutz over 7 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF