createCluster method

Future<CreateClusterResponse> createCluster({
  1. required String clusterName,
  2. required NetworkingRequest networking,
  3. required SchedulerRequest scheduler,
  4. required Size size,
  5. String? clientToken,
  6. ClusterSlurmConfigurationRequest? slurmConfiguration,
  7. Map<String, String>? tags,
})

Creates a cluster in your account. PCS creates the cluster controller in a service-owned account. The cluster controller communicates with the cluster resources in your account. The subnets and security groups for the cluster must already exist before you use this API action.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter clusterName : A name to identify the cluster. Example: MyCluster

Parameter networking : The networking configuration used to set up the cluster's control plane.

Parameter scheduler : The cluster management and job scheduling software associated with the cluster.

Parameter size : A value that determines the maximum number of compute nodes in the cluster and the maximum number of jobs (active and queued).

  • SMALL: 32 compute nodes and 256 jobs
  • MEDIUM: 512 compute nodes and 8192 jobs
  • LARGE: 2048 compute nodes and 16,384 jobs

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the CLI and SDK automatically generate 1 for you.

Parameter slurmConfiguration : Additional options related to the Slurm scheduler.

Parameter tags : 1 or more tags added to the resource. Each tag consists of a tag key and tag value. The tag value is optional and can be an empty string.

Implementation

Future<CreateClusterResponse> createCluster({
  required String clusterName,
  required NetworkingRequest networking,
  required SchedulerRequest scheduler,
  required Size size,
  String? clientToken,
  ClusterSlurmConfigurationRequest? slurmConfiguration,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSParallelComputingService.CreateCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'clusterName': clusterName,
      'networking': networking,
      'scheduler': scheduler,
      'size': size.value,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (slurmConfiguration != null)
        'slurmConfiguration': slurmConfiguration,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateClusterResponse.fromJson(jsonResponse.body);
}