Skip to content

Commit e8f86ae

Browse files
amitsrivastavaPhilip Langdale
authored and
Philip Langdale
committed
[api] OPSAPS-23455 add option to associated case, upload yarn application support bundle to Cloudera
Added a new function create_yarn_application_diagnostics_bundle to yarn service. The new function adds the support for new arguments ticketNumber and comments. The signature of the function create_yarn_application_diagnostics_bundle is not compatible with the existing function collect_yarn_application_diagnostics and that is why, I added a new function and marked the older one as deprecated.
1 parent ecc7e61 commit e8f86ae

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

python/src/cm_api/endpoints/services.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,16 +468,36 @@ def create_yarn_node_manager_remote_app_log_dir(self):
468468

469469
def collect_yarn_application_diagnostics(self, *application_ids):
470470
"""
471+
DEPRECATED: use create_yarn_application_diagnostics_bundle on the Yarn service. Deprecated since v10.
472+
471473
Collects the Diagnostics data for Yarn applications.
472474
473-
@param application_ids: An array of strings containing the id's of the
475+
@param application_ids: An array of strings containing the ids of the
474476
yarn applications.
475477
@return: Reference to the submitted command.
476478
@since: API v8
477479
"""
478480
args = dict(applicationIds = application_ids)
479481
return self._cmd('yarnApplicationDiagnosticsCollection', api_version=8, data=args)
480482

483+
def create_yarn_application_diagnostics_bundle(self, application_ids, ticket_number=None, comments=None):
484+
"""
485+
Collects the Diagnostics data for Yarn applications.
486+
487+
@param application_ids: An array of strings containing the ids of the
488+
yarn applications.
489+
@param ticket_number: If applicable, the support ticket number of the issue
490+
being experienced on the cluster.
491+
@param comments: Additional comments
492+
@return: Reference to the submitted command.
493+
@since: API v10
494+
"""
495+
args = dict(applicationIds = application_ids,
496+
ticketNumber = ticket_number,
497+
comments = comments)
498+
499+
return self._cmd('yarnApplicationDiagnosticsCollection', api_version=10, data=args)
500+
481501
def get_config(self, view = None):
482502
"""
483503
Retrieve the service's configuration.

python/src/cm_api_tests/test_yarn.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ def test_collect_yarn_application_diagnostics(self):
7171
resp = service.collect_yarn_application_diagnostics('randomId-1', 'randomId-2', 'randomId-3')
7272

7373
self.assertEquals('YarnApplicationDiagnosticsCollection', resp.name)
74+
75+
def test_create_yarn_application_diagnostics_bundle(self):
76+
resource = utils.MockResource(self)
77+
service = ApiService(resource, name="bar")
78+
79+
resource.expect("POST", "/cm/service/commands/yarnApplicationDiagnosticsCollection",
80+
retdata={ 'name' : 'YarnApplicationDiagnosticsCollection' })
81+
resp = service.create_yarn_application_diagnostics_bundle(['randomId-1', 'randomId-2', 'randomId-3'], 'test_ticket', 'test comment')
82+
83+
self.assertEquals('YarnApplicationDiagnosticsCollection', resp.name)

0 commit comments

Comments
 (0)