def get(self, path, local_path = None, num_threads = DEFAULT_NUMBER_OF_THREADS, **options): """ Get a reference to the data object at the specified `path'. Only download the object if the local_path is a string (specifying a path in the local filesystem to use as a destination file). """ parent = self.sess.collections.get(irods_dirname(path)) # TODO: optimize if local_path: self._download(path, local_path, num_threads = num_threads, **options) query = self.sess.query(DataObject)\ .filter(DataObject.name == irods_basename(path))\ .filter(DataObject.collection_id == parent.id)\ .add_keyword(kw.ZONE_KW, path.split('/')[1]) if hasattr(self.sess,'ticket__'): query = query.filter(Collection.id != 0) # a no-op, but necessary because CAT_SQL_ERR results if the ticket # is for a DataObject and we don't explicitly join to Collection results = query.all() # get up to max_rows replicas if len(results) <= 0: raise ex.DataObjectDoesNotExist() return iRODSDataObject(self, parent, results)
def get(self, path, file=None, **options): parent = self.sess.collections.get(irods_dirname(path)) # TODO: optimize if file: self._download(path, file, **options) query = self.sess.query(DataObject)\ .filter(DataObject.name == irods_basename(path))\ .filter(DataObject.collection_id == parent.id) results = query.all() # get up to max_rows replicas if len(results) <= 0: raise ex.DataObjectDoesNotExist() return iRODSDataObject(self, parent, results)
def get(self, path, file=None, **options): parent = self.sess.collections.get(irods_dirname(path)) # TODO: optimize if file: self._download(path, file, **options) query = self.sess.query(DataObject)\ .filter(DataObject.name == irods_basename(path))\ .filter(DataObject.collection_id == parent.id)\ .add_keyword(kw.ZONE_KW, path.split('/')[1]) results = query.all() # get up to max_rows replicas if len(results) <= 0: raise ex.DataObjectDoesNotExist() # workaround incompatibility of irodsclient-0.8.2 and iRODS server 3.x for r in results: if DataObject.resc_hier not in r: r[DataObject.resc_hier] = None return iRODSDataObject(self, parent, results)
def get(self, path, local_path=None, num_threads=DEFAULT_NUMBER_OF_THREADS, **options): parent = self.sess.collections.get(irods_dirname(path)) # TODO: optimize if local_path: self._download(path, local_path, num_threads=num_threads, **options) query = self.sess.query(DataObject)\ .filter(DataObject.name == irods_basename(path))\ .filter(DataObject.collection_id == parent.id)\ .add_keyword(kw.ZONE_KW, path.split('/')[1]) results = query.all() # get up to max_rows replicas if len(results) <= 0: raise ex.DataObjectDoesNotExist() return iRODSDataObject(self, parent, results)