Skip to content

Commit

Permalink
chore: use setters; removes deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney authored and robertbartel committed Jan 25, 2024
1 parent a725d13 commit 7871395
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions python/lib/scheduler/dmod/test/test_JobImpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_job_id_1_a(self):

self.assertNotEqual(job.job_id, uuid_as_str)

job.job_id = uuid_val
job.set_job_id(uuid_val)

self.assertEqual(job.job_id, uuid_as_str)

Expand All @@ -68,7 +68,7 @@ def test_job_id_1_b(self):
job = self._example_jobs[example_index]
initial_last_updated = job.last_updated

job.job_id = uuid_val
job.set_job_id(uuid_val)

self.assertLess(initial_last_updated, job.last_updated)

Expand All @@ -81,7 +81,7 @@ def test_job_id_1_c(self):

self.assertNotEqual(job.job_id, uuid_as_str)

job.job_id = uuid_as_str
job.set_job_id(uuid_as_str)

self.assertEqual(job.job_id, uuid_as_str)

Expand All @@ -93,7 +93,7 @@ def test_job_id_1_d(self):
job = self._example_jobs[example_index]
initial_last_updated = job.last_updated

job.job_id = uuid_as_str
job.set_job_id(uuid_as_str)

self.assertLess(initial_last_updated, job.last_updated)

Expand Down Expand Up @@ -142,7 +142,7 @@ def test_allocations_1_a(self):
job = self._example_jobs[example_index_job]

self.assertIsNone(job.allocations)
job.allocations = allocations
job.set_allocations(allocations)
self.assertIsNotNone(job.allocations)

# Test that allocation setter works with tuple
Expand All @@ -155,7 +155,7 @@ def test_allocations_1_b(self):
job = self._example_jobs[example_index_job]

self.assertIsNone(job.allocations)
job.allocations = allocations
job.set_allocations(allocations)
self.assertIsNotNone(job.allocations)

# Test that allocation setter works correctly with list
Expand All @@ -166,7 +166,7 @@ def test_allocations_1_c(self):
allocation = self._resource_allocations[example_index_allocation]
allocations = [allocation]
job = self._example_jobs[example_index_job]
job.allocations = allocations
job.set_allocations(allocations)
self.assertEqual(len(allocations), len(job.allocations))
for i in range(len(allocations)):
self.assertEqual(allocations[i], job.allocations[i])
Expand All @@ -179,7 +179,7 @@ def test_allocations_1_d(self):
allocation = self._resource_allocations[example_index_allocation]
allocations = (allocation,)
job = self._example_jobs[example_index_job]
job.allocations = allocations
job.set_allocations(allocations)
self.assertEqual(len(allocations), len(job.allocations))
for i in range(len(allocations)):
self.assertEqual(allocations[i], job.allocations[i])
Expand All @@ -193,7 +193,7 @@ def test_allocations_1_e(self):
allocations = [allocation]
job = self._example_jobs[example_index_job]
initial_last_updated = job.last_updated
job.allocations = allocations
job.set_allocations(allocations)
self.assertLess(initial_last_updated, job.last_updated)

# Test that allocation setter updates last_updated correctly with tuple
Expand All @@ -206,7 +206,7 @@ def test_allocations_1_f(self):
job = self._example_jobs[example_index_job]
initial_last_updated = job.last_updated

job.allocations = allocations
job.set_allocations(allocations)
self.assertLess(initial_last_updated, job.last_updated)

# TODO: add tests for rest of setters that should update last_updated property
Expand Down
4 changes: 2 additions & 2 deletions python/lib/scheduler/dmod/test/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def setUp(self) -> None:
allocation_paradigm='SINGLE_NODE')
ex_job = RequestedJob(sch_req)
alloc = ResourceAllocation('1', 'hostname1', cpu_count, mem_size)
ex_job.allocations = [alloc]
ex_job.set_allocations([alloc])
self._example_jobs.append(ex_job)

# Example 2 - with two node allocated with 4 cpus
Expand Down Expand Up @@ -96,7 +96,7 @@ def setUp(self) -> None:
allocs = []
allocs.append(ResourceAllocation('1', 'hostname1', 2, int(mem_size/2)))
allocs.append(ResourceAllocation('2', 'hostname2', 2, int(mem_size/2)))
ex_job.allocations = allocs
ex_job.set_allocations(allocs)
self._example_jobs.append(ex_job)


Expand Down

0 comments on commit 7871395

Please sign in to comment.