Skip to content

Commit a9c4e99

Browse files
committed
return to old sort order
1 parent 4f9e624 commit a9c4e99

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

irods/data_object.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,20 @@ def __repr__(self):
4646
_REFERENCE_DATETIME = datetime.datetime(1970, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc)
4747

4848

49-
def _DEFAULT_SORT_KEY_FN(row):
49+
def _REPLICA_NUMBER_SORT_KEY_FN(row):
50+
return row[DataObject.replica_number]
51+
52+
def _REPLICA_FITNESS_SORT_KEY_FN(row):
5053
repl_status = int(row[DataObject.replica_status])
5154

5255
repl_status_rank = _REPL_STATUSES.index(repl_status) if _REPL_STATUSES.count(repl_status) else sys.maxsize
5356

5457
return (repl_status_rank, _REFERENCE_DATETIME - row[DataObject.modify_time])
5558

5659

60+
_DEFAULT_SORT_KEY_FN = _REPLICA_NUMBER_SORT_KEY_FN
61+
62+
5763
class iRODSDataObject:
5864
def __init__(self, manager, parent=None, results=None, replica_sort_function=None):
5965
self.manager = manager

irods/test/data_obj_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2989,7 +2989,8 @@ def test_handling_of_termination_signals_during_multithread_put__issue_722(self)
29892989

29902990
test_put__issue_722(self)
29912991

2992-
def test_default_sorting_of_replicas__issue_647(self):
2992+
@unittest.skipIf(irods.version.version_as_tuple() < (4,), 'too soon for this test.')
2993+
def test_modified_default_sorting_of_replicas__issue_647(self):
29932994
basename = unique_name(my_function_name(), datetime.now()) + '_dataobj_647'
29942995
with self.create_simple_resc() as newResc1, self.create_simple_resc() as newResc2:
29952996
data = helpers.make_object(self.sess, f'{helpers.home_collection(self.sess)}/{basename}')

0 commit comments

Comments
 (0)