Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Update deprecated docker module imports (#118)
Browse files Browse the repository at this point in the history
* Update deprecated docker module imports

* Update test_aci_worker.py

---------

Co-authored-by: Alexander Streed <[email protected]>
  • Loading branch information
taljaards and desertaxle authored Oct 10, 2023
1 parent e03fba7 commit 14ed0a2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Updated imports of deprecated Prefect Docker modules, bumping the minimum required Prefect version to 2.10.11 - [#118](https://github.com/PrefectHQ/prefect-azure/pull/118)

### Deprecated

### Removed
Expand Down
10 changes: 5 additions & 5 deletions prefect_azure/container_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

import anyio
import dateutil.parser
import prefect.infrastructure.docker
import prefect.infrastructure.container
from anyio.abc import TaskStatus
from azure.core.exceptions import HttpResponseError, ResourceNotFoundError
from azure.core.polling import LROPoller
Expand All @@ -95,10 +95,10 @@
ResourceRequirements,
UserAssignedIdentities,
)
from prefect.docker import get_prefect_image_name
from prefect.exceptions import InfrastructureNotAvailable, InfrastructureNotFound
from prefect.infrastructure.base import Infrastructure, InfrastructureResult
from prefect.utilities.asyncutils import run_sync_in_worker_thread, sync_compatible
from prefect.utilities.dockerutils import get_prefect_image_name
from pydantic import VERSION as PYDANTIC_VERSION

if PYDANTIC_VERSION.startswith("2."):
Expand Down Expand Up @@ -235,7 +235,7 @@ class AzureContainerInstanceJob(Infrastructure):
)
image_registry: Optional[
Union[
prefect.infrastructure.docker.DockerRegistry,
prefect.infrastructure.container.DockerRegistry,
ACRManagedIdentity,
]
] = Field(
Expand Down Expand Up @@ -593,7 +593,7 @@ def _configure_container_group(self, container: Container) -> ContainerGroup:
@staticmethod
def _create_image_registry_credentials(
image_registry: Union[
prefect.infrastructure.docker.DockerRegistry,
prefect.infrastructure.container.DockerRegistry,
ACRManagedIdentity,
None,
]
Expand All @@ -611,7 +611,7 @@ def _create_image_registry_credentials(
input doesn't match any of the expected types.
"""
if image_registry and isinstance(
image_registry, prefect.infrastructure.docker.DockerRegistry
image_registry, prefect.infrastructure.container.DockerRegistry
):
return [
ImageRegistryCredential(
Expand Down
10 changes: 5 additions & 5 deletions prefect_azure/workers/container_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
)
from prefect import get_client
from prefect.client.schemas import FlowRun
from prefect.docker import get_prefect_image_name
from prefect.exceptions import InfrastructureNotAvailable, InfrastructureNotFound
from prefect.server.schemas.core import Flow
from prefect.server.schemas.responses import DeploymentResponse
from prefect.utilities.asyncutils import run_sync_in_worker_thread
from prefect.utilities.dockerutils import get_prefect_image_name
from prefect.workers.base import (
BaseJobConfiguration,
BaseVariables,
Expand Down Expand Up @@ -215,7 +215,7 @@ class AzureContainerJobConfiguration(BaseJobConfiguration):
entrypoint: Optional[str] = Field(default=DEFAULT_CONTAINER_ENTRYPOINT)
image_registry: Optional[
Union[
prefect.infrastructure.docker.DockerRegistry,
prefect.infrastructure.container.DockerRegistry,
ACRManagedIdentity,
]
] = Field(default=None)
Expand Down Expand Up @@ -296,7 +296,7 @@ def _add_image(self):
def _add_image_registry_credentials(
self,
image_registry: Union[
prefect.infrastructure.docker.DockerRegistry,
prefect.infrastructure.container.DockerRegistry,
ACRManagedIdentity,
None,
],
Expand All @@ -309,7 +309,7 @@ def _add_image_registry_credentials(
ACRManagedIdentity object.
"""
if image_registry and isinstance(
image_registry, prefect.infrastructure.docker.DockerRegistry
image_registry, prefect.infrastructure.container.DockerRegistry
):
self.arm_template["resources"][0]["properties"][
"imageRegistryCredentials"
Expand Down Expand Up @@ -431,7 +431,7 @@ class AzureContainerVariables(BaseVariables):
)
image_registry: Optional[
Union[
prefect.infrastructure.docker.DockerRegistry,
prefect.infrastructure.container.DockerRegistry,
ACRManagedIdentity,
]
] = Field(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
prefect>=2.10.5
prefect>=2.10.11
azure_mgmt_containerinstance>=10.0
azure_identity>=1.10
azure-mgmt-resource>=21.2
Expand Down
2 changes: 1 addition & 1 deletion tests/test_aci_infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
from azure.mgmt.resource import ResourceManagementClient
from prefect.exceptions import InfrastructureNotAvailable, InfrastructureNotFound
from prefect.infrastructure.docker import DockerRegistry
from prefect.infrastructure.container import DockerRegistry
from prefect.settings import get_current_settings
from pydantic import VERSION as PYDANTIC_VERSION

Expand Down
4 changes: 2 additions & 2 deletions tests/test_aci_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
from azure.identity import ClientSecretCredential
from azure.mgmt.resource import ResourceManagementClient
from prefect.client.schemas import FlowRun
from prefect.docker import get_prefect_image_name
from prefect.exceptions import InfrastructureNotFound
from prefect.infrastructure.docker import DockerRegistry
from prefect.infrastructure.container import DockerRegistry
from prefect.server.schemas.core import Flow
from prefect.settings import get_current_settings
from prefect.testing.utilities import AsyncMock
from prefect.utilities.dockerutils import get_prefect_image_name
from pydantic import VERSION as PYDANTIC_VERSION

if PYDANTIC_VERSION.startswith("2."):
Expand Down

0 comments on commit 14ed0a2

Please sign in to comment.