in skywalking/agent/__init__.py [0:0]
def start(self) -> None:
loggings.init()
if sys.version_info < (3, 7):
# agent may or may not work for Python 3.6 and below
# since 3.6 is EOL, we will not officially support it
logger.warning('SkyWalking Python agent does not support Python 3.6 and below, '
'please upgrade to Python 3.7 or above.')
if not self.__started:
# if not already started, start the agent
config.finalize() # Must be finalized exactly once
self.__started = True
logger.info(f'SkyWalking async agent instance {config.agent_instance_name} starting in pid-{os.getpid()}.')
# Here we install all other lib plugins on first time start (parent process)
plugins.install()
elif self.__started and os.getpid() == self.started_pid:
# if already started, and this is the same process, raise an error
raise RuntimeError('SkyWalking Python agent has already been started in this process, '
'did you call start more than once in your code + sw-python CLI? '
'If you already use sw-python CLI, you should remove the manual start(), vice versa.')
self.started_pid = os.getpid()
atexit.register(self.__fini)
# still init profile here, since it is using threading rather than asyncio
if config.agent_profile_active:
profile.init()
self.event_loop_thread = Thread(name='event_loop_thread', target=self.__start_event_loop, daemon=True)
self.event_loop_thread.start()