ads.jobs.builders package

Subpackages

Submodules

ads.jobs.builders.base module

class ads.jobs.builders.base.Builder(spec: Dict | None = None, **kwargs)[source]

Bases: Serializable

To initialize the object, user can either pass in the specification as a dictionary or through keyword arguments.

Parameters:
  • spec (dict, optional) – Object specification, by default None

  • kwargs (dict) – Specification as keyword arguments. If spec contains the same key as the one in kwargs, the value from kwargs will be used.

attribute_map = {}
build() Self[source]

Load default values from the environment for the job infrastructure. Should be implemented on the child level.

classmethod from_dict(obj_dict: dict) Self[source]

Initialize the object from a Python dictionary

get_spec(key: str, default: Any | None = None) Any[source]

Gets the value of a specification property

Parameters:
  • key (str) – The name of the property.

  • default (Any, optional) – The default value to be used, if the property does not exist, by default None.

Returns:

The value of the property.

Return type:

Any

property kind: str

The kind of the object as showing in YAML. Subclass should overwrite this value.

set_spec(k: str, v: Any) Self[source]

Sets a specification property for the object.

Parameters:
  • k (str) – key, the name of the property.

  • v (Any) – value, the value of the property.

Returns:

This method returns self to support chaining methods.

Return type:

Self

to_dict(**kwargs) dict[source]

Converts the object to dictionary with kind, type and spec as keys.

Parameters:

**kwargs (Dict) –

The additional arguments. - filter_by_attribute_map: bool

If True, then in the result will be included only the fields presented in the attribute_map.

property type: str

The type of the object as showing in YAML.

This implementation returns the class name with the first letter coverted to lower case.

class ads.jobs.builders.base.Self

Special type to represent the current enclosed class.

This type is used by factory class method or when a method returns self.

alias of TypeVar(‘Self’, bound=Builder)

Module contents