Add gRPC service for the activity classifier postprocessor#40
Merged
Conversation
Mirrors the existing entity postprocessor gRPC service (atlas_entity/grpc_serve) so the activity postprocessing rules can be deployed and run independently of the model inference pipeline. The server reconstructs the trajectory DataFrame from the request and calls the existing AtlasActivityPostProcessor.postprocess, so every rule behaves identically to the in-process pipeline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The grpc integration test needs the postprocessor server running, so it must not run in the pipeline step (no server there); exclude it like the entity one and run it against the test_activity_postprocessor_grpc compose service in the service-tests step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mikerjacobi
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The activity classifier's postprocessing rules (transiting, anchored/moored, stationary, confidence thresholding, geofencing, near-shore/marine-infra, etc.) currently only run in-process inside the
atlas_activitymodel pipeline. We already expose the entity postprocessor as a standalone gRPC service (atlas_entity/grpc_serve) so it can be deployed and invoked independently of the model. This adds the equivalent for the activity postprocessor, so the same rule logic can be deployed and run separately from the model pipeline.Changes
Adds a self-contained
atlas_activity/grpc_servepackage mirroring the entity one: a.proto+ checked-in stubs,config.py(ACTIVITY_POSTPROCESSOR_GRPC_*, default port 5208), aserve_grpc.pyserver with a health check, an integration test, and atest_activity_postprocessor_grpcdocker-compose service.Unlike the flat entity input, the activity postprocessor needs the trajectory itself, so the request carries the AIS messages (
sog,rel_cog,cog,lat,lon,send, optionalnav/dist2coast) plus the predicted class, model confidence, andbinned_ship_type. The servicer reconstructs themost_recent_dataDataFrame and calls the existingAtlasActivityPostProcessor.postprocess— no rule logic is reimplemented, so behavior is identical to the in-process pipeline.Architecture
flowchart LR client[gRPC client] -->|ActivityPostprocessorInput| svc subgraph atlas_activity svc[ActivityPostprocessorServicer]:::added -->|rebuild DataFrame| pp[AtlasActivityPostProcessor.postprocess] pp --> rules[postprocess rules] end svc -->|ActivityPostprocessorOutput| client classDef added fill:#6f6,stroke:#333