Module codeflare_sdk.cluster.config

The config sub-module contains the definition of the ClusterConfiguration dataclass, which is used to specify resource requirements and other details when creating a Cluster object.

Expand source code
# Copyright 2022 IBM, Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
The config sub-module contains the definition of the ClusterConfiguration dataclass,
which is used to specify resource requirements and other details when creating a
Cluster object.
"""

from dataclasses import dataclass, field
import pathlib

dir = pathlib.Path(__file__).parent.parent.resolve()


@dataclass
class ClusterConfiguration:
    """
    This dataclass is used to specify resource requirements and other details, and
    is passed in as an argument when creating a Cluster object.
    """

    name: str
    namespace: str = None
    head_info: list = field(default_factory=list)
    head_cpus: int = 2
    head_memory: int = 8
    head_gpus: int = 0
    machine_types: list = field(default_factory=list)  # ["m4.xlarge", "g4dn.xlarge"]
    min_cpus: int = 1
    max_cpus: int = 1
    num_workers: int = 1
    min_memory: int = 2
    max_memory: int = 2
    num_gpus: int = 0
    template: str = f"{dir}/templates/base-template.yaml"
    instascale: bool = False
    mcad: bool = False
    envs: dict = field(default_factory=dict)
    image: str = ""
    image_pull_secrets: list = field(default_factory=list)
    dispatch_priority: str = None
    write_to_file: bool = False
    verify_tls: bool = True

    def __post_init__(self):
        if not self.verify_tls:
            print(
                "Warning: TLS verification has been disabled - Endpoint checks will be bypassed"
            )

    local_queue: str = None

Classes

class ClusterConfiguration (name: str, namespace: str = None, head_info: list = <factory>, head_cpus: int = 2, head_memory: int = 8, head_gpus: int = 0, machine_types: list = <factory>, min_cpus: int = 1, max_cpus: int = 1, num_workers: int = 1, min_memory: int = 2, max_memory: int = 2, num_gpus: int = 0, template: str = '/home/runner/work/codeflare-sdk/codeflare-sdk/src/codeflare_sdk/templates/base-template.yaml', instascale: bool = False, mcad: bool = False, envs: dict = <factory>, image: str = '', image_pull_secrets: list = <factory>, dispatch_priority: str = None, write_to_file: bool = False, verify_tls: bool = True, local_queue: str = None)

This dataclass is used to specify resource requirements and other details, and is passed in as an argument when creating a Cluster object.

Expand source code
class ClusterConfiguration:
    """
    This dataclass is used to specify resource requirements and other details, and
    is passed in as an argument when creating a Cluster object.
    """

    name: str
    namespace: str = None
    head_info: list = field(default_factory=list)
    head_cpus: int = 2
    head_memory: int = 8
    head_gpus: int = 0
    machine_types: list = field(default_factory=list)  # ["m4.xlarge", "g4dn.xlarge"]
    min_cpus: int = 1
    max_cpus: int = 1
    num_workers: int = 1
    min_memory: int = 2
    max_memory: int = 2
    num_gpus: int = 0
    template: str = f"{dir}/templates/base-template.yaml"
    instascale: bool = False
    mcad: bool = False
    envs: dict = field(default_factory=dict)
    image: str = ""
    image_pull_secrets: list = field(default_factory=list)
    dispatch_priority: str = None
    write_to_file: bool = False
    verify_tls: bool = True

    def __post_init__(self):
        if not self.verify_tls:
            print(
                "Warning: TLS verification has been disabled - Endpoint checks will be bypassed"
            )

    local_queue: str = None

Class variables

var dispatch_priority : str
var envs : dict
var head_cpus : int
var head_gpus : int
var head_info : list
var head_memory : int
var image : str
var image_pull_secrets : list
var instascale : bool
var local_queue : str
var machine_types : list
var max_cpus : int
var max_memory : int
var mcad : bool
var min_cpus : int
var min_memory : int
var name : str
var namespace : str
var num_gpus : int
var num_workers : int
var template : str
var verify_tls : bool
var write_to_file : bool