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

HyperAI integration: orchestrator and service connector #2372

Merged
merged 140 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
d7c4ada
Add init for HyperAI integration
christianversloot Jan 23, 2024
38a0f75
WIP: HyperAI service connector
christianversloot Jan 23, 2024
069aa5a
WIP
christianversloot Jan 23, 2024
8555b06
WIP: HyperAI Service Connector
christianversloot Jan 23, 2024
1cf7b1e
WIP: HyperAI Orchestrator
christianversloot Jan 23, 2024
61aaa28
Replace Docker compose write with temporary file and SCP
christianversloot Jan 25, 2024
b1971ef
Variable assignment error
christianversloot Jan 25, 2024
433ffb0
Set dependency
christianversloot Jan 25, 2024
f911c65
Set basic values of the HyperAI settings and config
christianversloot Jan 25, 2024
25b4e6b
Add config property
christianversloot Jan 25, 2024
b353a18
Allow mounts to be made
christianversloot Jan 25, 2024
ca9b525
Remove newline
christianversloot Jan 25, 2024
3a68dde
Merge pull request #1 from zenml-io/develop
christianversloot Jan 25, 2024
d611a4b
Finish (untested) orchestrator
christianversloot Jan 25, 2024
b9bd84f
Import HyperAI integration
christianversloot Jan 25, 2024
a614d4d
Import HyperAI service connector in service connector registry
christianversloot Jan 25, 2024
17d016f
Rename resource type
christianversloot Jan 25, 2024
93b1dbe
Rename auth method
christianversloot Jan 25, 2024
c82c4c6
Force key to be base64
christianversloot Jan 25, 2024
ec4f48e
Fixes to service connector
christianversloot Jan 25, 2024
442d7f3
Identify instance by name and IP address
christianversloot Jan 25, 2024
17b4990
Strip IP address Python
christianversloot Jan 25, 2024
99b15e2
Strip IP address Python
christianversloot Jan 25, 2024
15658a5
Return paramiko client
christianversloot Jan 25, 2024
cb53440
WIP
christianversloot Jan 25, 2024
00bbe76
Mimic sagemaker integration
christianversloot Jan 25, 2024
502908e
Fixes to make HyperAI orchestrator visible
christianversloot Jan 25, 2024
52b2417
Fixes to make orchestrator work
christianversloot Jan 26, 2024
e5fd25b
Temp change default local ip for testing
christianversloot Jan 26, 2024
0bbe217
Environment fix
christianversloot Jan 26, 2024
8efebb0
Use upstream steps to determine dependencies
christianversloot Jan 26, 2024
7bf8da3
Add support for scheduled pipelines
christianversloot Jan 26, 2024
b14e68c
Polish schedules
christianversloot Jan 26, 2024
110be97
Add configuration support for multiple Paramiko key types
christianversloot Jan 26, 2024
1217584
Add Base64 instructions
christianversloot Jan 26, 2024
5f047c9
Rename various vars
christianversloot Jan 26, 2024
ef7ab76
Add instructions about possible cron
christianversloot Jan 26, 2024
82bfc58
Some docstring edits
christianversloot Jan 26, 2024
943db39
Add setting for CR autologin
christianversloot Jan 26, 2024
92519c1
Add rudimentary Docker login
christianversloot Jan 26, 2024
94268fa
Move value
christianversloot Jan 26, 2024
fa0144d
Add docstring
christianversloot Jan 26, 2024
4a6c30e
Remove unused def
christianversloot Jan 26, 2024
e8c9f97
Extract Paramiko key type given service connector configuration
christianversloot Jan 26, 2024
51993b0
Add better warnings
christianversloot Jan 26, 2024
a4b0433
Check for None differently
christianversloot Jan 26, 2024
88068fc
Automatic Docker login if configured
christianversloot Jan 26, 2024
7340603
Add HyperAI orchestrator flavor to docs
christianversloot Jan 26, 2024
013940d
Basic docs for HyperAI orchestrator
christianversloot Jan 26, 2024
eee13a9
Add HyperAI service connector to auth management docs
christianversloot Jan 26, 2024
3d613e6
Add HyperAI service connector to docs
christianversloot Jan 26, 2024
9576745
Set autologin to False by default
christianversloot Jan 29, 2024
992cda2
Add test similar to Airflow orchestrator
christianversloot Jan 29, 2024
ba53f7c
Formatting
christianversloot Jan 29, 2024
8b8d952
Merge pull request #2 from christianversloot/develop
christianversloot Jan 29, 2024
76727e1
Revert changes needed to run successfully locally
christianversloot Jan 29, 2024
850f7db
Add mount path validation
christianversloot Jan 30, 2024
3aa6a30
Improve error handling and formatting
christianversloot Jan 30, 2024
71ab61d
Format mount paths differently
christianversloot Jan 30, 2024
c6e74f7
Upgrade azureml-core to 1.54.0.post1
christianversloot Jan 30, 2024
251665b
Fix docstring
christianversloot Jan 30, 2024
ab4fe04
Update src/zenml/integrations/hyperai/service_connectors/hyperai_serv…
christianversloot Jan 30, 2024
2c19d2c
Rename def into _validate_mount_paht
christianversloot Jan 30, 2024
e3ecefd
Merge branch 'hyperai-integration' of github.com:christianversloot/ze…
christianversloot Jan 30, 2024
5baf47d
Update config docstring to default to False
christianversloot Jan 30, 2024
2c6f6a9
Move Settings, Config and Flavor to lavor folder
christianversloot Jan 30, 2024
da39cc8
Remove type from docstring
christianversloot Jan 30, 2024
d3180ab
Remove type from docstring
christianversloot Jan 30, 2024
9511608
Remove type check convered by pydantic
christianversloot Jan 30, 2024
1cc6bff
Select container registry more efficiently
christianversloot Jan 30, 2024
7f1bb67
Remove redundant type conversion
christianversloot Jan 30, 2024
b843d83
Move Paramiko client creation into helper method
christianversloot Jan 30, 2024
921bcd5
Reformatting
christianversloot Jan 30, 2024
57949b8
Fix imports
christianversloot Jan 30, 2024
76fdb29
Temp changes for local testing
christianversloot Jan 30, 2024
3e7390c
Fix imports
christianversloot Jan 30, 2024
86688af
Revert "Temp changes for local testing"
christianversloot Jan 30, 2024
2d36b6e
Rename HYPERAI_RESOURCE_TYPE into hyperai-instance
christianversloot Jan 30, 2024
da2877c
Rename ip_address into hostname
christianversloot Jan 30, 2024
906e591
Update src/zenml/integrations/hyperai/service_connectors/hyperai_serv…
christianversloot Jan 30, 2024
fc0e473
Merge branch 'hyperai-integration' of github.com:christianversloot/ze…
christianversloot Jan 30, 2024
57f2c92
Raise AuthorizationException if client cannot be created
christianversloot Jan 30, 2024
ce40f59
Remove RuntimeError in two places because it will never arrive in tha…
christianversloot Jan 30, 2024
ae7b069
Remove try/catch statement
christianversloot Jan 30, 2024
20709ff
Let exception fall through if applicable
christianversloot Jan 30, 2024
0cd8518
Remove raises
christianversloot Jan 30, 2024
e5f49a3
Add warning hint about long-lived credentials
christianversloot Jan 30, 2024
c1357bf
Renames in docs based on changes
christianversloot Jan 30, 2024
a2e54b9
Add missing io import
christianversloot Jan 30, 2024
9df4546
Formatting
christianversloot Jan 30, 2024
d821ef1
Add automatic_cleanup_pipeline_files to HyperAIOrchestratorConfig
christianversloot Jan 30, 2024
28fd86c
Remove redundant variable assignment
christianversloot Jan 30, 2024
7101b14
Clean only if users configure auto cleaning
christianversloot Jan 30, 2024
2b4c546
Update docs
christianversloot Jan 30, 2024
4a9b9e5
Work in progress: multi IP service connector
christianversloot Jan 30, 2024
da3b453
Resources
christianversloot Jan 30, 2024
7960c8b
Append hostname instead
christianversloot Jan 30, 2024
50ef923
Omit assigning value
christianversloot Jan 30, 2024
74052d0
Rename config value
christianversloot Jan 30, 2024
b9cc6b8
Ensure that hostname is passed to Paramiko client
christianversloot Jan 30, 2024
6ca8b97
Raise NotImplementedError instead of pass value
christianversloot Jan 30, 2024
8a55572
Formatting
christianversloot Jan 30, 2024
4ad6d79
Changes to _verify
christianversloot Jan 30, 2024
230f95c
Reflect changes in service connector docs
christianversloot Jan 30, 2024
08914a2
Fix connector value validation to allow arrays to be used with the CLI
stefannica Jan 30, 2024
90efa46
Merge branch 'hyperai-integration' of github.com:christianversloot/ze…
christianversloot Jan 30, 2024
0f9538c
Reflect changes in orchestrator docs
christianversloot Jan 30, 2024
421f53a
Fix connector verification to allow the multi-instance case
stefannica Jan 30, 2024
4141425
Merge branch 'hyperai-integration' of github.com:christianversloot/ze…
stefannica Jan 30, 2024
7bb3405
Ensure that pipelines can run when scheduled by setting run ID dynami…
christianversloot Jan 31, 2024
79aef22
Reformatting
christianversloot Jan 31, 2024
a92dd21
Add information about scheduled pipelines to docs
christianversloot Jan 31, 2024
82375fa
Merge branch 'develop' into hyperai-integration
strickvl Jan 31, 2024
93d58a9
Merge branch 'develop' into hyperai-integration
christianversloot Feb 1, 2024
31d0a28
Use service connector username to create Compose files on instance
christianversloot Feb 1, 2024
ebf8f69
Add GPU reservation if configured that way
christianversloot Feb 1, 2024
88f07c9
Formatting
christianversloot Feb 1, 2024
e7d0575
Add instruction
christianversloot Feb 1, 2024
f35882c
Add prerequisites for HyperAI instance
christianversloot Feb 2, 2024
e48632b
Merge branch 'develop' into hyperai-integration
christianversloot Feb 2, 2024
c20f9c5
Merge branch 'develop' into hyperai-integration
christianversloot Feb 2, 2024
a43baed
Formatting and docstrings
christianversloot Feb 3, 2024
5c6c887
Merge branch 'hyperai-integration' of github.com:christianversloot/ze…
christianversloot Feb 3, 2024
aa25e21
Fixed remaining linter errors
stefannica Feb 5, 2024
d75ece0
Applied review suggestions
stefannica Feb 5, 2024
7a1bf4b
Add paramiko to API docs mocks
stefannica Feb 5, 2024
bc96c84
HyperAI orchestrator config tests; make additional assertions availab…
christianversloot Feb 5, 2024
d0be24c
Remove GPU-based Dockerfile
christianversloot Feb 5, 2024
45cc0d4
Merge branch 'develop' into hyperai-integration
strickvl Feb 5, 2024
8147575
Ensure that shell commands are escaped when used
christianversloot Feb 5, 2024
e1bc7d0
Provide password to stdin differently
christianversloot Feb 5, 2024
6e680bf
Escape case where file cannot be written to HyperAI instance
christianversloot Feb 5, 2024
fe026f4
Escape inputs differently
christianversloot Feb 5, 2024
cd16e76
Use network mode host to avoid non-overlapping IPv4 network pool error
christianversloot Feb 5, 2024
b4278cb
Disable security check for paramiko auto-add-policy
stefannica Feb 5, 2024
12231d4
Changes to escaping
christianversloot Feb 5, 2024
05debc3
Merge branch 'hyperai-integration' of github.com:christianversloot/ze…
christianversloot Feb 5, 2024
67ea70e
Merge branch 'develop' into hyperai-integration
christianversloot Feb 5, 2024
2a134aa
Silenced remaining security issues and fixed remaining linter errors
stefannica Feb 5, 2024
a7be14c
Merge branch 'hyperai-integration' of github.com:christianversloot/ze…
stefannica Feb 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ types-certifi = { version = "^2021.10.8.0", optional = true }
types-croniter = { version = "^1.0.2", optional = true }
types-futures = { version = "^3.3.1", optional = true }
types-Markdown = { version = "^3.3.6", optional = true }
types-paramiko = { version = ">=3.4.0", optional = true }
types-Pillow = { version = "^9.2.1", optional = true }
types-protobuf = { version = "^3.18.0", optional = true }
types-PyMySQL = { version = "^1.0.4", optional = true }
Expand Down Expand Up @@ -232,6 +233,7 @@ dev = [
"types-croniter",
"types-futures",
"types-Markdown",
"types-paramiko",
"types-Pillow",
"types-protobuf",
"types-PyMySQL",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def get_orchestrator_run_id(self) -> str:
f"{ENV_ZENML_HYPERAI_RUN_ID}."
)

