Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove batch-job cleanup from jenkins_generic_job #1812

Merged
merged 1 commit into from
Sep 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions cime/scripts/lib/jenkins_generic_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@

import os, shutil, glob, signal, logging

###############################################################################
def cleanup_queue(set_of_jobs_we_created):
###############################################################################
"""
Delete all jobs left in the queue
"""
current_jobs = set(CIME.utils.get_my_queued_jobs())
jobs_to_delete = set_of_jobs_we_created & current_jobs

if (jobs_to_delete):
logging.warning("Found leftover batch jobs that need to be deleted: %s" % ", ".join(jobs_to_delete))
success = CIME.utils.delete_jobs(jobs_to_delete)
if not success:
logging.warning("FAILED to clean up leftover jobs!")

###############################################################################
def jenkins_generic_job(generate_baselines, submit_to_cdash, no_batch,
baseline_name,
Expand Down Expand Up @@ -79,14 +64,6 @@ def jenkins_generic_job(generate_baselines, submit_to_cdash, no_batch,
else:
os.remove(old_file)

#
# Make note of things already in the queue so we know not to delete
# them if we timeout
#
preexisting_queued_jobs = []
if (use_batch):
preexisting_queued_jobs = CIME.utils.get_my_queued_jobs()

#
# Set up create_test command and run it
#
Expand Down Expand Up @@ -120,16 +97,6 @@ def jenkins_generic_job(generate_baselines, submit_to_cdash, no_batch,
expect(create_test_stat in [0, CIME.utils.TESTS_FAILED_ERR_CODE, -signal.SIGTERM],
"Create_test script FAILED with error code '%d'!" % create_test_stat)

if (use_batch):
# This is not fullproof. Any jobs that happened to be
# submitted by this user while create_test was running will be
# potentially deleted. This is still a big improvement over the
# previous implementation which just assumed all queued jobs for this
# user came from create_test.
# TODO: change this to probe test_root for jobs ids
#
our_jobs = set(CIME.utils.get_my_queued_jobs()) - set(preexisting_queued_jobs)

#
# Wait for tests
#
Expand All @@ -152,8 +119,5 @@ def jenkins_generic_job(generate_baselines, submit_to_cdash, no_batch,
cdash_build_name=cdash_build_name,
cdash_project=cdash_project,
cdash_build_group=cdash_build_group)
if (not tests_passed and use_batch and CIME.wait_for_tests.SIGNAL_RECEIVED):
# Cleanup
cleanup_queue(our_jobs)

return tests_passed