Skip to content

Commit

Permalink
Rename code_command.py to code.py, fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Normandin <[email protected]>
  • Loading branch information
lebrice committed Apr 18, 2024
1 parent 3fb0744 commit b970962
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 10 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion milatools/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from ..__version__ import __version__
from ..utils.local_v1 import LocalV1
from ..utils.remote_v1 import RemoteV1
from .code_command import add_mila_code_arguments
from .code import add_mila_code_arguments
from .common import forward, standard_server
from .init_command import (
print_welcome_message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pytest
from pytest_regressions.file_regression import FileRegressionFixture

from milatools.cli.code_command import code
from milatools.cli.code import code
from milatools.cli.common import check_disk_quota
from milatools.cli.utils import get_hostname_to_use_for_compute_node
from milatools.utils.compute_node import ComputeNode
Expand Down Expand Up @@ -103,24 +103,24 @@ async def get_job_info(
indirect=True,
)
async def test_code(
login_node: RemoteV2,
login_node_v2: RemoteV2,
persist: bool,
capsys: pytest.CaptureFixture,
allocation_flags: list[str],
file_regression: FileRegressionFixture,
slurm_account_on_cluster: str,
):
if login_node.hostname == "localhost":
if login_node_v2.hostname == "localhost":
pytest.skip(
"TODO: This test doesn't yet work with the slurm cluster spun up in the GitHub CI."
)

home = await login_node.get_output_async("echo $HOME")
scratch = await login_node.get_output_async("echo $SCRATCH")
home = await login_node_v2.get_output_async("echo $HOME")
scratch = await login_node_v2.get_output_async("echo $SCRATCH")

start = datetime.datetime.now() - timedelta(minutes=5)
jobs_before = get_recent_jobs_info_dicts(
login_node, since=datetime.datetime.now() - start
login_node_v2, since=datetime.datetime.now() - start
)
jobs_before = {
int(job_info["JobID"]): job_info
Expand All @@ -140,7 +140,7 @@ async def test_code(
job=None,
node=None,
alloc=allocation_flags,
cluster=login_node.hostname, # type: ignore
cluster=login_node_v2.hostname, # type: ignore
)

# Get the output that was printed while running that command.
Expand All @@ -162,12 +162,12 @@ async def test_code(

job_info = await get_job_info(
job_id=job_id,
login_node=login_node,
login_node=login_node_v2,
fields=("JobID", "JobName", "Node", "WorkDir", "State"),
)
if node_hostname is None:
node_hostname = get_hostname_to_use_for_compute_node(
job_info["Node"], cluster=login_node.hostname
job_info["Node"], cluster=login_node_v2.hostname
)
assert node_hostname and node_hostname != "None"

Expand Down

0 comments on commit b970962

Please sign in to comment.