Skip to content

Commit

Permalink
fixing ssh port
Browse files Browse the repository at this point in the history
  • Loading branch information
kessler-frost committed Feb 13, 2024
1 parent 7e647f0 commit 17cf1f2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/docker_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

- name: Start the SLURM cluster container
run: |
docker run -d --name slurm-container slurm_test:latest
docker run -d -p 22:2222 --name slurm-container slurm_test:latest
docker exec slurm-container chmod +r /etc/slurm/slurm.conf
- name: Run a basic covalent test
Expand Down
5 changes: 5 additions & 0 deletions covalent_slurm_plugin/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ExecutorPluginDefaults(BaseModel):
Path.home() / ".config/covalent/executor_plugins/covalent-slurm-cache"
)
ignore_versions: bool = False
ssh_port: Optional[int] = 22


_EXECUTOR_PLUGIN_DEFAULTS = ExecutorPluginDefaults().model_dump()
Expand Down Expand Up @@ -112,6 +113,7 @@ class SlurmExecutor(AsyncBaseExecutor):
time_limit: time limit for the task
retries: Number of times to retry execution upon failure
ignore_versions: Whether to ignore the Python, Covalent, and Cloudpickle version mismatch on the remote machine and try running the task anyway. Default is False.
ssh_port: Port number to use for SSH connection. Default is 22.
"""

def __init__(
Expand Down Expand Up @@ -141,6 +143,7 @@ def __init__(
time_limit: int = -1,
retries: int = 0,
ignore_versions: bool = None,
ssh_port: int = 22,
):
super().__init__(
log_stdout=log_stdout, log_stderr=log_stderr, time_limit=time_limit, retries=retries
Expand All @@ -164,6 +167,7 @@ def __init__(
if ignore_versions is not None
else get_config("executors.slurm.ignore_versions")
)
self.ssh_port = ssh_port or get_config("executors.slurm.ssh_port")

# Resolve ssh_key_file and cert_file to absolute paths.
if self.ssh_key_file:
Expand Down Expand Up @@ -235,6 +239,7 @@ async def _client_connect(self) -> asyncssh.SSHClientConnection:
try:
conn = await asyncssh.connect(
self.address,
self.ssh_port,
username=self.username,
client_keys=client_keys,
known_hosts=None,
Expand Down
1 change: 1 addition & 0 deletions tests/docker_tests/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ssh_key_file="./slurm_test",
conda_env="covalent",
ignore_versions=True,
ssh_port=2222,
)


Expand Down

0 comments on commit 17cf1f2

Please sign in to comment.