Skip to content

Commit ac520e1

Browse files
committed
[_SQ] document sort key fns
1 parent dda5dc0 commit ac520e1

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

irods/manager/data_object_manager.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from irods.models import DataObject, Collection
1010
from irods.manager import Manager
1111
from irods.manager._internal import _api_impl, _logical_path
12+
1213
from irods.message import (
1314
iRODSMessage,
1415
FileOpenRequest,
@@ -30,6 +31,8 @@
3031
chunks,
3132
irods_dirname,
3233
irods_basename,
34+
REPLICA_NUMBER_SORT_KEY_FN,
35+
REPLICA_FITNESS_SORT_KEY_FN,
3336
)
3437
import irods.client_configuration as client_config
3538
import irods.keywords as kw
@@ -258,17 +261,26 @@ def _download(self, obj_path, local_path, num_threads, updatables=(), **options)
258261
f.write(chunk)
259262
do_progress_updates(updatables, len(chunk))
260263

261-
def get(self, path, local_path=None, num_threads=DEFAULT_NUMBER_OF_THREADS, updatables=(), **options):
264+
def get(self,
265+
path,
266+
local_path=None,
267+
num_threads=DEFAULT_NUMBER_OF_THREADS,
268+
updatables=(),
269+
replica_sort_function = None,
270+
**options):
262271
"""
263272
Get a reference to the data object at the specified `path'.
264273
265274
Only download the object if the local_path is a string (specifying
266275
a path in the local filesystem to use as a destination file).
276+
277+
If replica_sort_function is not specified, the replicas list contained in the returned
278+
object will be sorted according to replica number (REPLICA_NUMBER_SORT_KEY_FN) in PRC < v4
279+
or by general fitness to be considered as a current data copy (REPLICA_FITNESS_SORT_KEY_FN).
280+
in PRC >= v4. For those definitions, see irods/data_object.py .
267281
"""
268282
parent = self.sess.collections.get(irods_dirname(path))
269283

270-
replica_sort_function = options.pop('replica_sort_function', None)
271-
272284
# TODO: optimize
273285
if local_path:
274286
self._download(path, local_path, num_threads=num_threads, updatables=updatables, **options)

0 commit comments

Comments
 (0)