2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-02-07 00:02:28 +00:00

Remove greenlet, and change 'confluent' to asyncio

This commit is contained in:
Jarrod Johnson
2024-08-16 14:36:59 -04:00
parent c43a667299
commit 5eaf998391
4 changed files with 7 additions and 18 deletions

View File

@@ -18,10 +18,10 @@
import asyncio
import sys
import os
import eventlet
import eventlet.hubs
eventlet.hubs.use_hub("eventlet.hubs.asyncio")
from eventlet.asyncio import spawn_for_awaitable
#import eventlet
#import eventlet.hubs
#eventlet.hubs.use_hub("eventlet.hubs.asyncio")
#from eventlet.asyncio import spawn_for_awaitable
path = os.path.dirname(os.path.realpath(__file__))
@@ -43,8 +43,9 @@ async def main():
if __name__ == '__main__':
#multiprocessing.freeze_support()
#asyncio.get_event_loop().run_until_complete(main())
gt = spawn_for_awaitable(confluent.main.run(sys.argv))
gt.wait()
asyncio.get_event_loop().run_until_complete(main())
#gt = spawn_for_awaitable(confluent.main.run(sys.argv))
#gt.wait()
#except:
# pass
#p.disable()

View File

@@ -19,7 +19,6 @@ import confluent.config.configmanager as configmanager
import confluent.netutil as netutil
import tempfile
import shutil
import greenlet
import pwd
import signal
import confluent.collective.manager as collective

View File

@@ -28,7 +28,6 @@ import ssl
import confluent.sortutil as sortutil
import ctypes
import ctypes.util
import greenlet
import random
import time
import sys
@@ -208,8 +207,6 @@ async def follow_leader(remote, leader):
try:
exitcause = await cfm.follow_channel(remote)
newleader = exitcause.get('newleader', None)
except greenlet.GreenletExit:
cleanexit = True
finally:
if cleanexit:
log.log({'info': 'Previous following cleanly closed',

View File

@@ -59,7 +59,6 @@ except ImportError:
#import multiprocessing
import asyncio
import gc
from greenlet import greenlet
import sys
import os
import glob
@@ -203,13 +202,6 @@ def dumptrace(signalname, frame):
ht = open('/var/log/confluent/hangtraces', 'a')
ht.write('Dumping active trace on ' + time.strftime('%X %x\n'))
ht.write(''.join(traceback.format_stack(frame)))
for o in gc.get_objects():
if not isinstance(o, greenlet):
continue
if not o:
continue
ht.write('Thread trace: ({0})\n'.format(id(o)))
ht.write(''.join(traceback.format_stack(o.gr_frame)))
for atask in asyncio.all_tasks():
ht.write('Async trace: ({0})\n'.format(id(atask)))
ht.write(''.join([x for x in format_stack(atask)]))