コード例 #1
0
class SessionManagement(Process):
    def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
        Process.__init__(self)

        self.aps_instance = aps_instance
        self.queue = queue
        self.queue2 = queue2
        self.queue_sync = queue_sync
        self.logging_queue = logging_queue

        self.synchronizer = SingletonSynchronizer()
        self.synchronizer.backup()
        self.looping = True

        self.current_session_id = multiprocessing.Array("c", 30)

    def run(self):
        try:
            self.main()
        except Exception, err:
            from ovd.Config import Config
            import os
            import time
            import traceback
            try:
                f = open("%s-crash-%d.txt" % (Config.log_file, os.getpid()),
                         "a")
                f.write("%s - Unhandled exception: \n" % (time.asctime()))
                f.write(traceback.format_exc())
                f.close()
            except IOError, err:
                pass

            raise err  # Should we raise or continue at this point ??
コード例 #2
0
class SessionManagement(Process):
	
	def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
		Process.__init__(self)
		
		self.aps_instance = aps_instance
		self.queue = queue
		self.queue2 = queue2
		self.queue_sync = queue_sync
		self.logging_queue = logging_queue
		
		self.synchronizer = SingletonSynchronizer()
		self.synchronizer.backup()
		self.looping = True
		
		self.current_session_id = multiprocessing.Array("c", 30)
	
	
	def run(self):
		try:
			self.main()
		except Exception, err:
			from ovd.Config import Config
			import os
			import time
			import traceback
			try:
				f = open("%s-crash-%d.txt"%(Config.log_file, os.getpid()), "a")
				f.write("%s - Unhandled exception: \n"%(time.asctime()))
				f.write(traceback.format_exc())
				f.close()
			except IOError, err:
				pass
			
			raise err # Should we raise or continue at this point ??
コード例 #3
0
class SessionManagement(Process):
	def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
		Process.__init__(self)
		
		self.aps_instance = aps_instance
		self.queue = queue
		self.queue2 = queue2
		self.queue_sync = queue_sync
		self.logging_queue = logging_queue

		self.synchronizer = SingletonSynchronizer()
		self.synchronizer.backup()

	def run(self):
		self.synchronizer.restore()
		Logger._instance.setQueue(self.logging_queue, False)
		loop = True

		Platform.System.prepareForSessionActions()
		
		# Prevent the process to be stop by a keyboard interruption
		def quit(machin, truc):
			global loop
			loop = False
		signal.signal(signal.SIGINT, signal.SIG_IGN)
		signal.signal(signal.SIGTERM, quit)
		
		Logger.debug("Starting SessionManager process")
		while loop:
			try:
				(request, obj) = self.queue2.get_nowait()
			except Queue.Empty:
				try:
					(request, obj) = self.queue.get(True, 4)
				except Queue.Empty, e:
					continue
				except IOError, e:
					if e.errno == 4:
						break
					else:
						raise e
			
			if request == "create":
				session = obj
				self.create_session(session)
				session.locked = False
				self.queue_sync.put(session)
			elif request == "destroy":
				session = obj
				self.destroy_session(session)
				session.locked = False
				self.queue_sync.put(session)
			elif request == "logoff":
				user = obj
				self.destroy_user(user)
			elif request == "manage_new":
				session = obj
				self.manage_new_session(session)
				session.locked = False
				self.queue_sync.put(session)
コード例 #4
0
    def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
        Process.__init__(self)

        self.aps_instance = aps_instance
        self.queue = queue
        self.queue2 = queue2
        self.queue_sync = queue_sync
        self.logging_queue = logging_queue

        self.synchronizer = SingletonSynchronizer()
        self.synchronizer.backup()
コード例 #5
0
    def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
        Process.__init__(self)

        self.aps_instance = aps_instance
        self.queue = queue
        self.queue2 = queue2
        self.queue_sync = queue_sync
        self.logging_queue = logging_queue

        self.synchronizer = SingletonSynchronizer()
        self.synchronizer.backup()
        self.looping = True

        self.current_session_id = multiprocessing.Array("c", 30)
コード例 #6
0
ファイル: SessionManagement.py プロジェクト: skdong/nfs-ovd
	def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
		Process.__init__(self)
		
		self.aps_instance = aps_instance
		self.queue = queue
		self.queue2 = queue2
		self.queue_sync = queue_sync
		self.logging_queue = logging_queue

		self.synchronizer = SingletonSynchronizer()
		self.synchronizer.backup()
コード例 #7
0
	def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
		Process.__init__(self)
		
		self.aps_instance = aps_instance
		self.queue = queue
		self.queue2 = queue2
		self.queue_sync = queue_sync
		self.logging_queue = logging_queue
		
		self.synchronizer = SingletonSynchronizer()
		self.synchronizer.backup()
		self.looping = True
		
		self.current_session_id = multiprocessing.Array("c", 30)
コード例 #8
0
class SessionManagement(Process):
    def __init__(self, aps_instance, queue, queue2, queue_sync, logging_queue):
        Process.__init__(self)

        self.aps_instance = aps_instance
        self.queue = queue
        self.queue2 = queue2
        self.queue_sync = queue_sync
        self.logging_queue = logging_queue

        self.synchronizer = SingletonSynchronizer()
        self.synchronizer.backup()

    def run(self):
        self.synchronizer.restore()
        Logger._instance.setQueue(self.logging_queue, False)
        loop = True

        Platform.System.prepareForSessionActions()

        # Prevent the process to be stop by a keyboard interruption
        def quit(machin, truc):
            global loop
            loop = False

        signal.signal(signal.SIGINT, signal.SIG_IGN)
        signal.signal(signal.SIGTERM, quit)

        Logger.debug("Starting SessionManager process")
        while loop:
            try:
                (request, obj) = self.queue2.get_nowait()
            except Queue.Empty:
                try:
                    (request, obj) = self.queue.get(True, 4)
                except Queue.Empty, e:
                    continue
                except IOError, e:
                    if e.errno == 4:
                        break
                    else:
                        raise e

            if request == "create":
                session = obj
                self.create_session(session)
                session.locked = False
                self.queue_sync.put(session)
            elif request == "destroy":
                session = obj
                self.destroy_session(session)
                session.locked = False
                self.queue_sync.put(session)
            elif request == "logoff":
                user = obj
                self.destroy_user(user)
            elif request == "manage_new":
                session = obj
                self.manage_new_session(session)
                session.locked = False
                self.queue_sync.put(session)