]> git.ipfire.org Git - pbs.git/commitdiff
jobs: Drop the control connection
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Feb 2025 11:46:31 +0000 (11:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Feb 2025 11:46:31 +0000 (11:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/__init__.py
src/web/jobs.py

index 65d3f8f4bd1aef9e885e1a755b368668483a862e..f341c9113aa7978127ea5c8115e9db965046b99c 100644 (file)
@@ -114,8 +114,6 @@ class Application(tornado.web.Application):
                        (r"/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/abort", jobs.AbortHandler),
                        (r"/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/log", jobs.LogHandler),
                        (r"/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/retry", jobs.RetryHandler),
-                       (r"/api/v1/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})",
-                               jobs.APIv1ControlHandler),
                        (r"/api/v1/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})", jobs.APIv1IndexHandler),
                        (r"/api/v1/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/crashed",
                                jobs.APIv1CrashedHandler),
index 05f69ffc023a50d748fdf925326e76368acaefb3..6c609a402a13304a16a9e85d90c59ed8f18a56a3 100644 (file)
@@ -10,61 +10,6 @@ from . import base
 # Setup logging
 log = logging.getLogger("pbs.web.jobs")
 
-class APIv1ControlHandler(base.APIMixin, base.BackendMixin, tornado.websocket.WebSocketHandler):
-       """
-               Builders connect to this handler when they are running a build.
-
-               We can pass information about this build around in real time.
-       """
-       # Don't allow users to authenticate
-       allow_users = False
-
-       @base.negotiate
-       async def open(self, job_id):
-               self.job = await self.backend.jobs.get_by_uuid(job_id)
-               if not self.job:
-                       raise tornado.web.HTTPError(404, "Could not find job %s" % job_id)
-
-               # Check permissions
-               if not self.job.has_perm(self.current_user):
-                       raise tornado.web.HTTPError(403, "%s cannot control job %s" \
-                               % (self.current_user, self.job))
-
-               # Consider the job connected
-               self.job.connected(self)
-
-               # Open a new log stream
-               self.logstream = self.backend.logstreams.open(self.job)
-
-       def on_close(self):
-               # Drop the connection to the builder
-               self.job.disconnected()
-
-               # Close the logstream
-               self.logstream.close()
-
-       async def on_message(self, message):
-               message = self._decode_json_message(message)
-
-               # Get message type & data
-               type = message.get("type")
-               data = message.get("data")
-
-               # Handle log messages
-               if type == "log":
-                       await self._handle_log(**data)
-
-               # Unknown message
-               else:
-                       log.warning("Received a message of an unknown type: %s" % t)
-
-       async def _handle_log(self, timestamp=None, level=None, message=None, **kwargs):
-               """
-                       Called when a new log message has been received
-               """
-               await self.logstream.message(timestamp, level, message)
-
-
 class APIv1IndexHandler(base.APIMixin, tornado.web.RequestHandler):
        @base.negotiate
        async def post(self, uuid):