Skip to content

Commit 522d541

Browse files
authored
fix(analytics engine): fixed Spark application submit path and payload (#6)
fix(analytics engine): fixed Spark application submit path and payload
1 parent b1072d2 commit 522d541

File tree

4 files changed

+629
-560
lines changed

4 files changed

+629
-560
lines changed

examples/test_ibm_analytics_engine_api_v3_examples.py

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,21 @@ def setup_class(cls):
7676
)
7777

7878
@needscredentials
79-
def test_get_instance_by_id_example(self):
79+
def test_get_instance_example(self):
8080
"""
81-
get_instance_by_id request example
81+
get_instance request example
8282
"""
8383
try:
84-
print('\nget_instance_by_id() result:')
85-
# begin-get_instance_by_id
84+
print('\nget_instance() result:')
85+
# begin-get_instance
8686

87-
instance_details = ibm_analytics_engine_api_service.get_instance_by_id(
88-
instance_id='testString'
87+
instance = ibm_analytics_engine_api_service.get_instance(
88+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
8989
).get_result()
9090

91-
print(json.dumps(instance_details, indent=2))
91+
print(json.dumps(instance, indent=2))
9292

93-
# end-get_instance_by_id
93+
# end-get_instance
9494

9595
except ApiException as e:
9696
pytest.fail(str(e))
@@ -104,8 +104,14 @@ def test_create_application_example(self):
104104
print('\ncreate_application() result:')
105105
# begin-create_application
106106

107+
application_request_application_details_model = {
108+
'application': '/opt/ibm/spark/examples/src/main/python/wordcount.py',
109+
'arguments': ['/opt/ibm/spark/examples/src/main/resources/people.txt']
110+
}
111+
107112
application_response = ibm_analytics_engine_api_service.create_application(
108-
instance_id='testString',
113+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
114+
application_details = application_request_application_details_model,
109115
).get_result()
110116

111117
print(json.dumps(application_response, indent=2))
@@ -116,42 +122,42 @@ def test_create_application_example(self):
116122
pytest.fail(str(e))
117123

118124
@needscredentials
119-
def test_get_applications_example(self):
125+
def test_list_applications_example(self):
120126
"""
121-
get_applications request example
127+
list_applications request example
122128
"""
123129
try:
124-
print('\nget_applications() result:')
125-
# begin-get_applications
130+
print('\nlist_applications() result:')
131+
# begin-list_applications
126132

127-
application_collection = ibm_analytics_engine_api_service.get_applications(
128-
instance_id='testString'
133+
application_collection = ibm_analytics_engine_api_service.list_applications(
134+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09'
129135
).get_result()
130136

131137
print(json.dumps(application_collection, indent=2))
132138

133-
# end-get_applications
139+
# end-list_applications
134140

135141
except ApiException as e:
136142
pytest.fail(str(e))
137143

138144
@needscredentials
139-
def test_get_application_by_id_example(self):
145+
def test_get_application_example(self):
140146
"""
141-
get_application_by_id request example
147+
get_application request example
142148
"""
143149
try:
144-
print('\nget_application_by_id() result:')
145-
# begin-get_application_by_id
150+
print('\nget_application() result:')
151+
# begin-get_application
146152

147-
application_get_response = ibm_analytics_engine_api_service.get_application_by_id(
148-
instance_id='testString',
149-
application_id='testString'
153+
application_get_response = ibm_analytics_engine_api_service.get_application(
154+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
155+
application_id='ff48cc19-0e7e-4627-aac6-0b4ad080397b'
150156
).get_result()
151157

152158
print(json.dumps(application_get_response, indent=2))
153159

154-
# end-get_application_by_id
160+
# end-get_application
155161

156162
except ApiException as e:
157163
pytest.fail(str(e))
@@ -166,8 +172,8 @@ def test_get_application_state_example(self):
166172
# begin-get_application_state
167173

168174
application_get_state_response = ibm_analytics_engine_api_service.get_application_state(
169-
instance_id='testString',
170-
application_id='testString'
175+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
176+
application_id='ff48cc19-0e7e-4627-aac6-0b4ad080397b'
171177
).get_result()
172178

173179
print(json.dumps(application_get_state_response, indent=2))
@@ -178,20 +184,20 @@ def test_get_application_state_example(self):
178184
pytest.fail(str(e))
179185

180186
@needscredentials
181-
def test_delete_application_by_id_example(self):
187+
def test_delete_application_example(self):
182188
"""
183-
delete_application_by_id request example
189+
delete_application request example
184190
"""
185191
try:
186-
# begin-delete_application_by_id
192+
# begin-delete_application
187193

188-
response = ibm_analytics_engine_api_service.delete_application_by_id(
189-
instance_id='testString',
190-
application_id='testString'
194+
response = ibm_analytics_engine_api_service.delete_application(
195+
instance_id='e64c907a-e82f-46fd-addc-ccfafbd28b09',
196+
application_id='ff48cc19-0e7e-4627-aac6-0b4ad080397b'
191197
)
192198

193-
# end-delete_application_by_id
194-
print('\ndelete_application_by_id() response status code: ', response.get_status_code())
199+
# end-delete_application
200+
print('\ndelete_application() response status code: ', response.get_status_code())
195201

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

0 commit comments

Comments
 (0)