コード例 #1
0
 def worker_cleanup(self, user_id, worker_id):
     """
     Deletes the worker and all associated data from the database as well
     as the socket directory.
     """
     with self._engine.begin() as conn:
         socket_rows = conn.execute(cl_worker_socket.select().where(
             and_(
                 cl_worker_socket.c.user_id == user_id,
                 cl_worker_socket.c.worker_id == worker_id,
             ))).fetchall()
         for socket_row in socket_rows:
             self._cleanup_socket(socket_row.socket_id)
         conn.execute(cl_worker_socket.delete().where(
             and_(
                 cl_worker_socket.c.user_id == user_id,
                 cl_worker_socket.c.worker_id == worker_id,
             )))
         conn.execute(cl_worker_run.delete().where(
             and_(cl_worker_run.c.user_id == user_id,
                  cl_worker_run.c.worker_id == worker_id)))
         conn.execute(cl_worker_dependency.delete().where(
             and_(
                 cl_worker_dependency.c.user_id == user_id,
                 cl_worker_dependency.c.worker_id == worker_id,
             )))
         conn.execute(cl_worker.delete().where(
             and_(cl_worker.c.user_id == user_id,
                  cl_worker.c.worker_id == worker_id)))
コード例 #2
0
 def worker_cleanup(self, user_id, worker_id):
     """
     Deletes the worker and all associated data from the database as well
     as the socket directory.
     """
     with self._engine.begin() as conn:
         socket_rows = conn.execute(
             cl_worker_socket.select()
                 .where(and_(cl_worker_socket.c.user_id == user_id,
                             cl_worker_socket.c.worker_id == worker_id))
         ).fetchall()
         for socket_row in socket_rows:
             self._cleanup_socket(socket_row.socket_id)
         conn.execute(cl_worker_socket.delete()
                      .where(and_(cl_worker_socket.c.user_id == user_id,
                                  cl_worker_socket.c.worker_id == worker_id)))   
         conn.execute(cl_worker_run.delete()
                      .where(and_(cl_worker_run.c.user_id == user_id,
                                  cl_worker_run.c.worker_id == worker_id)))      
         conn.execute(cl_worker_dependency.delete()
                      .where(and_(cl_worker_dependency.c.user_id == user_id,
                                  cl_worker_dependency.c.worker_id == worker_id)))      
         conn.execute(cl_worker.delete()
                      .where(and_(cl_worker.c.user_id == user_id,
                                  cl_worker.c.worker_id == worker_id)))
コード例 #3
0
 def deallocate_socket(self, socket_id):
     """
     Cleans up the socket, removing the associated file in the socket
     directory.
     """
     self._cleanup_socket(socket_id)
     with self._engine.begin() as conn:
         conn.execute(cl_worker_socket.delete().where(cl_worker_socket.c.socket_id == socket_id))
コード例 #4
0
ファイル: worker_model.py プロジェクト: codalab/codalab-cli
 def deallocate_socket(self, socket_id):
     """
     Cleans up the socket, removing the associated file in the socket
     directory.
     """
     self._cleanup_socket(socket_id)
     with self._engine.begin() as conn:
         conn.execute(cl_worker_socket.delete().where(cl_worker_socket.c.socket_id == socket_id))