File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff 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+
6874def _add_job (metronome_client , job_name ):
6975 jobs_folder = os .path .join (
7076 os .path .dirname (os .path .realpath (__file__ )), 'jobs' , 'json'
You can’t perform that action at this time.
0 commit comments