All URIs are relative to /api/v58
| Method | HTTP request | Description |
|---|---|---|
| abort_command | POST /commands/{commandId}/abort | |
| find_command_by_correlation_id | GET /commands/commandByCorrelationId/{correlationId} | |
| get_command_result_data | GET /commands/{commandId}/download | Download the end result of a command. |
| get_command_with_steps | GET /commands/{commandId}/steps | |
| get_standard_error | GET /commands/{commandId}/logs/stderr | |
| get_standard_output | GET /commands/{commandId}/logs/stdout | |
| read_command | GET /commands/{commandId} | |
| read_commands | GET /commands/commands | |
| replication_report | GET /commands/{commandId}/replicationReport | |
| retry | POST /commands/{commandId}/retry |
ApiCommand abort_command(command_id)
Abort a running command.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | The command id.
try:
api_response = api_instance.abort_command(command_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->abort_command: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | The command id. |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiCommand find_command_by_correlation_id(correlation_id, start_time=start_time)
Retrieve command by the correlation ID that was provided at command creation. Used to recover command references when the command ID is not available.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
correlation_id = 'correlation_id_example' # str | Correlation ID provided at command creation
start_time = 789 # int | Timestamp from which the command was started (optional)
try:
api_response = api_instance.find_command_by_correlation_id(correlation_id, start_time=start_time)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->find_command_by_correlation_id: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| correlation_id | str | Correlation ID provided at command creation | |
| start_time | int | Timestamp from which the command was started | [optional] |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
str get_command_result_data(command_id)
Download the end result of a command.
Download the end result of a command. Content-Type header is explicitly set in the implementation instead of using annotation. In case the MIME type is not set for the command result, application/octet-stream is set.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | The command id.
try:
# Download the end result of a command.
api_response = api_instance.get_command_result_data(command_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->get_command_result_data: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | The command id. |
str
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiCommandWithSteps get_command_with_steps(command_id)
Retrieve detailed information of an asynchronous command including the command steps.
Cloudera Manager keeps the results and statuses of asynchronous commands, which have non-negative command IDs. On the other hand, synchronous commands complete immediately, and their results are passed back in the return object of the command execution API call. Outside of that return object, there is no way to check the result of a synchronous command.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | The command id.
try:
api_response = api_instance.get_command_with_steps(command_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->get_command_with_steps: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | The command id. |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
str get_standard_error(command_id)
Download a zip-compressed archive of standard error outputs for the command's one-off processes. Log files are returned zipped together.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | The command id.
try:
api_response = api_instance.get_standard_error(command_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->get_standard_error: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | The command id. |
str
[Back to top] [Back to API list] [Back to Model list] [Back to README]
str get_standard_output(command_id)
Download a zip-compressed archive of standard outputs for the command's one-off processes. Log files are returned zipped together.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | The command id.
try:
api_response = api_instance.get_standard_output(command_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->get_standard_output: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | The command id. |
str
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiCommand read_command(command_id)
Retrieve detailed information on an asynchronous command.
Cloudera Manager keeps the results and statuses of asynchronous commands, which have non-negative command IDs. On the other hand, synchronous commands complete immediately, and their results are passed back in the return object of the command execution API call. Outside of that return object, there is no way to check the result of a synchronous command.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | The command id.
try:
api_response = api_instance.read_command(command_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->read_command: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | The command id. |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiCommandList read_commands(end_time=end_time, limit=limit, name=name, offset=offset, start_time=start_time, success=success)
Retrieve detailed information on all recent commands.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
end_time = 789 # int | timestamp of the command end time (optional)
limit = 56 # int | command count to return (from offset) (optional)
name = 'name_example' # str | the command name, unique for the command class HdfsCreateSnapshotCommand#COMMAND_NAME (optional)
offset = 56 # int | command position to start (optional)
start_time = 789 # int | timestamp of the command start time (optional)
success = true # bool | whether the command was successful, if already finished (optional)
try:
api_response = api_instance.read_commands(end_time=end_time, limit=limit, name=name, offset=offset, start_time=start_time, success=success)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->read_commands: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| end_time | int | timestamp of the command end time | [optional] |
| limit | int | command count to return (from offset) | [optional] |
| name | str | the command name, unique for the command class HdfsCreateSnapshotCommand#COMMAND_NAME | [optional] |
| offset | int | command position to start | [optional] |
| start_time | int | timestamp of the command start time | [optional] |
| success | bool | whether the command was successful, if already finished | [optional] |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
str replication_report(command_id, type=type)
Get the replication report CSV files.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | The command id.
type = 'type_example' # str | The requested report type. (optional)
try:
api_response = api_instance.replication_report(command_id, type=type)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->replication_report: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | The command id. | |
| type | str | The requested report type. | [optional] |
str
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiCommand retry(command_id)
Try to rerun a command.
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = cm_client.CommandsResourceApi(cm_client.ApiClient(configuration))
command_id = 789 # int | ID of the command that needs to be run.
try:
api_response = api_instance.retry(command_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling CommandsResourceApi->retry: %s\n" % e)
| Name | Type | Description | Notes |
|---|---|---|---|
| command_id | int | ID of the command that needs to be run. |
[Back to top] [Back to API list] [Back to Model list] [Back to README]