Exemple #1
0
 def _async_wait(self):
     if self.returncode is None:
         raise asyncio.InvalidStateError('Result is not ready for %s' %
                                         (self, ))
     else:
         # This calls _unregister, so don't call it until pid status
         # is available.
         super(SubProcess, self)._async_wait()
Exemple #2
0
	def _async_wait(self):
		"""
		Override _async_wait to asynchronously unlock self._build_dir
		when necessary.
		"""
		if self._build_dir is None:
			SpawnProcess._async_wait(self)
		elif self._build_dir_unlock is None:
			if self.returncode is None:
				raise asyncio.InvalidStateError('Result is not ready.')
			self._async_unlock_builddir(returncode=self.returncode)
    def wait(self):
        """
		Wait for the returncode attribute to become ready, and return
		it. If the returncode is not ready and the event loop is already
		running, then the async_wait() method should be used instead of
		wait(), because wait() will raise asyncio.InvalidStateError in
		this case.

		@rtype: int
		@returns: the value of self.returncode
		"""
        if self.returncode is None:
            if self.scheduler.is_running():
                raise asyncio.InvalidStateError('Result is not ready.')
            self.scheduler.run_until_complete(self.async_wait())
        self._wait_hook()
        return self.returncode