Skip to content

Commit 56c36e2

Browse files
authored
In test_terasort: Check if the hdfs-delete-terasort-files job exists before adding it. (apache#150)
1 parent 9e39e5b commit 56c36e2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_soak.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,18 @@ def _delete_hdfs_terasort_files():
5959
job_name = 'hdfs-delete-terasort-files'
6060
LOGGER.info("Deleting hdfs terasort files by running job {}".format(job_name))
6161
metronome_client = dcos.metronome.create_client()
62-
_add_job(metronome_client, job_name)
62+
if not _job_exists(metronome_client, job_name):
63+
_add_job(metronome_client, job_name)
6364
_run_job_and_wait(metronome_client, job_name, timeout_seconds=300)
6465
metronome_client.remove_job(job_name)
6566
LOGGER.info("Job {} completed".format(job_name))
6667

6768

69+
def _job_exists(metronome_client, job_name):
70+
jobs = metronome_client.get_jobs()
71+
return any(job['id'] == job_name for job in jobs)
72+
73+
6874
def _add_job(metronome_client, job_name):
6975
jobs_folder = os.path.join(
7076
os.path.dirname(os.path.realpath(__file__)), 'jobs', 'json'

0 commit comments

Comments
 (0)