Development Guides

Overview This document contains the interval and guide to develop ECUTracker.

Author

Daehyeok Mun

Date

Nov 01, 2021

Git

bitbucket page

Jenkins

Jenkins job

Dump datab to local MongoDB

To debug ECU Tracker with local database, please follow below steps to setup your local DB:

  1. Download mogodb server and install in your local machine.

  2. Run mongo_restore.py to 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.

  1. Modify .ui file with Qt Designer

  2. Convert gui_static/.ui file to ecutracker_gui/guiengine/*.py file with pyside-uic. E.g. $pyside-uic -o ecutracker_gui/guiengine/bomui.py ecutracker_gui/gui_static/bomui.ui

  3. Use 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.py file. 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/dbengine directory. Another way is checking docs/openapi.yml with 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.py file. 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 lastestVer field on projects collection in AutoUpdater db and required_version to make autoupdate. Then next time user executes ECUTracker, the updater will detect new version and forecly re-install.

MISC

  1. When ECUTracker is launched or reload DB, whole DB is donloaded into ECUTrackerWindow class.(ecu_dict, lookup_dict, bom_dict, package_dict)

  2. Unfortunately, Code is not well decoupled. One of easiset approch for debuging is search the text in the button or menu, then find check connect function to verifying which function is called when action is triggered.

  3. Ask to IT to ECUTracker developer’s user id included LDAP Admin group