Skip to content

Commit

Permalink
feat: add spark history server api
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
subinpc committed Jan 1, 2023
1 parent 648664d commit ab7bcfd
Show file tree
Hide file tree
Showing 4 changed files with 748 additions and 95 deletions.
62 changes: 61 additions & 1 deletion examples/test_ibm_analytics_engine_api_v3_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def test_set_instance_home_example(self):

instance_home_response = ibm_analytics_engine_api_service.set_instance_home(
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
new_hmac_access_key='b9****************************4b',
new_hmac_secret_key='fa********************************************8a'
).get_result()

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

@needscredentials
def test_start_spark_history_server_example(self):
"""
start_spark_history_server request example
"""
try:
print('\nstart_spark_history_server() result:')
# begin-start_spark_history_server

spark_history_server_response = ibm_analytics_engine_api_service.start_spark_history_server(
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
).get_result()

print(json.dumps(spark_history_server_response, indent=2))

# end-start_spark_history_server

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_get_spark_history_server_example(self):
"""
get_spark_history_server request example
"""
try:
print('\nget_spark_history_server() result:')
# begin-get_spark_history_server

spark_history_server_response = ibm_analytics_engine_api_service.get_spark_history_server(
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
).get_result()

print(json.dumps(spark_history_server_response, indent=2))

# end-get_spark_history_server

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_stop_spark_history_server_example(self):
"""
stop_spark_history_server request example
"""
try:
# begin-stop_spark_history_server

response = ibm_analytics_engine_api_service.stop_spark_history_server(
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
)

# end-stop_spark_history_server
print('\nstop_spark_history_server() response status code: ', response.get_status_code())

except ApiException as e:
pytest.fail(str(e))

@needscredentials
def test_delete_application_example(self):
"""
Expand Down
Loading

0 comments on commit ab7bcfd

Please sign in to comment.