Skip to content

Commit ad7cf32

Browse files
committed
Add id to CloudNode
1 parent 77828df commit ad7cf32

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

citc/aws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def from_response(cls: Type["AwsNode"], response) -> "AwsNode":
6969

7070
ip = response["PrivateIpAddress"]
7171

72-
return cls(name=name, state=node_state, ip=ip)
72+
return cls(name=name, state=node_state, ip=ip, id=response["InstanceId"])
7373

7474
@classmethod
7575
def all(cls, client: EC2Client, nodespace: dict):

citc/cloud.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ class CloudNode(ABC):
3636
name: str
3737
state: NodeState
3838
ip: str
39+
id: str
3940

40-
def __init__(self, name, state, ip):
41+
def __init__(self, name, state, ip, id):
4142
self.name = name
4243
self.state = state
4344
self.ip = ip
45+
self.id = id
4446

4547
@classmethod
4648
@abstractmethod

citc/google.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def from_response(cls: Type["GoogleNode"], response) -> "GoogleNode":
7676

7777
ip = response["networkInterfaces"][0]["networkIP"]
7878

79-
return cls(name=name, state=node_state, ip=ip)
79+
return cls(name=name, state=node_state, ip=ip, id=response["id"])
8080

8181
@classmethod
8282
def all(cls, client, nodespace: dict):

citc/oracle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def from_response(
6464
)
6565
ip = virtual_network_client.get_vnic(vnic_id).data.private_ip
6666

67-
return cls(name=name, state=node_state, ip=ip)
67+
return cls(name=name, state=node_state, ip=ip, id=node_id)
6868

6969
@classmethod
7070
def all(cls, config, nodespace: dict):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mypy = "^0.782"
2323
flake8 = "^3.7.9"
2424
moto = "^1.3.15"
2525
coverage = "^5.0.3"
26-
mebula = {version = "^0.2.6", allow-prereleases = true, extras = ["azure", "google", "oracle"]}
26+
mebula = {version = "^0.2.7", allow-prereleases = true, extras = ["azure", "google", "oracle"]}
2727

2828
[tool.poetry.scripts]
2929
watchdog = 'citc.watchdog:main'

tests/test_list_nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_create_table():
1111
SlurmNode(name="foo-1", state="idle", state_flag=None, features={}, reason=""),
1212
SlurmNode(name="foo-2", state="idle", state_flag="~", features={}, reason=""),
1313
]
14-
cloud_nodes = [AwsNode(name="foo-1", state=NodeState.RUNNING, ip="10.0.0.25")]
14+
cloud_nodes = [AwsNode(name="foo-1", state=NodeState.RUNNING, ip="10.0.0.25", id="i-foobar")]
1515
table, headers = create_table(slurm_nodes, cloud_nodes)
1616
assert table == [
1717
["foo-1", "idle", "", NodeState.RUNNING],
@@ -24,6 +24,6 @@ def test_print_table():
2424
slurm_nodes = [
2525
SlurmNode(name="foo-1", state="idle", state_flag=None, features={}, reason="")
2626
]
27-
cloud_nodes = [AwsNode(name="foo-1", state=NodeState.RUNNING, ip="10.0.0.25")]
27+
cloud_nodes = [AwsNode(name="foo-1", state=NodeState.RUNNING, ip="10.0.0.25", id="i-foobar")]
2828
table_data = create_table(slurm_nodes, cloud_nodes)
2929
print(tabulate(table_data))

tests/test_watchdog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_crosscheck_one_match():
1717
slurm_nodes = [
1818
SlurmNode(name="foo-1", state="idle", state_flag=None, features={}, reason="")
1919
]
20-
cloud_nodes = [AwsNode(name="foo-1", state=NodeState.RUNNING, ip="10.0.0.25")]
20+
cloud_nodes = [AwsNode(name="foo-1", state=NodeState.RUNNING, ip="10.0.0.25", id="i-foobar")]
2121

2222
res = crosscheck(slurm_nodes, cloud_nodes)
2323
res = list(res)

0 commit comments

Comments
 (0)