cm_client.CommandsResourceApi

All URIs are relative to https://localhost/api/v51

Method HTTP request Description
abort_command POST /commands/{commandId}/abort Abort a running command.
get_command_result_data GET /commands/{commandId}/download Download the end result of a command.
get_command_with_steps GET /commands/{commandId}/steps Retrieve detailed information of an asynchronous command including the command steps.
get_standard_error GET /commands/{commandId}/logs/stderr Download a zip-compressed archive of standard error outputs for the command's one-off processes.
get_standard_output GET /commands/{commandId}/logs/stdout Download a zip-compressed archive of standard outputs for the command's one-off processes.
read_command GET /commands/{commandId} Retrieve detailed information on an asynchronous command.
read_commands GET /commands/commands Retrieve detailed information on all recent commands.
retry POST /commands/{commandId}/retry Try to rerun a command.

abort_command

ApiCommand abort_command(command_id)

Abort a running command.

Abort a running command.

Example

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 = 56 # int | The command id.

try:
    # Abort a running command.
    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)

Parameters

Name Type Description Notes
command_id int The command id.

Return type

ApiCommand

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_command_result_data

file 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.

Example

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 = 56 # 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)

Parameters

Name Type Description Notes
command_id int The command id.

Return type

file

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_command_with_steps

ApiCommandWithSteps get_command_with_steps(command_id)

Retrieve detailed information of an asynchronous command including the command steps.

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.

Example

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 = 56 # int | The command id.

try:
    # Retrieve detailed information of an asynchronous command including the command steps.
    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)

Parameters

Name Type Description Notes
command_id int The command id.

Return type

ApiCommandWithSteps

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_standard_error

file get_standard_error(command_id)

Download a zip-compressed archive of standard error outputs for the command's one-off processes.

Download a zip-compressed archive of standard error outputs for the command's one-off processes. Log files are returned zipped together.

Example

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 = 56 # int | The command id.

try:
    # Download a zip-compressed archive of standard error outputs for the command's one-off processes.
    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)

Parameters

Name Type Description Notes
command_id int The command id.

Return type

file

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_standard_output

file get_standard_output(command_id)

Download a zip-compressed archive of standard outputs for the command's one-off processes.

Download a zip-compressed archive of standard outputs for the command's one-off processes. Log files are returned zipped together.

Example

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 = 56 # int | The command id.

try:
    # Download a zip-compressed archive of standard outputs for the command's one-off processes.
    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)

Parameters

Name Type Description Notes
command_id int The command id.

Return type

file

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

read_command

ApiCommand read_command(command_id)

Retrieve detailed information on an asynchronous command.

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.

Example

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 = 56 # int | The command id.

try:
    # Retrieve detailed information on an asynchronous command.
    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)

Parameters

Name Type Description Notes
command_id int The command id.

Return type

ApiCommand

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

read_commands

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.

Retrieve detailed information on all recent commands.

Example

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 = -1 # int | timestamp of the command end time (optional) (default to -1)
limit = 50 # int | command count to return (from offset) (optional) (default to 50)
name = 'name_example' # str | the command name, unique for the command class HdfsCreateSnapshotCommand#COMMAND_NAME (optional)
offset = 0 # int | command position to start (optional) (default to 0)
start_time = -1 # int | timestamp of the command start time (optional) (default to -1)
success = true # bool | whether the command was successful, if already finished (optional)

try:
    # Retrieve detailed information on all recent commands.
    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)

Parameters

Name Type Description Notes
end_time int timestamp of the command end time [optional] [default to -1]
limit int command count to return (from offset) [optional] [default to 50]
name str the command name, unique for the command class HdfsCreateSnapshotCommand#COMMAND_NAME [optional]
offset int command position to start [optional] [default to 0]
start_time int timestamp of the command start time [optional] [default to -1]
success bool whether the command was successful, if already finished [optional]

Return type

ApiCommandList

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

retry

ApiCommand retry(command_id)

Try to rerun a command.

Try to rerun a command.

Example

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 = 56 # int | ID of the command that needs to be run.

try:
    # Try to rerun a command.
    api_response = api_instance.retry(command_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CommandsResourceApi->retry: %s\n" % e)

Parameters

Name Type Description Notes
command_id int ID of the command that needs to be run.

Return type

ApiCommand

Authorization

basic

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]