Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
rev: 20.8b1
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.8.4
hooks:
- id: flake8
Expand Down
11 changes: 11 additions & 0 deletions scaleapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@ def batches(self, **kwargs) -> Batchlist:
The maximum value of `created_at` in UTC timezone
ISO format: 'YYYY-MM-DD HH:MM:SS.mmmmmm'

exclude_archived (bool):
A flag to exclude archived batches if True

status (str):
Status to filter batches by

Expand All @@ -710,6 +713,7 @@ def batches(self, **kwargs) -> Batchlist:
allowed_kwargs = {
"start_time",
"end_time",
"exclude_archived",
"status",
"project",
"limit",
Expand Down Expand Up @@ -739,6 +743,7 @@ def get_batches(
batch_status: BatchStatus = None,
created_after: str = None,
created_before: str = None,
exclude_archived: bool = False,
) -> Generator[Batch, None, None]:
"""`Generator` method to yield all batches with the given
parameters.
Expand All @@ -761,6 +766,9 @@ def get_batches(
The maximum value of `created_at` in UTC timezone
ISO format: 'YYYY-MM-DD HH:MM:SS.mmmmmm'

exclude_archived (bool):
A flag to exclude archived batches if True

Yields:
Generator[Batch]:
Yields Batch, can be iterated.
Expand All @@ -777,6 +785,9 @@ def get_batches(
"offset": offset,
}

if exclude_archived:
batches_args["exclude_archived"] = True

if batch_status:
batches_args["status"] = batch_status.value

Expand Down
2 changes: 1 addition & 1 deletion scaleapi/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "2.14.1"
__version__ = "2.14.2"
__package_name__ = "scaleapi"