We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
any way to do some extra work before worker shutdown or restart?
The text was updated successfully, but these errors were encountered:
import multiprocessing as mp from multiprocessing import Process from itertools import cycle ix=[1,2] cy=cycle(ix) ctx=mp.get_context() class MyProc(ctx.Process): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) print(f"my name:{self.name}") # def terminate(self): # print(f"my name:{self.name}") def join(self): super().join() print(f"my name:{self.name}") # def close(self): # print(f"my name:{self.name}") ctx.Process=MyProc import rx import concurrent.futures as cf import rx.operators as ops def bb(f): return f if __name__ == '__main__': with cf.ProcessPoolExecutor(max_workers=3,mp_context=ctx) as excutor: cd=rx.from_iterable([1,2,3,4,5,6,7,8]).pipe( ops.map(lambda x:excutor.submit(bb,x)) ) cd.subscribe() dd=cd.__await__()
maybe can try this
Sorry, something went wrong.
Please do not use GitHub for questions. This is a place where to report bugs and request features and not to get HowTos.
The right place for that, is stackoverflow.
stackoverflow
No branches or pull requests
any way to do some extra work before worker shutdown or restart?
The text was updated successfully, but these errors were encountered: