aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/azure/ai/ml/_internal/entities/scope.py
blob: 9965d69f2ac4d61bd0a9c864423a3e210cbcb389 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------

from typing import List, Union

from marshmallow import Schema

from ..._schema import PathAwareSchema
from .._schema.component import NodeType
from ..entities.node import InternalBaseNode


class Scope(InternalBaseNode):
    """Node of scope components in pipeline with specific run settings."""

    def __init__(self, **kwargs):
        kwargs.pop("type", None)
        super(Scope, self).__init__(type=NodeType.SCOPE, **kwargs)
        self._init = True
        self._adla_account_name = kwargs.pop("adla_account_name", None)
        self._scope_param = kwargs.pop("scope_param", None)
        self._custom_job_name_suffix = kwargs.pop("custom_job_name_suffix", None)
        self._priority = kwargs.pop("priority", None)
        self._auto_token = kwargs.pop("auto_token", None)
        self._tokens = kwargs.pop("tokens", None)
        self._vcp = kwargs.pop("vcp", None)
        self._init = False

    @property
    def adla_account_name(self) -> str:
        """The ADLA account name to use for the scope job.

        :return: ADLA account name
        :rtype: str
        """
        return self._adla_account_name

    @adla_account_name.setter
    def adla_account_name(self, value: str):
        self._adla_account_name = value

    @property
    def scope_param(self) -> str:
        """nebula command used when submit the scope job.

        :return: The nebula command
        :rtype: str
        """
        return self._scope_param

    @scope_param.setter
    def scope_param(self, value: str):
        self._scope_param = value

    @property
    def custom_job_name_suffix(self) -> str:
        """Optional string to append to scope job name.

        :return: The custom suffix
        :rtype: str
        """
        return self._custom_job_name_suffix

    @custom_job_name_suffix.setter
    def custom_job_name_suffix(self, value: str):
        self._custom_job_name_suffix = value

    @property
    def priority(self) -> int:
        """scope job priority.

        If set priority in scope_param, will override this setting.

        :return: The job priority
        :rtype: int
        """
        return self._priority

    @priority.setter
    def priority(self, value: int):
        self._priority = value

    @property
    def auto_token(self) -> int:
        """A predictor for estimating the peak resource usage of scope job.

        :return: auto token
        :rtype: int
        """
        return self._auto_token

    @auto_token.setter
    def auto_token(self, value: int):
        self._auto_token = value

    @property
    def tokens(self) -> int:
        """Standard token allocation.

        :return: The token allocation
        :rtype: int
        """
        return self._tokens

    @tokens.setter
    def tokens(self, value: int):
        self._tokens = value

    @property
    def vcp(self) -> float:
        """Standard VC percent allocation; should be a float between 0 and 1.

        :return: The VC allocation
        :rtype: float
        """
        return self._vcp

    @vcp.setter
    def vcp(self, value: float):
        self._vcp = value

    @classmethod
    def _picked_fields_from_dict_to_rest_object(cls) -> List[str]:
        return ["custom_job_name_suffix", "scope_param", "adla_account_name", "priority", "auto_token", "tokens", "vcp"]

    @classmethod
    def _create_schema_for_validation(cls, context) -> Union[PathAwareSchema, Schema]:
        from .._schema.node import ScopeSchema

        return ScopeSchema(context=context)