Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Introduced new Flight File Processing System #82

Open
wants to merge 12 commits into
base: refactor-staging
Choose a base branch
from

Conversation

jkarns275
Copy link
Collaborator

This new system aims to do a few things:

  • Completely separated flight importing / processing code from Flight.java
  • Create a readable and clear interface for processing steps.
  • Remove boilerplate code.
  • Parallelize flight file processing.
  • Automatically resolve dependencies between flight importing steps.

The basic idea is that we have a set of "steps" that we want to apply to flights during the import process (e.g. AGL calculation, LOCI calculation, AirportProximity, Engine Divergence, TotalFuel). Each of these steps will be factored into its own class that extends the ProcessStep class, which will provide some information about what columns the steps need to be computed and what columns they output after being computed.

This information can be used to construct a DAG, where the nodes are the process steps and an edge exists between from node A to node B if node A outputs a column required by column B. The DAG can then be executed efficiently using a work-stealing thread pool (ForkJoinPool in java) along with a little extra book keeping to avoid creation of redundant jobs. The implementation of this DAG exists in org.ngafid.flights.process.DependencyGraph.

The FlightBuilder class pulls these things together. The (overridable) method gatherSteps() returns a list of ProcessSteps which will be used create a DependencyGraph. The graph is then executed. Rather than modifying the Flight object in-place, the FlightBuilder object as passed around to the ProcessSteps.

To handle different types of Airframes that may require a particular set of ProcessSteps, the FlightBuilder class can be extended and the gatherSteps() method overridden.

Error handling here is a bit more convoluted since (1) the DAG can possibly be executed in parallel and (2) the errors can propagate down the dependency graph. Basically, non-fatal exceptions are accumulated as usual but will lead to all descendant steps being disabled. Fatal exceptions will lead to the flight ultimately not being imported, but won't immediately halt the processing process due to the usage of a thread pool.

There are also a lot of small changes I made along the way here for the sake of speed / efficiency / readability, too many to list here.

TODO:

  • Scan Eagle Process steps.
  • Create FlightBuilder classes for different classes of airframe (rotorcraft, UAV)

Also note that this is a PR into our staging branch, not main.

@jkarns275 jkarns275 changed the title [WIP] Introduced new Flight File Processing System Introduced new Flight File Processing System Apr 10, 2023
@jkarns275 jkarns275 changed the title Introduced new Flight File Processing System [WIP] Introduced new Flight File Processing System Apr 10, 2023
AarC10 and others added 6 commits April 25, 2023 16:58
* DAT File Processor

* csv file processing

* JSON Flight processing

* GPX File Processing code

* Attempt at porting over more DAT processing code

* JSON File processing with new code

* Part of CSVFileProcessing

* Remove connection params from DATFileProcessor

* Probably working general csv parsing

* CSV File Processor

* Remove storing Maps and FlightMeta in JSONFileProcessor instance

* GPX processor

* Integrate processors into the process upload class

* More maintainable way of adding new flight file processors in the future

* Fixed some compile errs in procupload. Still need to fix issue with convertAndInsert in dat file

* DAT File changes. Modified FlightFileProcessor to do var args to support this

* Add todo comment

* Procesor docstrings

* JavaDocs for FFP

* Modify how the processors map is inited

* Kotlin moment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants