Beispiel #1
0
	def test_job_clean2(self):
		"""
		Test used to cancel the execution of a job by its id.
		A sample job is runned and then stopped.
		"""
		jm = JobManager()
                jm.start()
                job = Job(increase, (2,))
                job.user = 1
                jm.addJob(job)

                jm.cleanJobs(job.user)
		sleep(2)
                self.assertEqual('COMPLETED', jm.getJob(job.id, job.user).status)
                jm.stop()
Beispiel #2
0
	def test_user_clean(self):
		"""
		Test used to clean all completed jobs of a specific user.
		"""
		jm = JobManager()
		jm.start()
		for i in range(3):
			job = Job(increase, (2+i,))
			job.user = 1
			jm.addJob(job)
		
		sleep(6)
		jm.cleanJobs(1)
		self.assertEqual(0, len(jm.getJobs('COMPLETED', 1)))
		jm.stop()
Beispiel #3
0
	def test_job_clean(self):
		"""
		Test used to remove completed or aborted jobs from the
		Job Manager queues.
		A sample job is runned, waited and the cleaned.
		"""
		jm = JobManager()
		jm.start()
		job = Job(increase, (2,))
		job.user = 1
		jm.addJob(job)
		
		sleep(2)
		jm.cleanJobs(job.user)
		self.assertIsNone(jm.getJob(job.id, job.user))
		jm.stop()