Skip to content

Commit

Permalink
rename to max_chunk_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlKCarlK committed Jan 29, 2024
1 parent a3cc68d commit 0dd4e4d
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 140 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.0.1] - 2024-4-16

cmk
- Add support for cloud files to both Rust and Python.

## [1.0.0] - 2023-11-5

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ crate-type = ["cdylib", "rlib"]
[features]
extension-module = ["pyo3/extension-module", "pyo3-asyncio", "cloud"]
cloud = [
"cloud-file", # cmk does this imply object_store?
"cloud-file",
"object_store",
"pyo3-asyncio",
"tokio/full",
Expand Down
34 changes: 17 additions & 17 deletions bed_reader/_open_bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ def get_max_concurrent_requests(max_concurrent_requests=None):
return 10


def get_max_chunk_size(max_chunk_size=None):
if max_chunk_size is not None:
return max_chunk_size
def get_max_chunk_bytes(max_chunk_bytes=None):
if max_chunk_bytes is not None:
return max_chunk_bytes
return 8_000_000


Expand Down Expand Up @@ -162,7 +162,7 @@ class open_bed:
max_concurrent_requests: None or int, optional
The maximum number of concurrent requests to make to the cloud storage service.
Defaults to 10.
max_chunk_size: None or int, optional
max_chunk_bytes: None or int, optional
The maximum number of bytes to read in a single request to the cloud storage
service. Defaults to 8MB.
filepath: same as location
Expand Down Expand Up @@ -259,7 +259,7 @@ def __init__(
bim_location: Union[str, Path, UrlParseResult] = None,
cloud_options: Mapping[str, str] = {},
max_concurrent_requests: Optional[int] = None,
max_chunk_size: Optional[int] = None,
max_chunk_bytes: Optional[int] = None,
# accept old keywords
filepath: Union[str, Path] = None,
fam_filepath: Union[str, Path] = None,
Expand All @@ -278,7 +278,7 @@ def __init__(
self.count_A1 = count_A1
self._num_threads = num_threads
self._max_concurrent_requests = max_concurrent_requests
self._max_chunk_size = max_chunk_size
self._max_chunk_bytes = max_chunk_bytes
self.skip_format_check = skip_format_check
self._fam_location = (
self._path_or_url(fam_location)
Expand Down Expand Up @@ -362,7 +362,7 @@ def read(
force_python_only: Optional[bool] = False,
num_threads=None,
max_concurrent_requests=None,
max_chunk_size=None,
max_chunk_bytes=None,
) -> np.ndarray:
"""
Read genotype information.
Expand Down Expand Up @@ -398,7 +398,7 @@ def read(
The maximum number of concurrent requests to make to the cloud storage
service. Defaults to 10.
max_chunk_size: None or int, optional
max_chunk_bytes: None or int, optional
The maximum number of bytes to read in a single request to the cloud
storage service. Defaults to 8MB.
Expand Down Expand Up @@ -510,8 +510,8 @@ def read(
if max_concurrent_requests is None
else max_concurrent_requests
)
max_chunk_size = get_max_chunk_size(
self._max_chunk_size if max_chunk_size is None else max_chunk_size
max_chunk_bytes = get_max_chunk_bytes(
self._max_chunk_bytes if max_chunk_bytes is None else max_chunk_bytes
)

val = np.zeros((len(iid_index), len(sid_index)), order=order, dtype=dtype)
Expand Down Expand Up @@ -545,7 +545,7 @@ def read(
val=val,
num_threads=num_threads,
max_concurrent_requests=max_concurrent_requests,
max_chunk_size=max_chunk_size,
max_chunk_bytes=max_chunk_bytes,
)

else:
Expand Down Expand Up @@ -1390,7 +1390,7 @@ def read_sparse(
format: Optional[str] = "csc",
num_threads=None,
max_concurrent_requests=None,
max_chunk_size=None,
max_chunk_bytes=None,
) -> (Union[sparse.csc_matrix, sparse.csr_matrix]) if sparse is not None else None:
"""
Read genotype information into a :mod:`scipy.sparse` matrix. Sparse matrices
Expand Down Expand Up @@ -1431,7 +1431,7 @@ def read_sparse(
max_concurrent_requests: None or int, optional
The maximum number of concurrent requests to make to the cloud storage
service. Defaults to 10.
max_chunk_size: None or int, optional
max_chunk_bytes: None or int, optional
The maximum number of bytes to read in a single request to the cloud
storage service. Defaults to 8MB.
Expand Down Expand Up @@ -1587,8 +1587,8 @@ def read_sparse(
if max_concurrent_requests is None
else max_concurrent_requests
)
max_chunk_size = get_max_chunk_size(
self._max_chunk_size if max_chunk_size is None else max_chunk_size
max_chunk_bytes = get_max_chunk_bytes(
self._max_chunk_bytes if max_chunk_bytes is None else max_chunk_bytes
)

if format == "csc":
Expand Down Expand Up @@ -1648,7 +1648,7 @@ def read_sparse(
val=val,
num_threads=num_threads,
max_concurrent_requests=max_concurrent_requests,
max_chunk_size=max_chunk_size,
max_chunk_bytes=max_chunk_bytes,
)

self.sparsify(
Expand Down Expand Up @@ -1697,7 +1697,7 @@ def read_sparse(
val=val,
num_threads=num_threads,
max_concurrent_requests=max_concurrent_requests,
max_chunk_size=max_chunk_size,
max_chunk_bytes=max_chunk_bytes,
)

self.sparsify(
Expand Down
Loading

0 comments on commit 0dd4e4d

Please sign in to comment.