Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Refactor McM REST client. #23

@ggonzr

Description

@ggonzr

Perform several updates to enhance the code quality for this module and its re-usability in more contexts than requests for McM. Split the responsibility related to authenticating an HTTP client for performing requests from the per-application operations to consume a required resource. Also, allow extensions for other endpoints related to other PdmV applications and improve the performance handling requests.

Is your feature related to a problem?

Because of the McM REST client module tying HTTP methods to application-specific operations, users who require a fast way to authenticate other kinds of requests end up consuming mangled methods to achieve this behavior. This is not expected as it creates a problem in performing internal updates on modules without breaking existing client implementations.

Also, several modules in PdmV's integrations use this implementation for McM and change some internals to perform requests to other applications, bypassing the original purpose of the module and creating issues to maintain it in the future. To conclude, the current implementation doesn’t allow to handle requests concurrently and this creates performance issues related to bulk big processing loads.

Describe the solution you'd like

  • Use the requests library as the HTTP client instead of default implementations with core modules to improve flexibility, maintenance, and performance.
  • Split the responsibility for configuring an HTTP client session (request.Session) in another class. Include hooks to retrieve or request tokens and session cookies to authenticate operations and refresh the credentials when required. Store ID/OAuth tokens and refresh them if possible to improve UX and avoid extra human interventions.
  • Refactor the McM module to use the new HTTP client class created before and set operations only related to this application.
  • Refactor PdmV integrations to use this new implementation and the examples too.
  • Organize the McM modules into a subfolder only dedicated to this application.
  • Create new modules for other applications like Stats2 and RelVal.
  • Rename the repository to describe an intent wider than just McM scripts.
  • Drop Python 2 support

Expected behavior

Users have an HTTP client they can use to perform authenticated HTTP requests to CERN internal applications and, related to our context, perform operations to PdmV applications in an easier and high-performance way.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions