Skip to content

Commit

Permalink
t/python: Add list inactive name filter test
Browse files Browse the repository at this point in the history
  • Loading branch information
chu11 committed Mar 14, 2020
1 parent 7ff77ea commit 7b577a2
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions t/python/t0013-job-list-inactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def setUpClass(self):
self.fh = flux.Flux()

@classmethod
def submitJob(self):
def submitJob(self, command=None):
if not command:
command = ["sleep", "0"]
compute_jobreq = JobspecV1.from_command(
command=["sleep", "0"], num_tasks=2, num_nodes=1, cores_per_task=1
command=command, num_tasks=2, num_nodes=1, cores_per_task=1
)
compute_jobreq.cwd = os.getcwd()
compute_jobreq.environment = dict(os.environ)
Expand Down Expand Up @@ -214,6 +216,29 @@ def test_09_middle_timestamp_2(self):

self.assertEqual(len(jobs_inactive), 7)

# flux job list-inactive with name filter
def test_10_name_filter(self):
# submit a bundle of hostname jobs
for i in range(5):
jobid = self.submitJob(["hostname"])

# 16 = 5 + 11 in previous tests
self.waitForConsistency(16)

rpc_handle = flux.job.job_list_inactive(self.fh, 0.0, 20, self.attrs, "sleep")

jobs_inactive = self.getJobs(rpc_handle)

self.assertEqual(len(jobs_inactive), 11)

rpc_handle = flux.job.job_list_inactive(
self.fh, 0.0, 20, self.attrs, "hostname"
)

jobs_inactive = self.getJobs(rpc_handle)

self.assertEqual(len(jobs_inactive), 5)


if __name__ == "__main__":
from subflux import rerun_under_flux
Expand Down

0 comments on commit 7b577a2

Please sign in to comment.