Skip to content

Several issues with TES/input URI processing in distance-based task distribution logic #134

Closed

Description

@uniqueg

When working with FTP in Funnel, we need to supply FTP credentials through the URLs. In the current implementation, input and TES URIs/URLs are parsed with urllib.parse.urlparse. Out of the resulting fragments, the netloc is then passed to socket.gethostbyname to get the IP of that host. However, the netloc extracted via urllib.parse.urlparse retains (basic) authorization credentials (e.g., user:[email protected]), but socket.gethostbyname is not able to parse these and throws a socket.gaierror. This exception is caught, but is handled in such a way that the list of input URIs is either incomplete or empty. In the latter case, this leads to an error in pro_tes.middleware.task_distribution.distance.task_distribution because no TES/input URL/URI combinations can be compiled (a situtation that is not handled).

To address this issue fully, the following should be done:

  • Remove auth credentials from URLs/URIs before determining IPs
  • Return a custom error amounting to 400 if input URIs cannot be parsed gethostbyname
  • Return a custom error amounting to 500 if TES URIs cannot be parsed by gethostbyname
  • Add comprehensive type hints to module
  • The distance-based logic should not fail if, for some reason, no TES/input IP combinations can be constructed; in that case, proTES should fall back to random distribution
  • Write unit tests for all code in the module and run in the CI

Activity

  1. self-assigned this
    on Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions