Skip to content

Commit

Permalink
Merge pull request #89 from knopki/fix-abs-path-on-setup
Browse files Browse the repository at this point in the history
fix: remote config omitted on cloud node allocation
  • Loading branch information
blokhin authored Aug 16, 2022
2 parents 80197ee + f30eedc commit fb4c2f9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion yascheduler/clouds/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from asyncssh.public_key import SSHKey, generate_private_key, read_private_key
from attrs import asdict, define, field

from ..config import ConfigLocal, EngineRepository
from ..config import ConfigLocal, ConfigRemote, EngineRepository
from ..remote_machine import PRemoteMachine, RemoteMachine, SSHRetryExc
from .protocols import PCloudAdapter, PCloudAPI, PCloudConfig, TConfigCloud_contra
from .utils import get_rnd_name
Expand Down Expand Up @@ -47,6 +47,7 @@ class CloudAPI(PCloudAPI[TConfigCloud_contra]):
adapter: PCloudAdapter[TConfigCloud_contra] = field()
config: TConfigCloud_contra = field()
local_config: ConfigLocal = field()
remote_config: ConfigRemote = field()
engines: EngineRepository = field()
log: logging.Logger = field()
ssh_key_lock: asyncio.Lock = field(factory=asyncio.Lock)
Expand All @@ -62,6 +63,7 @@ async def create(
adapter: PCloudAdapter,
config: TConfigCloud_contra,
local_config: ConfigLocal,
remote_config: ConfigRemote,
engines: EngineRepository,
log: Optional[logging.Logger] = None,
ssh_key_lock: Optional[asyncio.Lock] = None,
Expand All @@ -76,6 +78,7 @@ async def create(
adapter=adapter,
config=config,
local_config=local_config,
remote_config=remote_config,
engines=engines,
log=log,
ssh_key_lock=ssh_key_lock or asyncio.Lock(),
Expand Down Expand Up @@ -143,6 +146,9 @@ async def mk_machine(self, ip_addr: str) -> PRemoteMachine:
client_keys=keys,
logger=self.log,
connect_timeout=self.adapter.create_node_conn_timeout,
data_dir=self.remote_config.data_dir,
engines_dir=self.remote_config.engines_dir,
tasks_dir=self.remote_config.tasks_dir,
jump_host=self.config.jump_host,
jump_username=self.config.jump_username,
)
Expand Down
4 changes: 3 additions & 1 deletion yascheduler/clouds/cloud_api_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from attrs import define, field
from typing_extensions import Self

from ..config import ConfigCloud, ConfigLocal, EngineRepository
from ..config import ConfigCloud, ConfigLocal, ConfigRemote, EngineRepository
from ..db import DB
from .adapters import azure_adapter, hetzner_adapter, upcloud_adapter
from .cloud_api import CloudAPI
Expand All @@ -32,6 +32,7 @@ async def create(
cls,
db: DB,
local_config: ConfigLocal,
remote_config: ConfigRemote,
cloud_configs: Sequence[ConfigCloud],
engines: EngineRepository,
log: Optional[logging.Logger] = None,
Expand Down Expand Up @@ -62,6 +63,7 @@ def filter_adapters(prefix: str):
adapter=adapter,
config=cfg,
local_config=local_config,
remote_config=remote_config,
engines=engines,
ssh_key_lock=ssh_key_lock,
log=log,
Expand Down
5 changes: 4 additions & 1 deletion yascheduler/clouds/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from attr import define
from typing_extensions import Protocol, Self

from ..config import ConfigCloud, ConfigLocal, EngineRepository
from ..config import ConfigCloud, ConfigLocal, ConfigRemote, EngineRepository
from ..db import DB

SupportedPlatformChecker = Callable[[str], bool]
Expand Down Expand Up @@ -103,6 +103,7 @@ class PCloudAPI(Protocol[TConfigCloud_contra]):
name: str
config: TConfigCloud_contra
local_config: ConfigLocal
remote_config: ConfigRemote
engines: EngineRepository
log: logging.Logger

Expand All @@ -113,6 +114,7 @@ async def create(
adapter: PCloudAdapter[TConfigCloud_contra],
config: TConfigCloud_contra,
local_config: ConfigLocal,
remote_config: ConfigRemote,
engines: EngineRepository,
ssh_key_lock: Optional[asyncio.Lock] = None,
log: Optional[logging.Logger] = None,
Expand Down Expand Up @@ -171,6 +173,7 @@ async def create(
cls,
db: DB,
local_config: ConfigLocal,
remote_config: ConfigRemote,
cloud_configs: Sequence[ConfigCloud],
engines: EngineRepository,
log: Optional[logging.Logger] = None,
Expand Down
1 change: 1 addition & 0 deletions yascheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ async def create(
clouds = await CloudAPIManager.create(
db=db,
local_config=cfg.local,
remote_config=cfg.remote,
cloud_configs=cfg.clouds,
engines=cfg.engines,
log=log,
Expand Down

0 comments on commit fb4c2f9

Please sign in to comment.