blob: bd1cdad52e3e3a554e35d0a4a12413789c66e3c4 (
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
|
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from typing import Any, List
from azure.ai.ml.entities._mixins import RestTranslatableMixin
from azure.ai.ml._restclient.v2024_10_01_preview.models import JobResources as RestJobResources
class JobResources(RestTranslatableMixin):
"""Resource configuration for a job.
This class should not be instantiated directly. Instead, use its subclasses.
"""
def __init__(self, *, instance_types: List[str]) -> None:
self.instance_types = instance_types
def _to_rest_object(self) -> Any:
return RestJobResources(instance_types=self.instance_types)
@classmethod
def _from_rest_object(cls, obj: RestJobResources) -> "JobResources":
job_resources = cls(instance_types=obj.instance_types)
return job_resources
def __eq__(self, other: object) -> bool:
if not isinstance(other, JobResources):
return NotImplemented
return self.instance_types == other.instance_types
def __ne__(self, other: object) -> bool:
return not self.__eq__(other)
|