Esempio n. 1
0
def dump_memory(user=None):
    """
	Returns memory in BTree structure

	{ file_1 : [process_1, process_2, ..., process_n],
		...
	}

	Which describes that processes 1 to `n` is using file_1
	"""
    memory = {}
    for process in Processes.all().owned_by(user).unique():
        try:
            for file in process.files:
                if file in memory:
                    memory[file].append(process)
                else:
                    memory[file] = [process]

        except psutil.NoSuchProcess:
            pass
        except psutil.AccessDenied:
            pass

    return memory
Esempio n. 2
0
	def test_children(self):
		process = Processes.all()[0]
		children = process.children()
		self.assertIsInstance(children, ProcessesCollection)

		for child in children:
			self.assertIsInstance(child, Process)
Esempio n. 3
0
    def test_children(self):
        process = Processes.all()[0]
        children = process.children()
        self.assertIsInstance(children, ProcessesCollection)

        for child in children:
            self.assertIsInstance(child, Process)
Esempio n. 4
0
def dump_memory(user=None):
	"""
	Returns memory in BTree structure

	{ file_1 : [process_1, process_2, ..., process_n],
		...
	}

	Which describes that processes 1 to `n` is using file_1
	"""
	memory = {}
	for process in Processes.all().owned_by(user).unique():
		try:
			for file in process.files:
				if file in memory:
					memory[file].append(process)
				else:
					memory[file] = [process]

		except psutil.NoSuchProcess: pass
		except psutil.AccessDenied: pass

	return memory
Esempio n. 5
0
	def render_processes(self):
		view = ProcessesView()
		view.assign('processes', Processes.all())
		view.render()
Esempio n. 6
0
 def render_processes(self):
     view = ProcessesView()
     view.assign('processes', Processes.all())
     view.render()
Esempio n. 7
0
	def test_processes_none_user(self):
		collection = Processes.all().owned_by(None)
		self.assertGreater(len(collection), 0)
Esempio n. 8
0
	def test_processes_types(self):
		collection = Processes.all()
		self.assertIsInstance(collection, ProcessesCollection)
		self.assertIsInstance(collection.owned_by('user'), ProcessesCollection)
		self.assertIsInstance(collection.newer_than(1414006430.1), ProcessesCollection)