Development Guides¶
Overview This document contains the interval and guide to develop ECUTracker.
- Author
Daehyeok Mun
- Date
Nov 01, 2021
- Git
- Jenkins
Dump datab to local MongoDB¶
To debug ECU Tracker with local database, please follow below steps to setup your local DB:
Download mogodb server and install in your local machine.
Run
mongo_restore.pyto copy live DB data to local MongoDB. Please make sure the variable “mongo_installation” indicates the right path to your local mogodb server.
Configuration¶
ECUTracker tries get Configuration variable from ecutracker.conf file or OS environment variable.
By default, there is no file ecutracker.conf existing in the code, you can use it to define your local setting for
debug purpose. Below a sample of ecutracker.conf for debug and development.
[DB]
FF_ECU_TRACKER_DB_HOST=localhost
[ENV]
PYTHONUNBUFFERED=1
# Disable uploading OTA package to cloud
FF_ECU_TRACKER_NO_UPLOAD_OTA=1
# Enable building locally
FF_ECU_TRACKER_SOFT_BUILD=0
# Enable DEBUG mode for OTA package upload. It will export package to local instead of
# uploading package to cloud
FF_ECU_TRACKER_UPLOAD_OTA_DEBUG=1
FF_OTA_HASH_DEBUG=0
# Enable feature to fail the build locally instead of from Jenkins Job
FF_ECU_TRACKER_SOFT_FAIL=yes
FF_ECU_TRACKER_NO_JIRA_AUTOMATION=1
FF_ECU_SKIP_TESTS=test_01_package_create
FF_ECU_TRACKER_DEBUG=true
You can edit global_conf.py file to add or delete config options,
Main Conponents and Dependencies¶
Unfortunately, ECUTracker not well modulized yet.
but data structs which stroed in MongoDB are separated into dbengine directories and package and libaries which use external services divided into their own class.
Jenkin, Jira, LDAP, Teams chat operation related classes are defined in below files
jenkins_lib.py
jira_lib.py
ldap_user_lib.py
teams_lib.py
Package create/edit related library python classes are defined in below files.
package_flasher.py
package_exporter.py
package_builder.py
package_tool.py
tracker_class.py
tracker_errorbook.py
tracker_jira.py
tracker_read.py
tracker_upload.py
User Interface and PySide¶
To the change UI, We need Qt Designer(Version 4.8) and PySide(version 1.2.4). Qt Designer Can be installed with QT Open Source and PySide-uic installed with PySide pip package.
Modify
.uifile with Qt DesignerConvert
gui_static/.uifile toecutracker_gui/guiengine/*.pyfile with pyside-uic. E.g.$pyside-uic -o ecutracker_gui/guiengine/bomui.py ecutracker_gui/gui_static/bomui.uiUse generated class(Do not edit auto-generated python file) to control UI.
Package build process¶
Most of task processed in Build-Package jenkins job with
package_builder.pyfile. If included software is not built, ECUTracker also called other Jenkins jobs to build software. Related jenkin job named can be found in ECU tab. Jenkins Job Detail is name of jenkins project.
Database(MongoDB) and ORM¶
Currently, ECUTracker use MongoDB(version 3.x) and MongoEngine.
MongoEngine is a Document-Object Mapper (think ORM but for document databases) for working with MongoDB from Python. Best way to analyze database scheme is see MongoEngine document defining. All of the document definition is located in
ecutracker_gui/dbenginedirectory. Another way is checkingdocs/openapi.ymlwith Swagger Utils.Note
MongoEngine is currently tested against MongoDB v2.6, v3.0, and v3.2. Future versions should be supported as well, but aren’t actively tested at the moment. Keep looking MongoEngine GitHub
Release and Deploy¶
Whenever Jenkins build for pull-request or merge request. Jenkins will check version string which defined
_versions.pyfile. If the project version already deployed(out-of-date) Jenkins build test will be failed. So every pull-request should use the newest version.When pull requested merged into develop branch, Jenkins create exe installer and copy the installer to
\\faradayfuture.com\root\Engineering\Tools\Python\executables\ecu_tracker\network directory.To the deploy new version of ECUTracker, Version info on MongoDB also should be changed. Modify
lastestVerfield onprojectscollection inAutoUpdaterdb andrequired_versionto make autoupdate. Then next time user executes ECUTracker, the updater will detect new version and forecly re-install.
MISC¶
When ECUTracker is launched or reload DB, whole DB is donloaded into
ECUTrackerWindowclass.(ecu_dict, lookup_dict, bom_dict, package_dict)Unfortunately, Code is not well decoupled. One of easiset approch for debuging is search the text in the button or menu, then find check
connectfunction to verifying which function is called when action is triggered.Ask to IT to ECUTracker developer’s user id included LDAP
Admingroup