Example #1
0
 def join(self, timeout=3.0):
     self._log.debug("joining")
     if self._req_socket is not None:
         self._req_socket.close()
         self._req_socket = None
     Greenlet.join(self, timeout)
     self._log.debug("join complete")
 def join(self, timeout=3.0):
     """
     Clean up and wait for the greenlet to shut down
     """
     self._log.debug("joining")
     self._pull_socket.close()
     Greenlet.join(self, timeout)
     self._log.debug("join complete")
Example #3
0
 def join(self, timeout=3.0):
     """
     Clean up and wait for the greenlet to shut down
     """
     self._log.debug("joining")
     self._pull_socket.close()
     Greenlet.join(self, timeout)
     self._log.debug("join complete")
 def join(self, timeout=3.0):
     self._log.debug("joining")
     Greenlet.join(self, timeout)
     self._dealer_socket.close()
     self._log.debug("join complete")
Example #5
0
 def join(self, timeout=3.0):
     self._log.debug("joining")
     Greenlet.join(self, timeout)
     self._dealer_socket.close()
     self._log.debug("join complete")
Example #6
0
 def join(self, timeout=None):
     self._log.debug("joining")
     self._halt_event.set()
     Greenlet.join(self, timeout)
     self._log.debug("join complete")
 def join(self, timeout=None):
     self._log.info("joining")
     Greenlet.join(self, timeout)
Example #8
0
 def join(self, timeout=None):
     self._log.debug("joining")
     self._halt_event.set()
     Greenlet.join(self, timeout)
     self._log.debug("join complete")
Example #9
0
File: 1.py Project: vikchopde/study
# In[ ]:


# Creating a simple function and wrapping it in greenlet
def myfunction(arg1, arg2, **kwargs):
    print(arg1, arg2, kwargs)
    return 100


# In[ ]:

g = Greenlet(myfunction, 'One', 'Two',
             now='Buckle my shoe')  # create a Greenlet instance using c'tor
g.start(
)  # and then call start(), which immediately calls it, returns None always
g.join()
print('Finished')
print('Greenlet.value', g.value)  # Stores the function return value

# In[ ]:

# the other way is to use the spawn() method, which creates an instance and calls start() too.
# So it is a shorthand and widely used
jobs = [
    gevent.spawn(myfunction, '1', '2', now='Buckle my shoe')
    for i in range(0, 5)
]
gevent.joinall(
    jobs, timeout=3
)  # the first parameter is reduced to a subset of jobs that finished under 3 seconds
[job.value for job in jobs]
Example #10
0
 def close(self, workers: Greenlet) -> None:
     workers.join()
     result = self._format_result(worker=workers)
     self._GreenThread_Running_Result.append(result)
 def join(self, timeout=None):
     self._log.info("joining")
     Greenlet.join(self, timeout)