def _validate_mount_path(self, path) -> str:
def _validate_mount_path(self, path: str) -> str:
"""Validates if a given string is in a valid path format.

Args:
Expand Down Expand Up @@ -144,8 +144,12 @@ def prepare_or_run_pipeline(
Raises:
RuntimeError: If a step fails.
"""
from zenml.integrations.hyperai.service_connectors.hyperai_service_connector import (
HyperAIServiceConnector,
)

# Basic Docker Compose definition
compose_definition = {"version": "3", "services": {}}
compose_definition: Dict[str, Any] = {"version": "3", "services": {}}

# Get deployment id
deployment_id = deployment.id
Expand Down Expand Up @@ -226,7 +230,7 @@ def prepare_or_run_pipeline(

# Convert into yaml
logger.info("Finalizing Docker Compose definition.")
compose_definition = yaml.dump(compose_definition)
compose_definition_yaml = yaml.dump(compose_definition)
stefannica marked this conversation as resolved.
Show resolved Hide resolved

# Connect to configured HyperAI instance
logger.info(
Expand Down Expand Up @@ -271,22 +275,27 @@ def prepare_or_run_pipeline(
)

# Get container registry credentials from its config
container_registry_url = container_registry.config.uri
(
container_registry_username,
container_registry_password,
) = container_registry.credentials

# Log in to container registry using --password-stdin
stdin, stdout, stderr = paramiko_client.exec_command(
f"docker login -u {container_registry_username} --password-stdin {container_registry_url} <<< {container_registry_password}"
)
credentials = container_registry.credentials
if credentials is not None:
stefannica marked this conversation as resolved.
Show resolved Hide resolved
container_registry_url = container_registry.config.uri
(
container_registry_username,
container_registry_password,
) = credentials

# Log in to container registry using --password-stdin
_, stdout, stderr = paramiko_client.exec_command(
f"docker login -u {container_registry_username} "
f"--password-stdin {container_registry_url} <<< "
f"{container_registry_password}"
)

# Log stdout
for line in stdout.readlines():
logger.info(line)
# Log stdout
for line in stdout.readlines():
logger.info(line)

# Get username from connector
assert isinstance(connector, HyperAIServiceConnector)
username = connector.config.username

# Set up pipeline-runs directory if it doesn't exist
Expand Down Expand Up @@ -320,7 +329,7 @@ def prepare_or_run_pipeline(
with tempfile.NamedTemporaryFile(mode="w", delete=True) as f:
# Write Docker Compose file to temporary file
with f.file as f_:
f_.write(compose_definition)
f_.write(compose_definition_yaml)

# Scp Docker Compose file to HyperAI instance
scp_client = paramiko_client.open_sftp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""
import base64
import io
from typing import Any, List, Optional
from typing import Any, List, Optional, Type

import paramiko
from pydantic import Field, SecretStr
Expand Down Expand Up @@ -167,7 +167,7 @@ def _get_connector_type(cls) -> ServiceConnectorTypeModel:
"""
return HYPERAI_SERVICE_CONNECTOR_TYPE_SPEC

def _paramiko_key_type_given_auth_method(self) -> paramiko.PKey:
def _paramiko_key_type_given_auth_method(self) -> Type[paramiko.PKey]:
"""Get the Paramiko key type given the authentication method.

Returns:
Expand Down
Loading