Repository navigation
Closed
Labels
priority: mediumMedium prioritytype: featureNew feature or requesttype: securityRelated to securityworkload: daysLikely takes days to resolve
Description
Problem
proTES's TaskDistributionDistance resolves the hosts of the TES backends and of the task's inputs and sends their IP addresses, per task, to db-ip.com, and the resulting places to Nominatim. That is slow (one remote lookup per host and task, elixir-cloud-aai/protes#130) and a privacy issue: the locations of users' data go to third parties for every task. It should become an opt-in plugin with an offline default.
This issue absorbs elixir-cloud-aai/protes#130 (store geolocations of TES instances), which is closed with a pointer here once this is done.
Proposal
- Plugin
tes.routing.distance: distributionfoca-plugin-tes-routing-distance,apis = {"tes"},on_routeonly.- Ranks the candidates by the summed great-circle distance to the locations of the task's inputs (
inputs[].url, as the client submitted them:ctx.original). - Ties keep the candidates' order. Candidates without a location follow the located ones, in their order. No candidate is dropped.
NotApplicableif the task has no input URLs, or if no input or no candidate could be located, so the next alternative (e.g.,generic.routing.random, feat(generic/routing/random): add random routing #7, orfoca.routing.ordered) routes instead.
- Ranks the candidates by the summed great-circle distance to the locations of the task's inputs (
- Backend locations: from the backend list first (
Backend.location, FOCA 0.18.0); otherwise, looked up from the host's address. The admin can turn that off (locate_backends: false). - Hosts are resolved with the system resolver, within the deadline. Only public addresses are looked up.
- Providers (
provider):offline, the default: a local GeoIP database in MaxMind DB format, path in the config (database). The docs recommend DB-IP's free "IP to City Lite" database (CC BY 4.0, with the attribution it requires in the README and docs). Any database with GeoIP2-City-stylelocationfields works, too.dbip, an explicit opt-in: DB-IP's free API for the place of an address, then Nominatim for its coordinates, as in proTES. The URLs are configurable (e.g., a self-hosted Nominatim). Nominatim requests are throttled per process (usage policy: at most 1 per second, with an identifying user agent).
- No database file in the repository or the package. The docs show how to add one to a derived image (download step), and that it must be updated monthly.
- Cache: lookups (address to location, also misses) are cached per process, with a TTL and a size limit, so backends are looked up once per process until expiry, not per task (proTES#130).
- FOCA 0.18.0 gives plugins no database access, so a shared cache in the plugin's own MongoDB collection (as planned) would need its own MongoDB client and credentials in the plugin. That is left for a follow-up, once FOCA offers plugin storage.
- Metadata:
data_transfersdeclares db-ip.com and Nominatim (withprovider: dbiponly);capabilities:routing-by-data-locality.
- Outbound lookups go through
ctx.httponly (public addresses,https, deadline). - Annotations: counts only (inputs, located inputs and backends, lookups, cache hits). No hosts, addresses or places, which could be personal data.
Acceptance criteria
- The offline provider works without network.
- Online providers are mocked in tests (FOCA's
FakeHttp). - Tests cover cache hits, misses and expiry; the
NotApplicablepaths; and the contract checks. - 100% coverage.
- perf: store geolocations of TES instances protes#130 is closed with a pointer.
Surviving the Connexion 3 migration
Neutral model and ctx.http only; an async variant can follow FOCA's async hooks.
Dependencies
- Blocked by build: use FOCA 0.18.0 from PyPI #6 (FOCA 0.18.0 from PyPI, test kit). FOCA 0.18.0 has backend locations (
Backend.location).
Metadata
Metadata
Assignees
Labels
priority: mediumMedium prioritytype: featureNew feature or requesttype: securityRelated to securityworkload: daysLikely takes days to resolve
Activity