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

Add multi-processing #30

Merged
merged 85 commits into from
Feb 15, 2022
Merged

Add multi-processing #30

merged 85 commits into from
Feb 15, 2022

Conversation

cortadocodes
Copy link
Member

@cortadocodes cortadocodes commented Feb 11, 2022

Summary

Convert data-gateway to run on multiple processes and make it more efficient to avoid serial port buffer overflows.

Note: the test coverage has appeared to drop because the test runner isn't taking into account code run in other processes - this will increase back to current levels once the runner is configured to do this.

Contents (#30)

New features

  • Run packet reading and packet parsing in different processes, using a process-safe queue to send packets from the reader to the parser

Enhancements

  • Adjust log levels for cleaner output
  • Continue running if an unknown packet is read from serial port
  • Allow specific time after which to stop gateway if when no new data received
  • Add process name to logging context
  • Use multiprocessing logger throughout data_gateway package
  • Log the location(s) that data will be persisted to
  • Stop the closing and re-opening of the serial port on buffer overflow
  • Log a warning if no routine is provided in non-interactive mode
  • Stop the gateway if there's an error in either of the commands threads

Fixes

  • Add force_persist method to NoOperationContextManager
  • Stop packet reader when a routine finishes
  • Ensure packet reader has correct default output directory
  • Ensure routines containing a stop command only schedule and run the commands up until and including the stop command
  • Ensure routines don't stop the gateway if/when they time out

Refactoring

  • Move logic for starting gateway into new DataGateway class
  • Rename PacketReader.parse_payload to parse_packets
  • Confine notion of session_subdirectory to PacketReader and remove it from the persistence module

Testing

  • Use simpler 0 and 1 values for RUN_DEPLOYMENT_TESTS environment variable
  • Avoid potentially missing environment variable when skipping test
  • Add missing bucket and project arguments in CLI tests
  • Remove CredentialsEnvironmentVariableAsFile
  • Mock BiqQuery client in tests
  • Only save locally in CLI tests
  • Remove problematic test (Windows)
  • Move non-Cloud Function tests into test_data_gateway subpackage
  • Remove use of temporary directories in DataGateway tests to avoid colons in cloud paths on Windows

@cortadocodes cortadocodes linked an issue Feb 15, 2022 that may be closed by this pull request
@cortadocodes cortadocodes merged commit dee5899 into main Feb 15, 2022
@cortadocodes cortadocodes deleted the feature/multi-process-gateway branch February 15, 2022 18:39
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.

Log output directory when starting gateway
2 participants