Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Python initialization and runtime sequence for http communication



This article explains the initialization and runtime sequence of Python http modules.

Overview

The initialization and runtime sequence of Python scripts follows two general phases: Note that if the initialization phase does not end correctly[1]
It can be the case if the Python script takes too much time to start-up, or if there is an exception during the initialization of the script
, then the Python http module initialization will be aborted. Else the runtime phase will be started.
sequencepython

Initialization phase

The initialization phase follows the following steps:
  • The Python script is started using the specified Python executable in a separate process
  • The pythonHttpModule.py script sets the pythonHttpUtils field to the Python script
  • The Python script start(self) method is called if the method exists
If all went well, at this point the Python module is initialized, and the runtime phase is started. Note that the Python module initialization will be aborted if:
sequencepythonstarthttp

Runtime phase

The runtime phase follows the following steps:
  • To get the content of a service, the notify(self, serviceName, instanceId=0) method of the pythonHttpUtils.py can be called. It will send a GET request for the associated route to the server
  • To invoke a service, the invoke(self, serviceName) method of the pythonHttpUtils.py can be called. It will send a POST request for the associated route to the server

sequencepythonruntimehttp

Using lengthy methods for the Python scripts

If you have some code for initializing your Python script which takes a lot of time to complete, you can:
  • Put this code in the def __init__(self)( method, and make sure that the waitAtStart value if sufficient

Notes

  1. ^ It can be the case if the Python script takes too much time to start-up, or if there is an exception during the initialization of the script
  2. ^ If not specified, the value is set to 200 ms

See also


Categories: concepts | python

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence