For detailed description of functions, please check Key Functions.
Orchestrator
Orchestrator allows you to create task to run application instances to the powerful distributed computing providers network.
Fetch available instance resources
Before using Orchestrator to deploy task, it is necessary to know which instance resources are available. Through get_instance_resources you can get a list of available instance resources including their region information. From the output list, you can choose an instance_type by checking the description for the hardware configuration requirements.
It shows that this task has three applications. Open the URL in the web browser you will view the application's information if it is running correctly.
Check information of an existing task
With Orchestrator, you can check information for an existing task to follow up or view task deployment.
import jsonimport swanswan_orchestrator = swan.resource(api_key='<SWAN_API_KEY>', service_name='Orchestrator')# Get an existing task deployment infotask_deployment_info = swan_orchestrator.get_deployment_info(<task_uuid>)print(json.dumps(task_deployment_info, indent=2))
Access application instances of an existing task
With Orchestrator, you can easily get the deployed application instances for an existing task.
You can also early terminate an existing task and its application instances. By terminating task, you will stop all the related running application instances and thus you will get refund of the remaining task duration.
import jsonimport swanswan_orchestrator = swan.resource(api_key='<SWAN_API_KEY>', service_name='Orchestrator')# Terminate an existing task (and its application instances)swan_orchestrator.terminate_task(<task_uuid>)