コード例 #1
0
def test_sge_host_parsing(sge_host_xml, expected_output, test_datadir):
    host_xml = read_text(test_datadir / sge_host_xml)
    sge_host = SgeHost.from_xml(host_xml)
    assert_that(sge_host).is_equal_to(expected_output)
コード例 #2
0
from assertpy import assert_that
from common.schedulers.sge_commands import SGE_HOLD_STATE, SgeHost, SgeJob
from nodewatcher.plugins.sge import hasJobs, hasPendingJobs, is_node_down


@pytest.mark.parametrize(
    "hostname, compute_nodes_output, expected_result",
    [
        (
            "ip-10-0-0-166",
            {
                "ip-10-0-0-166.eu-west-1.compute.internal":
                SgeHost(
                    name="ip-10-0-0-166.eu-west-1.compute.internal",
                    slots_total=4,
                    slots_used=0,
                    slots_reserved=0,
                    state="",
                    jobs=[],
                )
            },
            False,
        ),
        (
            "ip-10-0-0-166",
            {
                "ip-10-0-0-166":
                SgeHost(name="ip-10-0-0-166",
                        slots_total=4,
                        slots_used=0,
                        slots_reserved=0,
                        state="",
コード例 #3
0
from sqswatcher.sqswatcher import Host
from tests.common import read_text


@pytest.mark.parametrize(
    "qstat_mocked_response, expected_output",
    [
        (
            "qstat_output_mix.xml",
            {
                "ip-10-0-0-166.eu-west-1.compute.internal": SgeHost(
                    name="ip-10-0-0-166.eu-west-1.compute.internal",
                    slots_total=4,
                    slots_used=3,
                    slots_reserved=0,
                    state="",
                    jobs=[
                        SgeJob(number="89", slots=1, state="r", node_type="MASTER", array_index=None, hostname=None),
                        SgeJob(number="89", slots=1, state="r", node_type="SLAVE", array_index=None, hostname=None),
                        SgeJob(number="91", slots=1, state="r", node_type="MASTER", array_index=3, hostname=None),
                    ],
                ),
                "ip-10-0-0-52.eu-west-1.compute.internal": SgeHost(
                    name="ip-10-0-0-52.eu-west-1.compute.internal",
                    slots_total=8,
                    slots_used=0,
                    slots_reserved=0,
                    state="d",
                    jobs=[],
                ),
                "ip-10-0-0-116.eu-west-1.compute.internal": SgeHost(
                    name="ip-10-0-0-116.eu-west-1.compute.internal",
コード例 #4
0
import pytest

from assertpy import assert_that
from common.schedulers.sge_commands import SGE_HOLD_STATE, SgeHost, SgeJob
from jobwatcher.plugins.sge import get_busy_nodes, get_required_nodes


@pytest.mark.parametrize(
    "cluster_nodes, expected_busy_nodes",
    [
        (
            {
                "ip-10-0-0-166.eu-west-1.compute.internal": SgeHost(
                    name="ip-10-0-0-166.eu-west-1.compute.internal",
                    slots_total=4,
                    slots_used=3,
                    slots_reserved=0,
                    state="",
                    jobs=[SgeJob(number="89", slots=1, state="r", node_type="MASTER", array_index=None, hostname=None)],
                )
            },
            1,
        ),
        (
            {
                "ip-10-0-0-166.eu-west-1.compute.internal": SgeHost(
                    name="ip-10-0-0-166.eu-west-1.compute.internal",
                    slots_total=4,
                    slots_used=0,
                    slots_reserved=0,
                    state="u",
                    jobs=[],