All Products
Search
Document Center

MPS queue management

Last Updated: Sep 04, 2018

The system automatically creates an MPS queue when you open the MPS service. You can also use APIs to manage MPS queue (pipeline). For example, SearchPipeline, QueryPipelineList and UpdatePipeline.

Search MPS queue

You can use the SearchPipeline interface to search the MPS queue information.

  1. import json
  2. from aliyunsdkmts.request.v20140618 import SearchPipelineRequest
  3. from aliyunsdkcore import client
  4. region = '<region>'
  5. access_key_id = '<access_key_id>'
  6. access_key_secret = '<access_key_secret>'
  7. client = client.AcsClient(access_key_id, access_key_secret, region)
  8. request = SearchPipelineRequest.SearchPipelineRequest()
  9. response = client.do_action_with_exception(request);
  10. json_response = json.loads(response)
  11. pipelines = json_response['PipelineList']['Pipeline']
  12. for pipeline in pipelines:
  13. print 'pipeline id:' + pipeline['Id'] + ', name:' + pipeline['Name'] + ', state:' + pipeline['State']

Query MPS queue

If you have the pipelineId, you can use the pipelineId to call QueryPipelineList interface to query MPS queue information.

  1. import json
  2. from aliyunsdkmts.request.v20140618 import QueryPipelineListRequest
  3. from aliyunsdkcore import client
  4. region = '<region>'
  5. access_key_id = '<access_key_id>'
  6. access_key_secret = '<access_key_secret>'
  7. pipeline_id = '<pipeline_id>'
  8. client = client.AcsClient(access_key_id, access_key_secret, region)
  9. request = QueryPipelineListRequest.QueryPipelineListRequest()
  10. request.set_PipelineIds(pipeline_id)
  11. response = client.do_action_with_exception(request);
  12. json_response = json.loads(response)
  13. pipelines = json_response['PipelineList']['Pipeline']
  14. for pipeline in pipelines:
  15. print 'pipeline id:' + pipeline['Id'] + ', name:' + pipeline['Name'] + ', state:' + pipeline['State']

Update MPS queue

Use the UpdatePipeline interface to update MPS queue information, including MPS queue name and status. The status can be Active and Paused.

  1. import json
  2. from aliyunsdkmts.request.v20140618 import SearchPipelineRequest
  3. from aliyunsdkmts.request.v20140618 import UpdatePipelineRequest
  4. from aliyunsdkcore import client
  5. region = '<region>'
  6. access_key_id = '<access_key_id>'
  7. access_key_secret = '<access_key_secret>'
  8. client = client.AcsClient(access_key_id, access_key_secret, region)
  9. request = SearchPipelineRequest.SearchPipelineRequest()
  10. response = client.do_action_with_exception(request);
  11. json_response = json.loads(response)
  12. pipeline = json_response['PipelineList']['Pipeline'][0]
  13. request = UpdatePipelineRequest.UpdatePipelineRequest()
  14. request.set_PipelineId(pipeline['Id'])
  15. request.set_Name(pipeline['Name'])
  16. request.set_State('Paused' if pipeline['State'] == 'Active' else 'Active')
  17. response = client.do_action_with_exception(request);
  18. json_response = json.loads(response)
  19. pipeline = json_response['Pipeline']
  20. print 'pipeline id:' + pipeline['Id'] + ', name:' + pipeline['Name'] + ', state:' + pipeline['State']