Пример #1
0
	def create_install_task(self):

		pkg = self.pkg
		build_opts = self.build_opts
		mtimedb = self.mtimedb
		scheduler = self.scheduler
		settings = self.settings
		world_atom = self.world_atom
		ldpath_mtimes = mtimedb["ldpath"]

		if pkg.installed:
			if not (build_opts.buildpkgonly or \
				build_opts.fetchonly or build_opts.pretend):

				task = PackageUninstall(background=self.background,
					ldpath_mtimes=ldpath_mtimes, opts=self.emerge_opts,
					pkg=pkg, scheduler=scheduler, settings=settings,
					world_atom=world_atom)

			else:
				task = AsynchronousTask()

		elif build_opts.fetchonly or \
			build_opts.buildpkgonly:
			task = AsynchronousTask()
		else:
			task = self._install_task.create_install_task()

		return task
Пример #2
0
	def __init__(self, max_jobs=None, max_load=None, **kwargs):
		AsynchronousTask.__init__(self)
		PollScheduler.__init__(self, **kwargs)

		if max_jobs is None:
			max_jobs = 1
		self._max_jobs = max_jobs
		self._max_load = None if max_load is True else max_load
		self._error_count = 0
		self._running_tasks = set()
		self._remaining_tasks = True
		self._loadavg_check_id = None
Пример #3
0
    def test_exit_listener_after_exit(self):
        """
        Test that callbacks can be registered via the AsynchronousTask
        addExitListener method even after the task is done, and
        verify that the callbacks are called.
        """
        loop = asyncio._wrap_loop()
        task = AsynchronousTask(scheduler=loop)
        task.start()
        loop.run_until_complete(task.async_wait())

        for i in range(3):
            event = loop.create_future()
            task.addStartListener(lambda task: event.set_result(None))
            loop.run_until_complete(event)

            event = loop.create_future()
            task.addExitListener(lambda task: event.set_result(None))
            loop.run_until_complete(event)
Пример #4
0
 def __init__(self, **kwargs):
     AsynchronousTask.__init__(self, **kwargs)
     self._task_queue = deque()
Пример #5
0
 def _start(self):
     self.ebuild_build._record_binpkg_info(self.ebuild_binpkg)
     AsynchronousTask._start(self)
	def __init__(self, **kwargs):
		AsynchronousTask.__init__(self, **kwargs)
		self._task_queue = deque()
Пример #7
0
		def _start(self):
			self.ebuild_build._record_binpkg_info(self.ebuild_binpkg)
			AsynchronousTask._start(self)