Image
Represents a container image for a job. The image is defined based on its' python dependencies and two 'build scripts' expressed as Dockerfile commands. All attributes can be initialized with either a string or a file name.
__init__(python_version='auto', python_requirements='', build_script_pre='', build_script_post='', branch_name=None, commit_hash=None, path_to_repo=None, path_to_module=None)
Initialize an Image configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
python_version
|
str
|
Python version for the container (e.g. |
'auto'
|
python_requirements
|
str | list[str]
|
Python dependencies. Accepts a pip-freeze
string, a list of package specifiers, a path to a
|
''
|
build_script_pre
|
str
|
Dockerfile commands to execute before installing Python requirements. Can be a string or a file path. |
''
|
build_script_post
|
str
|
Dockerfile commands to execute after installing Python requirements. Can be a string or a file path. |
''
|
branch_name
|
Optional[str]
|
Git branch name (populated automatically during build). |
None
|
commit_hash
|
Optional[str]
|
Git commit hash (populated automatically during build). |
None
|
path_to_repo
|
Optional[str]
|
Absolute path to the source repository root. |
None
|
path_to_module
|
Optional[str]
|
Relative path from the repository root to the Python module containing the entrypoint. |
None
|
from_dict(data)
Create an Image instance from a dictionary representation.
to_dict()
Convert the Image instance to a dictionary representation.
to_json()
Convert the Image instance to a JSON string representation.
update(**kwargs)
Update one or more Image attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Attribute names and their new values. |
{}
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If a string-only attribute receives a non-string value. |
AttributeError
|
If an attribute name does not exist on the Image. |