12345678910111213141516171819202122232425262728293031323334 |
- import os
- from threading import Thread
- import snowflake.client
- import time
- def get_guid():
- while(True):
- try:
- return snowflake.client.get_guid()
- except Exception as e:
- pass
- def startSnowflake(port=None,worker=None):
- _cmd = "snowflake_start_server"
- if worker is not None:
- _cmd += " --worker=%d"%worker
- if port is not None:
- _cmd += " --port=%d"%port
- os.system(_cmd)
- thread_startSnowflake = Thread(target=startSnowflake)
- thread_startSnowflake.start()
- time.sleep(2)
- if __name__=="__main__":
- thread_startSnowflake = Thread(target=startSnowflake)
- thread_startSnowflake.start()
|