Skip to content

exclude_archived param added to batches retrieval #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 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 @@ -775,6 +783,7 @@ def get_batches(
"end_time": created_before,
"project": project_name,
"offset": offset,
"exclude_archived": exclude_archived,
}

if batch_status:
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"