Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connecting new ai-lab container to existing docker-db network #92

Merged
merged 8 commits into from
Mar 25, 2024

Conversation

ahsimb
Copy link
Collaborator

@ahsimb ahsimb commented Mar 22, 2024

closes #89

@ahsimb ahsimb added the feature Product feature label Mar 22, 2024
@ahsimb ahsimb self-assigned this Mar 22, 2024
@ahsimb
Copy link
Collaborator Author

ahsimb commented Mar 22, 2024

We also need to cover the case when a new AI-Lab container sees running Docker-DB. The UI suggests to do nothing if the user wants to use old data. And that's not good.

@@ -61,7 +61,7 @@ def bring_itde_up(conf: Secrets) -> None:
db_info = env_info.database_info
container_info = db_info.container_info

_add_current_container_to_db_network(container_info)
_add_current_container_to_db_network(container_info.network_info.network_name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like narrow interfaces: 👍

network.connect(container.id)


def _is_current_container_not_in_db_network(network_name: str) -> bool:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this function relate to self._add_current_container_to_db_network()?
I have the feeling that part of self._add_current_container_to_db_network() can be replaced by using this function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One is checking if the AI-Lab container needs to be connected to the Docker-DB network. The other one connects the container to the network if the container exists and is not connected to this network yet.

@@ -127,47 +146,60 @@ def _get_ipv4_ddresses():

def is_itde_running(conf: Secrets) -> Tuple[bool, bool]:
"""
Checks if the ITDE container exists and if it is running. Returns the two boolean
flags - (exists, running).
Checks if the ITDE container exists and ready to be used. In the Docker Edition that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to replace the tuple by an enum?

class ItdeContainerStatus(Enum):
    EXISTS = 0
    RUNNING = 1

This would also enable to handle the case not container_name or not network_name more explicitly by returning None or having an explicit enum value UNKNOWN or INVALID.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but this would also require changes in the upstream code of the the AI-Lab.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the out-of-scope-findings to #93

exasol/nb_connector/itde_manager.py Outdated Show resolved Hide resolved
exasol/nb_connector/itde_manager.py Show resolved Hide resolved
@ahsimb ahsimb merged commit ad39d29 into main Mar 25, 2024
12 checks passed
@ahsimb ahsimb deleted the feature/89-connect-disconnect-ai-lab-container branch March 25, 2024 16:01
raise RuntimeError('Unable to find the name of the Docker container.')
network_name = conf.get(AILabConfig.itde_network)
if not container_name or not network_name:
raise RuntimeError('Unable to find the name of the Docker container or its network.')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise RuntimeError('Unable to find the name of the Docker container or its network.')
raise RuntimeError('Unable to find the name of the Docker DB container or its network.')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reconnect/Disconnect the Ai-Lab container from the Docker-DB during start/stop Docker-DB
4 participants