Skip to content

Commit 9f51067

Browse files
authored
Merge pull request #22 from Akhil-J/akhil-4734-expose-application-list-filters
feat: add support for time based application list filters
2 parents a2aa4db + 378b7a6 commit 9f51067

File tree

4 files changed

+121
-37
lines changed

4 files changed

+121
-37
lines changed

examples/test_ibm_analytics_engine_api_v3_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def test_replace_instance_default_runtime_example(self):
265265

266266
response = ibm_analytics_engine_api_service.replace_instance_default_runtime(
267267
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
268-
spark_version="3.3",
268+
spark_version='3.4',
269269
)
270270
runtime = response.get_result()
271271

@@ -286,7 +286,7 @@ def test_create_application_example(self):
286286
# begin-create_application
287287

288288
runtime_model = {
289-
'spark_version': '3.3',
289+
'spark_version': '3.4',
290290
}
291291

292292
application_request_application_details_model = {

iaesdk/ibm_analytics_engine_api_v3.py

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,16 @@ def create_application(
552552
return response
553553

554554
def list_applications(
555-
self, instance_id: str, *, state: List[str] = None, limit: int = None, start: str = None, **kwargs
555+
self,
556+
instance_id: str,
557+
*,
558+
state: List[str] = None,
559+
start_time_interval: str = None,
560+
submission_time_interval: str = None,
561+
end_time_interval: str = None,
562+
limit: int = None,
563+
start: str = None,
564+
**kwargs,
556565
) -> DetailedResponse:
557566
"""
558567
List all Spark applications.
@@ -564,6 +573,27 @@ def list_applications(
564573
associated with the Spark application(s).
565574
:param List[str] state: (optional) List of Spark application states that
566575
will be used to filter the response.
576+
:param str start_time_interval: (optional) Time interval to use for
577+
filtering applications by their start time. Interval is specified in the
578+
format `<lower timestamp limit>,<upper timestamp limit>`. Each timestamp
579+
value must be ISO 8601 compliant. You may also use keywords `BEGINNING` as
580+
a placeholder value for lower timestamp limit and `CURRENT` as a
581+
placeholder value for upper timestamp limit. Note: The lower timestamp
582+
limit is inclusive, whereas the upper timestamp limit is exclusive.
583+
:param str submission_time_interval: (optional) Time interval to use for
584+
filtering applications by their submission time. Interval is specified in
585+
the format `<lower timestamp limit>,<upper timestamp limit>`. Each
586+
timestamp value must be ISO 8601 compliant. You may also use keywords
587+
`BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT`
588+
as a placeholder value for upper timestamp limit. Note: The lower timestamp
589+
limit is inclusive, whereas the upper timestamp limit is exclusive.
590+
:param str end_time_interval: (optional) Time interval to use for filtering
591+
applications by their end time. Interval is specified in the format `<lower
592+
timestamp limit>,<upper timestamp limit>`. Each timestamp value must be ISO
593+
8601 compliant. You may also use keywords `BEGINNING` as a placeholder
594+
value for lower timestamp limit and `CURRENT` as a placeholder value for
595+
upper timestamp limit. Note: The lower timestamp limit is inclusive,
596+
whereas the upper timestamp limit is exclusive.
567597
:param int limit: (optional) Number of application entries to be included
568598
in the response.
569599
:param str start: (optional) Token used to fetch the next or the previous
@@ -583,6 +613,9 @@ def list_applications(
583613

584614
params = {
585615
'state': convert_list(state),
616+
'start_time_interval': start_time_interval,
617+
'submission_time_interval': submission_time_interval,
618+
'end_time_interval': end_time_interval,
586619
'limit': limit,
587620
'start': start,
588621
}
@@ -3351,6 +3384,9 @@ def __init__(
33513384
client: IbmAnalyticsEngineApiV3,
33523385
instance_id: str,
33533386
state: List[str] = None,
3387+
start_time_interval: str = None,
3388+
submission_time_interval: str = None,
3389+
end_time_interval: str = None,
33543390
limit: int = None,
33553391
) -> None:
33563392
"""
@@ -3359,6 +3395,27 @@ def __init__(
33593395
associated with the Spark application(s).
33603396
:param List[str] state: (optional) List of Spark application states that
33613397
will be used to filter the response.
3398+
:param str start_time_interval: (optional) Time interval to use for
3399+
filtering applications by their start time. Interval is specified in the
3400+
format `<lower timestamp limit>,<upper timestamp limit>`. Each timestamp
3401+
value must be ISO 8601 compliant. You may also use keywords `BEGINNING` as
3402+
a placeholder value for lower timestamp limit and `CURRENT` as a
3403+
placeholder value for upper timestamp limit. Note: The lower timestamp
3404+
limit is inclusive, whereas the upper timestamp limit is exclusive.
3405+
:param str submission_time_interval: (optional) Time interval to use for
3406+
filtering applications by their submission time. Interval is specified in
3407+
the format `<lower timestamp limit>,<upper timestamp limit>`. Each
3408+
timestamp value must be ISO 8601 compliant. You may also use keywords
3409+
`BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT`
3410+
as a placeholder value for upper timestamp limit. Note: The lower timestamp
3411+
limit is inclusive, whereas the upper timestamp limit is exclusive.
3412+
:param str end_time_interval: (optional) Time interval to use for filtering
3413+
applications by their end time. Interval is specified in the format `<lower
3414+
timestamp limit>,<upper timestamp limit>`. Each timestamp value must be ISO
3415+
8601 compliant. You may also use keywords `BEGINNING` as a placeholder
3416+
value for lower timestamp limit and `CURRENT` as a placeholder value for
3417+
upper timestamp limit. Note: The lower timestamp limit is inclusive,
3418+
whereas the upper timestamp limit is exclusive.
33623419
:param int limit: (optional) Number of application entries to be included
33633420
in the response.
33643421
"""
@@ -3367,6 +3424,9 @@ def __init__(
33673424
self._page_context = {'next': None}
33683425
self._instance_id = instance_id
33693426
self._state = state
3427+
self._start_time_interval = start_time_interval
3428+
self._submission_time_interval = submission_time_interval
3429+
self._end_time_interval = end_time_interval
33703430
self._limit = limit
33713431

33723432
def has_next(self) -> bool:
@@ -3387,6 +3447,9 @@ def get_next(self) -> List[dict]:
33873447
result = self._client.list_applications(
33883448
instance_id=self._instance_id,
33893449
state=self._state,
3450+
start_time_interval=self._start_time_interval,
3451+
submission_time_interval=self._submission_time_interval,
3452+
end_time_interval=self._end_time_interval,
33903453
limit=self._limit,
33913454
start=self._page_context.get('next'),
33923455
).get_result()

test/integration/test_ibm_analytics_engine_api_v3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_get_instance_default_runtime(self):
159159
def test_replace_instance_default_runtime(self):
160160
response = self.ibm_analytics_engine_api_service.replace_instance_default_runtime(
161161
instance_id=self.instance_id,
162-
spark_version='3.3',
162+
spark_version='3.4',
163163
)
164164

165165
assert response.get_status_code() == 200
@@ -278,8 +278,8 @@ def test_replace_log_forwarding_config(self):
278278
response = self.ibm_analytics_engine_api_service.replace_log_forwarding_config(
279279
instance_id=self.instance_id,
280280
enabled=True,
281-
sources=["spark-driver", "spark-executor"],
282-
tags=["<tag_1>", "<tag_2>", "<tag_n>"],
281+
sources=['spark-driver', 'spark-executor'],
282+
tags=['<tag_1>', '<tag_2>', '<tag_n'],
283283
)
284284

285285
assert response.get_status_code() == 200

0 commit comments

Comments
 (0)