This topic describes how to use commands to manage instances on the MaxCompute client.

Show Instances/Show P

Syntax
SHOW INSTANCES [FROM startdate TO enddate] [number];
SHOW P [FROM startdate TO enddate] [number];
SHOW INSTANCES [-all];
SHOW P [-all];
SHOW P -p <project name>;

Description

Displays information about the instances created by the current user. The information in the query result includes StartTime (accurate to seconds), RunTime (s), and Status (instance status). An instance can be in any of the following states:
  • Running: The instance is running.
  • Success: Instance operation is complete.
  • Waiting: The instance is waiting to run.
  • Failed: The job failed, but data in the target table is not modified.
  • Suspended: The instance is suspended.
  • Cancelled: The instance is stopped.
Parameters
  • startdate and enddate: returns the instance information during the specified period (from startdate to enddate in the yyyy-mm-dd format. The parameters are optional. If they are not specified, information about instances submitted within three days is returned by default.
  • number: specifies the number of instances to return. Information about N (specified by number) instances submitted at the time nearest to the current time is returned in chronological order. If it is not specified, information about all instances that meet the requirements is returned.
  • -all: indicates that all instances executed in the current project are returned. A maximum of 50 records can be returned by default. To run this command, you must have the LIST permission on the project. You can use -limit number to show more records. For example, run show p -all -limit 100 to show 100 instance records in the current project.
  • project name: indicates the name of a project. To use this parameter, your account must be a member of the project.
InstanceID and the related SQL statement are as follows:
odps@ $project_name>show p;
StartTime             RunTime  Status   InstanceID                    Owner       Query
2015-04-28 13:57:55   1s       Success  20150428xxxxxxxxxxxxxxxxxx   ALIYUN$xxxxx@aliyun-inner.com       select * from tab_pack_priv limit 20;
...    ...    ...    ...    ...    ...
...    ...    ...    ...    ...    ...

Status Instance

Syntax
status instance_id; 
Description
  • Queries the status of a specified instance, such as Success, Failed, Running, or Cancelled.
  • If the specified instance is not created by the current user, an exception is returned.

Parameters

instance_id: specifies the instance whose status you want to query. This parameter uniquely identifies an instance.

Example
-- View the status of the instance with ID of 20131225123xxxxxxxxxxxxxxx.
odps@ $project_name>status 20131225123xxxxxxxxxxxxxxx;
Success

Top Instance

Only a project owner or the administrator is allowed to run this command.

Syntax
top instance;
top instance -all;
Description
  • top instance: displays information about the running job submitted by the current account in the current project. The information includes InstanceID, Owner, Type, StartTime, Progress, Status, Priority, RuntimeUsage (CPU/MEM), TotalUsage (CPU/MEM), and QueueingInfo (POS/LEN).
  • top instance -all: displays all jobs that are running in the current project. A maximum of 50 records can be displayed by default. You can use -limit number to show more records.
Example
odps@ $project_name>top instance;

Kill Instance

Syntax
kill instance_id; 

Description

Stops the specified instance. The instance must be in the Running state.
Note The execution of this command is an asynchronous process, which means that the distributed task may still be running even after the system runs this command and returns the result. You can run the status command to check the instance status.

Parameters

instance_id: uniquely identifies an instance. It must be the ID of a running instance. If the instance is not running, an error is returned.

Example
-- Stop the instance with ID of 20131225123xxxxxxxxxxxxxxx. 
odps@ $project_name>kill 20131225123xxxxxxxxxxxxxxx;

Desc Instance

Syntax
desc instance instance_id ; 

Description

Obtains job information based on a specific instance ID. The information includes SQL, Owner, StartTime, EndTime, and Status.

Parameters

instance_id: uniquely identifies an instance.

Example
-- Query job information about the instance with ID of 20150715xxxxxxxxxxxxxxx. 
odps@ $project_name> desc instance 20150715xxxxxxxxxxxxxxx;
ID                                      20150715xxxxxxxxxxxxxxx
Owner                                   ALIYUN$XXXXXX@alibaba-inc.com
StartTime                               2015-07-15 18:34:41
EndTime                                 2015-07-15 18:34:42
Status                                  Terminated
console_select_query_task_1436956481295 Success
Query                                   select * from mj_test;

Wait Instance

Syntax
wait instance_id; 

Description

Obtains task running log information based on the specific instance ID. The information includes the Logview link. You can view detailed logs of a task on the Logview.
Note You can only open the Logview for the instances created in the last three days. For the instances created more than three days, you can obtain the Logview links from their logs.

Parameters

instance_id: uniquely identifies an instance.

Example
-- View the task running log of the instance with ID of 20170925161122379gxxxxxx.
wait 20170925161122379gxxxxxx;
ID = 20170925161122379g3xxxxxx
Log view:
http://logview.odps.aliyun.com/logview/?h=http://service.odps.aliyun.com/api&p=alian&i=201709251611223xxxxxxdqp&token=XXXXXXvbiI6IjEifQ==
Job Queueing...
Summary:
resource cost: cpu 0.05 Core * Min, memory 0.05 GB * Min
inputs:
        alian.bank_data: 41187 (588232 bytes)
outputs:
        alian.result_table: 8 (640 bytes)
Job run time: 2.000
Job run mode: service job
Job run engine: execution engine
M1:
        instance count: 1
        run time: 1.000
        instance time:
                min: 1.000, max: 1.000, avg: 1.000
        input records:
                TableScan_REL5213301: 41187  (min: 41187, max: 41187, avg: 41187
)
        output records:
                StreamLineWrite_REL5213305: 8  (min: 8, max: 8, avg: 8)
R2_1:
        instance count: 1
        run time: 2.000
        instance time:
                min: 2.000, max: 2.000, avg: 2.000
        input records:
                StreamLineRead_REL5213306: 8  (min: 8, max: 8, avg: 8)
        output records:
                TableSink_REL5213309: 8  (min: 8, max: 8, avg: 8)