Skip to content

Commit ab7bcfd

Browse files
committed
feat: add spark history server api
1. Add api methods for managing spark history server. 2. Add submission_time and auto_termination_time fields in spark application list and details responses. BREAKING: The type of timestamp fields in Application response models has been changed to `datetime`. Fields in Application and ApplicationGetResponse objects like start_time, end_time, finish_time will now have values of type `datetime` instead of plain strings. Signed-off-by: Subin Shekhar <[email protected]>
1 parent 648664d commit ab7bcfd

File tree

4 files changed

+748
-95
lines changed

4 files changed

+748
-95
lines changed

examples/test_ibm_analytics_engine_api_v3_examples.py

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ def test_set_instance_home_example(self):
126126

127127
instance_home_response = ibm_analytics_engine_api_service.set_instance_home(
128128
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
129+
new_hmac_access_key='b9****************************4b',
130+
new_hmac_secret_key='fa********************************************8a'
129131
).get_result()
130132

131133
print(json.dumps(instance_home_response, indent=2))
@@ -258,7 +260,7 @@ def test_create_application_example(self):
258260
arguments=['/opt/ibm/spark/examples/src/main/resources/people.txt'],
259261
runtime={
260262
'spark_version': '3.3'
261-
}
263+
}
262264
)
263265
application_response = ibm_analytics_engine_api_service.create_application(
264266
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
@@ -455,6 +457,64 @@ def test_get_logging_configuration_example(self):
455457
except ApiException as e:
456458
pytest.fail(str(e))
457459

460+
@needscredentials
461+
def test_start_spark_history_server_example(self):
462+
"""
463+
start_spark_history_server request example
464+
"""
465+
try:
466+
print('\nstart_spark_history_server() result:')
467+
# begin-start_spark_history_server
468+
469+
spark_history_server_response = ibm_analytics_engine_api_service.start_spark_history_server(
470+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
471+
).get_result()
472+
473+
print(json.dumps(spark_history_server_response, indent=2))
474+
475+
# end-start_spark_history_server
476+
477+
except ApiException as e:
478+
pytest.fail(str(e))
479+
480+
@needscredentials
481+
def test_get_spark_history_server_example(self):
482+
"""
483+
get_spark_history_server request example
484+
"""
485+
try:
486+
print('\nget_spark_history_server() result:')
487+
# begin-get_spark_history_server
488+
489+
spark_history_server_response = ibm_analytics_engine_api_service.get_spark_history_server(
490+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
491+
).get_result()
492+
493+
print(json.dumps(spark_history_server_response, indent=2))
494+
495+
# end-get_spark_history_server
496+
497+
except ApiException as e:
498+
pytest.fail(str(e))
499+
500+
@needscredentials
501+
def test_stop_spark_history_server_example(self):
502+
"""
503+
stop_spark_history_server request example
504+
"""
505+
try:
506+
# begin-stop_spark_history_server
507+
508+
response = ibm_analytics_engine_api_service.stop_spark_history_server(
509+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
510+
)
511+
512+
# end-stop_spark_history_server
513+
print('\nstop_spark_history_server() response status code: ', response.get_status_code())
514+
515+
except ApiException as e:
516+
pytest.fail(str(e))
517+
458518
@needscredentials
459519
def test_delete_application_example(self):
460520
"""

0 commit comments

Comments
 (0)