From: Michael Tremer Date: Tue, 21 Jun 2022 10:01:14 +0000 (+0000) Subject: jobs: Drop restarting jobs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b0a900b0b042dd976c146eabdfffed99f4ab17f;p=pbs.git jobs: Drop restarting jobs Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 84ee7c53..e24f6ac5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -172,8 +172,6 @@ dist_templates_DATA = \ src/templates/index.html \ src/templates/jobs-abort.html \ src/templates/jobs-buildroot.html \ - src/templates/job-schedule-rebuild.html \ - src/templates/job-schedule-test.html \ src/templates/keys-delete.html \ src/templates/keys-import.html \ src/templates/keys-list.html \ diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index 6f254ece..54c1dade 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -67,25 +67,6 @@ class Jobs(base.Object): return jobs - def restart_failed(self): - jobs = self._get_jobs("SELECT jobs.* FROM jobs \ - JOIN builds ON builds.id = jobs.build_id \ - WHERE \ - jobs.type = 'build' AND \ - jobs.state = 'failed' AND \ - NOT builds.state = 'broken' AND \ - jobs.time_finished < NOW() - '72 hours'::interval \ - ORDER BY \ - CASE \ - WHEN jobs.type = 'build' THEN 0 \ - WHEN jobs.type = 'test' THEN 1 \ - END, \ - builds.priority DESC, jobs.time_created ASC") - - # Restart the job - for job in jobs: - job.restart() - class Job(base.DataObject): table = "jobs" @@ -261,16 +242,6 @@ class Job(base.DataObject): # Notify users self.send_failed_message() - def restart(self, test=None, start_not_before=None): - # Copy the job and let it build again - job = self.backend.jobs.create(self.build, self.arch, - test=test or self.test, superseeds=self) - - if start_not_before: - job.start_not_before = start_not_before - - return job - def is_active(self): """ Returns True if this job is active diff --git a/src/scripts/pakfire-build-service b/src/scripts/pakfire-build-service index 9a13ceb6..13cb06a0 100644 --- a/src/scripts/pakfire-build-service +++ b/src/scripts/pakfire-build-service @@ -44,9 +44,6 @@ class Cli(object): # Remaster Repositories "remaster-repositories" : self.backend.repos.remaster, - # Restart failed jobs - "restart-failed-jobs" : self.backend.jobs.restart_failed, - # Send bug updates to Bugzilla "send-bug-updates" : self.backend.bugzilla.send_all, diff --git a/src/templates/job-schedule-rebuild.html b/src/templates/job-schedule-rebuild.html deleted file mode 100644 index 079c16b4..00000000 --- a/src/templates/job-schedule-rebuild.html +++ /dev/null @@ -1,44 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Schedule rebuild for %s") % job.name }}{% end block %} - -{% block body %} - - - - -
-
-

- {{ _("At this place, you can submit failed build jobs to be built again.") }} -

-

- {{ _("The build job will be started when a build slot is available but not before the given time.") }} -

- - {% module BuildOffset() %} -
-
-{% end block %} diff --git a/src/templates/job-schedule-test.html b/src/templates/job-schedule-test.html deleted file mode 100644 index 4d076d93..00000000 --- a/src/templates/job-schedule-test.html +++ /dev/null @@ -1,50 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Schedule test build for %s") % job.name }}{% end block %} - -{% block body %} - - - - -
-
-

- {{ _("A test build is used to check if a package builds with the current package set.") }} - {{ _("In this way, developers are able to find quality issues fast and without actively searching for them.") }} -

-

- {{ _("As this build platform only has a limited amount of performance, test builds only have a very less priority.") }} - {{ _("However, you can manually request to run a test.") }} -

-

- {{ _("The build job will be started when a build slot is available but not before the given time.") }} - {{ _("Please note, that all other kinds of build are preferred over the test builds.") }} -

- - {% module BuildOffset() %} -
-
-{% end block %} diff --git a/src/web/__init__.py b/src/web/__init__.py index d3e66422..7663b2e0 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -147,7 +147,6 @@ class Application(tornado.web.Application): # Jobs (r"/job/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/abort", jobs.JobAbortHandler), (r"/job/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/buildroot", jobs.JobBuildrootHandler), - (r"/job/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/schedule", jobs.JobScheduleHandler), # Builders (r"/builders", builders.BuilderListHandler), diff --git a/src/web/jobs.py b/src/web/jobs.py index 421314b2..4b412057 100644 --- a/src/web/jobs.py +++ b/src/web/jobs.py @@ -31,45 +31,6 @@ class JobBuildrootHandler(base.BaseHandler): buildroot_size=buildroot_size) -class JobScheduleHandler(base.BaseHandler): - allowed_types = ("test", "rebuild",) - - @tornado.web.authenticated - def get(self, uuid): - type = self.get_argument("type") - assert type in self.allowed_types - - job = self.backend.jobs.get_by_uuid(uuid) - if not job: - raise tornado.web.HTTPError(404, "Job not found: %s" % uuid) - - self.render("job-schedule-%s.html" % type, type=type, job=job, build=job.build) - - @tornado.web.authenticated - def post(self, uuid): - type = self.get_argument("type") - assert type in self.allowed_types - - job = self.backend.jobs.get_by_uuid(uuid) - if not job: - raise tornado.web.HTTPError(404, "Job not found: %s" % uuid) - - # Get the start offset. - offset = self.get_argument("offset", 0) - try: - offset = int(offset) - except TypeError: - offset = 0 - - # Is this supposed to be a test job? - test = (type == "test") - - with self.db.transaction(): - new_job = job.restart(test=test) - - self.redirect("/job/%s" % new_job.uuid) - - class JobAbortHandler(base.BaseHandler): def get_job(self, uuid): job = self.backend.jobs.get_by_uuid(uuid)