Skip to content

Commit 94965b5

Browse files
authored
Renames "runtime" on the "backend" in the operator merged specification (#483)
2 parents ab19275 + 81c4e1e commit 94965b5

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

ads/opctl/operator/cmd.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
OPERATOR_BASE_DOCKER_GPU_FILE,
3333
OPERATOR_BASE_GPU_IMAGE,
3434
OPERATOR_BASE_IMAGE,
35+
OPERATOR_BACKEND_SECTION_NAME
3536
)
3637
from ads.opctl.operator.common.operator_loader import OperatorInfo, OperatorLoader
3738
from ads.opctl.utils import publish_image as publish_image_cmd
@@ -204,7 +205,7 @@ def init(
204205
).items():
205206
tmp_config = value
206207
if merge_config and operator_config:
207-
tmp_config = {**operator_config, "runtime": value}
208+
tmp_config = {**operator_config, OPERATOR_BACKEND_SECTION_NAME: value}
208209

209210
with fsspec.open(
210211
os.path.join(

ads/opctl/operator/common/backend_factory.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
RESOURCE_TYPE,
2929
RUNTIME_TYPE,
3030
)
31-
from ads.opctl.operator.common.const import PACK_TYPE
31+
from ads.opctl.operator.common.const import PACK_TYPE, OPERATOR_BACKEND_SECTION_NAME
3232
from ads.opctl.operator.common.dictionary_merger import DictionaryMerger
3333
from ads.opctl.operator.common.operator_loader import OperatorInfo, OperatorLoader
3434

@@ -124,14 +124,14 @@ def backend(
124124
f"The `type` attribute must be specified in the operator's config."
125125
)
126126

127-
if not backend and not config.config.get("runtime"):
127+
if not backend and not config.config.get(OPERATOR_BACKEND_SECTION_NAME):
128128
logger.info(
129129
f"Backend config is not provided, the {BACKEND_NAME.LOCAL.value} "
130130
"will be used by default. "
131131
)
132132
backend = BACKEND_NAME.LOCAL.value
133133
elif not backend:
134-
backend = config.config.get("runtime")
134+
backend = config.config.get(OPERATOR_BACKEND_SECTION_NAME)
135135

136136
# extracting details about the operator
137137
operator_info = OperatorLoader.from_uri(uri=operator_type).load()
@@ -211,9 +211,9 @@ def backend(
211211
config.config["infrastructure"] = p_backend.config["infrastructure"]
212212
config.config["execution"] = p_backend.config["execution"]
213213

214-
return cls.BACKEND_MAP[p_backend.config["execution"]["backend"].lower()](
215-
config=config.config, operator_info=operator_info
216-
)
214+
return cls.BACKEND_MAP[
215+
p_backend.config["execution"][OPERATOR_BACKEND_SECTION_NAME].lower()
216+
](config=config.config, operator_info=operator_info)
217217

218218
@classmethod
219219
def _extract_backend(

ads/opctl/operator/common/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
OPERATOR_BASE_DOCKER_FILE = "Dockerfile"
1616
OPERATOR_BASE_DOCKER_GPU_FILE = "Dockerfile.gpu"
1717

18+
OPERATOR_BACKEND_SECTION_NAME = "backend"
1819

1920
class PACK_TYPE(str, metaclass=ExtendedEnumMeta):
2021
SERVICE = "service"

ads/opctl/operator/common/operator_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ class OperatorConfig(DataClassSerializable):
3030
The version of the operator.
3131
spec: object
3232
The operator specification details.
33-
runtime: dict
34-
The runtime details of the operator.
33+
backend: dict
34+
The operator's backend details.
3535
"""
3636

3737
kind: str = "operator"
3838
type: str = None
3939
version: str = None
4040
spec: Any = None
41-
runtime: Dict = None
41+
backend: Dict = None
4242

4343
@classmethod
4444
def _validate_dict(cls, obj_dict: Dict) -> bool:

0 commit comments

Comments
 (0)