# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: client.data.proto
# plugin: python-betterproto
# This file has been @generated

from dataclasses import dataclass
from typing import (
    Dict,
    List,
    Optional,
)

import betterproto


class ProfilingSelection(betterproto.Enum):
    DISABLED = 0
    SIMPLE_PROF = 1
    """only memory and cpu"""


class RunMode(betterproto.Enum):
    Local = 0
    Remote = 1


@dataclass(eq=False, repr=False)
class ClientCommand(betterproto.Message):
    setter: "SetCommands" = betterproto.message_field(1, group="ClientCommands")
    runone: "RunOne" = betterproto.message_field(2, group="ClientCommands")
    runtype: "RunType" = betterproto.message_field(3, group="ClientCommands")
    runmany: "RunMany" = betterproto.message_field(4, group="ClientCommands")
    getcfg: "GetConfig" = betterproto.message_field(5, group="ClientCommands")


@dataclass(eq=False, repr=False)
class SetCommands(betterproto.Message):
    command_content: str = betterproto.string_field(1)
    maybe_def_path: str = betterproto.string_field(2)


@dataclass(eq=False, repr=False)
class RunOne(betterproto.Message):
    command_name: str = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class RunMany(betterproto.Message):
    command_names: List[str] = betterproto.string_field(1)


@dataclass(eq=False, repr=False)
class RunType(betterproto.Message):
    typeinfo: str = betterproto.string_field(1)
    """
    Eventually, perhaps we should encode this as info in protobuf not today
    babey
    """


@dataclass(eq=False, repr=False)
class GetConfig(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class ClientResp(betterproto.Message):
    """Responses to the client command"""

    current_cfg: "ConfigureSmelt" = betterproto.message_field(
        1, group="ClientResponses"
    )


@dataclass(eq=False, repr=False)
class ConfigureSmelt(betterproto.Message):
    """
    This configuration is done once, when SMELT is initialized The client
    should provide this when creating an smelt handle
    """

    smelt_root: str = betterproto.string_field(1)
    """Should be an absolute path"""

    job_slots: int = betterproto.uint64_field(2)
    """
    number of slots the entire executor has -- analogous to job slots in make
    """

    prof_cfg: "ProfilerCfg" = betterproto.message_field(3)
    """configures how we profile commands"""

    test_only: bool = betterproto.bool_field(4)
    """If true, we ignore the non test commands"""

    silent: bool = betterproto.bool_field(5)
    """If true, we do not transmit stdout from the server"""

    prepare_workspace: bool = betterproto.bool_field(6)
    """
    if true, smelt execution will prepare the workspace to run tests in another
    stage this is useful for splitting the work between a build and test stage
    """

    sandbox_env: bool = betterproto.bool_field(7)
    """
    if true, all commands will have their environment variables sandboxed
    """

    local: "CfgLocal" = betterproto.message_field(10, group="InitExecutor")
    docker: "CfgDocker" = betterproto.message_field(11, group="InitExecutor")
    slurm: "CfgSlurm" = betterproto.message_field(12, group="InitExecutor")


@dataclass(eq=False, repr=False)
class ProfilerCfg(betterproto.Message):
    prof_type: "ProfilingSelection" = betterproto.enum_field(1)
    """if we enable simple profiling"""

    sampling_period: int = betterproto.uint64_field(2)


@dataclass(eq=False, repr=False)
class CfgLocal(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class CfgSlurm(betterproto.Message):
    creds: "AwsCreds" = betterproto.message_field(1)
    maybe_info: "ServerInfo" = betterproto.message_field(2)
    none: bool = betterproto.bool_field(10, group="SealedWorkspace")
    dockerws: "DockerWorkspace" = betterproto.message_field(11, group="SealedWorkspace")


@dataclass(eq=False, repr=False)
class ServerInfo(betterproto.Message):
    """
    Populate info for the slurm server  This is configured from the end-user
    side.  if these data is not provided, then smelt will execute `whoami` to
    derive hostname and will let the OS select the port
    """

    hostname: str = betterproto.string_field(1)
    """this is the hostname used by smelt and all workers, by default"""

    port: int = betterproto.uint32_field(2)
    """
    This is port supplied to each worker a. Sometimes you'll have a proxy in
    front of your smelt server to make deployment easier. e.g.  this is
    practical for  deploying in non-LAN networking environments
    """


@dataclass(eq=False, repr=False)
class AwsCreds(betterproto.Message):
    """
    credentials required to create an S3 Client and upload artifacts to it
    """

    key_id: str = betterproto.string_field(1)
    key: str = betterproto.string_field(2)
    bucket: str = betterproto.string_field(3)
    key_base_path: str = betterproto.string_field(4)


@dataclass(eq=False, repr=False)
class DockerWorkspace(betterproto.Message):
    container_name: str = betterproto.string_field(1)
    workspace_smelt_root: str = betterproto.string_field(2)
    docker_args: List[str] = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class Ulimit(betterproto.Message):
    """Clone of Bollard proto message Ulimit"""

    name: Optional[str] = betterproto.string_field(1, optional=True, group="_name")
    soft: Optional[int] = betterproto.int64_field(2, optional=True, group="_soft")
    hard: Optional[int] = betterproto.int64_field(3, optional=True, group="_hard")


@dataclass(eq=False, repr=False)
class CfgDocker(betterproto.Message):
    image_name: str = betterproto.string_field(1)
    additional_mounts: Dict[str, str] = betterproto.map_field(
        2, betterproto.TYPE_STRING, betterproto.TYPE_STRING
    )
    ulimits: List["Ulimit"] = betterproto.message_field(3)
    mac_address: Optional[str] = betterproto.string_field(
        4, optional=True, group="_mac_address"
    )
    run_mode: "RunMode" = betterproto.enum_field(5)
    artifact_bind_directory: str = betterproto.string_field(6)
