Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/update_chart_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def update_values_yaml(values_path: Path, diracx_version: str) -> None:


def main() -> None:
"""Main function."""
"""Run the Main."""
parser = argparse.ArgumentParser(
description="Update chart versions for DiracX release"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ async def initiate_device_flow(
async def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any:
"""Do Device Flow.

This is called as the verification URI for the device flow.
Serve as the verification URI for the device flow.

It will redirect to the actual OpenID server (IAM, CheckIn) to
perform a authorization code flow.

Expand Down Expand Up @@ -435,8 +436,8 @@ async def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any:
async def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> Any:
"""Finish Device Flow.

This the url callbacked by IAM/CheckIn after the authorization
flow was granted.
Handle the URL callbacked by IAM/CheckIn after authorization flow.

It gets us the code we need for the authorization flow, and we
can map it to the corresponding device flow using the user_code
in the cookie/session.
Expand Down Expand Up @@ -492,7 +493,7 @@ async def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> A
async def finished(self, **kwargs: Any) -> Any:
"""Finished.

This is the final step of the device flow.
Mark the final step of the device flow.

:return: any
:rtype: any
Expand Down Expand Up @@ -539,7 +540,9 @@ async def finished(self, **kwargs: Any) -> Any:
async def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
"""Get Refresh Tokens.

Get all refresh tokens for the user. If the user has the ``proxy_management`` property, then
Get all refresh tokens for the user.

If the user has the ``proxy_management`` property, then
the subject is not used to filter the refresh tokens.

:return: list of any
Expand Down Expand Up @@ -587,7 +590,9 @@ async def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
async def revoke_refresh_token_by_jti(self, jti: str, **kwargs: Any) -> str:
"""Revoke Refresh Token By Jti.

Revoke a refresh token. If the user has the ``proxy_management`` property, then
Revoke a refresh token.

If the user has the ``proxy_management`` property, then
the subject is not used to filter the refresh tokens.

:param jti: Required.
Expand Down Expand Up @@ -697,6 +702,7 @@ async def initiate_authorization_flow(
"""Initiate Authorization Flow.

Initiate the authorization flow.

It will redirect to the actual OpenID server (IAM, CheckIn) to
perform a authorization code flow.

Expand Down Expand Up @@ -1831,6 +1837,7 @@ async def patch_metadata(
"""Patch Metadata.

Update job metadata such as UserPriority, HeartBeatTime, JobType, etc.

The argument are all the attributes/parameters of a job (except the ID).

:param body: Required.
Expand All @@ -1848,6 +1855,7 @@ async def patch_metadata(self, body: IO[bytes], *, content_type: str = "applicat
"""Patch Metadata.

Update job metadata such as UserPriority, HeartBeatTime, JobType, etc.

The argument are all the attributes/parameters of a job (except the ID).

:param body: Required.
Expand All @@ -1865,6 +1873,7 @@ async def patch_metadata(self, body: Union[Dict[str, _models.JobMetaData], IO[by
"""Patch Metadata.

Update job metadata such as UserPriority, HeartBeatTime, JobType, etc.

The argument are all the attributes/parameters of a job (except the ID).

:param body: Is either a {str: JobMetaData} type or a IO[bytes] type. Required.
Expand Down Expand Up @@ -1930,8 +1939,9 @@ async def search(
) -> List[Dict[str, Any]]:
"""Search.

Creates a search query to the job database. This search can be based on
different parameters, such as jobID, status, owner, etc.
Create a search query to the job database.

This search can be based on different parameters, such as jobID, status, owner, etc.

**Possibilities**

Expand Down Expand Up @@ -1969,8 +1979,9 @@ async def search(
) -> List[Dict[str, Any]]:
"""Search.

Creates a search query to the job database. This search can be based on
different parameters, such as jobID, status, owner, etc.
Create a search query to the job database.

This search can be based on different parameters, such as jobID, status, owner, etc.

**Possibilities**

Expand Down Expand Up @@ -2007,8 +2018,9 @@ async def search(
) -> List[Dict[str, Any]]:
"""Search.

Creates a search query to the job database. This search can be based on
different parameters, such as jobID, status, owner, etc.
Create a search query to the job database.

This search can be based on different parameters, such as jobID, status, owner, etc.

**Possibilities**

Expand Down Expand Up @@ -2094,8 +2106,9 @@ async def summary(
) -> Any:
"""Summary.

Group jobs by a specific list of parameters. Returns an array of n-uplets, where each n-uplet
contains the
Group jobs by a specific list of parameters.

Returns an array of n-uplets, where each n-uplet contains the
values of the grouping parameters and the number of jobs that match those values.

Body parameters:
Expand All @@ -2118,8 +2131,9 @@ async def summary(
async def summary(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> Any:
"""Summary.

Group jobs by a specific list of parameters. Returns an array of n-uplets, where each n-uplet
contains the
Group jobs by a specific list of parameters.

Returns an array of n-uplets, where each n-uplet contains the
values of the grouping parameters and the number of jobs that match those values.

Body parameters:
Expand All @@ -2142,8 +2156,9 @@ async def summary(self, body: IO[bytes], *, content_type: str = "application/jso
async def summary(self, body: Union[_models.SummaryParams, IO[bytes]], **kwargs: Any) -> Any:
"""Summary.

Group jobs by a specific list of parameters. Returns an array of n-uplets, where each n-uplet
contains the
Group jobs by a specific list of parameters.

Returns an array of n-uplets, where each n-uplet contains the
values of the grouping parameters and the number of jobs that match those values.

Body parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,8 @@ def initiate_device_flow(self, *, client_id: str, scope: str, **kwargs: Any) ->
def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any:
"""Do Device Flow.

This is called as the verification URI for the device flow.
Serve as the verification URI for the device flow.

It will redirect to the actual OpenID server (IAM, CheckIn) to
perform a authorization code flow.

Expand Down Expand Up @@ -936,8 +937,8 @@ def do_device_flow(self, *, user_code: str, **kwargs: Any) -> Any:
def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> Any:
"""Finish Device Flow.

This the url callbacked by IAM/CheckIn after the authorization
flow was granted.
Handle the URL callbacked by IAM/CheckIn after authorization flow.

It gets us the code we need for the authorization flow, and we
can map it to the corresponding device flow using the user_code
in the cookie/session.
Expand Down Expand Up @@ -993,7 +994,7 @@ def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> Any:
def finished(self, **kwargs: Any) -> Any:
"""Finished.

This is the final step of the device flow.
Mark the final step of the device flow.

:return: any
:rtype: any
Expand Down Expand Up @@ -1040,7 +1041,9 @@ def finished(self, **kwargs: Any) -> Any:
def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
"""Get Refresh Tokens.

Get all refresh tokens for the user. If the user has the ``proxy_management`` property, then
Get all refresh tokens for the user.

If the user has the ``proxy_management`` property, then
the subject is not used to filter the refresh tokens.

:return: list of any
Expand Down Expand Up @@ -1088,7 +1091,9 @@ def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
def revoke_refresh_token_by_jti(self, jti: str, **kwargs: Any) -> str:
"""Revoke Refresh Token By Jti.

Revoke a refresh token. If the user has the ``proxy_management`` property, then
Revoke a refresh token.

If the user has the ``proxy_management`` property, then
the subject is not used to filter the refresh tokens.

:param jti: Required.
Expand Down Expand Up @@ -1198,6 +1203,7 @@ def initiate_authorization_flow(
"""Initiate Authorization Flow.

Initiate the authorization flow.

It will redirect to the actual OpenID server (IAM, CheckIn) to
perform a authorization code flow.

Expand Down Expand Up @@ -2330,6 +2336,7 @@ def patch_metadata(
"""Patch Metadata.

Update job metadata such as UserPriority, HeartBeatTime, JobType, etc.

The argument are all the attributes/parameters of a job (except the ID).

:param body: Required.
Expand All @@ -2347,6 +2354,7 @@ def patch_metadata(self, body: IO[bytes], *, content_type: str = "application/js
"""Patch Metadata.

Update job metadata such as UserPriority, HeartBeatTime, JobType, etc.

The argument are all the attributes/parameters of a job (except the ID).

:param body: Required.
Expand All @@ -2366,6 +2374,7 @@ def patch_metadata( # pylint: disable=inconsistent-return-statements
"""Patch Metadata.

Update job metadata such as UserPriority, HeartBeatTime, JobType, etc.

The argument are all the attributes/parameters of a job (except the ID).

:param body: Is either a {str: JobMetaData} type or a IO[bytes] type. Required.
Expand Down Expand Up @@ -2431,8 +2440,9 @@ def search(
) -> List[Dict[str, Any]]:
"""Search.

Creates a search query to the job database. This search can be based on
different parameters, such as jobID, status, owner, etc.
Create a search query to the job database.

This search can be based on different parameters, such as jobID, status, owner, etc.

**Possibilities**

Expand Down Expand Up @@ -2470,8 +2480,9 @@ def search(
) -> List[Dict[str, Any]]:
"""Search.

Creates a search query to the job database. This search can be based on
different parameters, such as jobID, status, owner, etc.
Create a search query to the job database.

This search can be based on different parameters, such as jobID, status, owner, etc.

**Possibilities**

Expand Down Expand Up @@ -2508,8 +2519,9 @@ def search(
) -> List[Dict[str, Any]]:
"""Search.

Creates a search query to the job database. This search can be based on
different parameters, such as jobID, status, owner, etc.
Create a search query to the job database.

This search can be based on different parameters, such as jobID, status, owner, etc.

**Possibilities**

Expand Down Expand Up @@ -2593,8 +2605,9 @@ def search(
def summary(self, body: _models.SummaryParams, *, content_type: str = "application/json", **kwargs: Any) -> Any:
"""Summary.

Group jobs by a specific list of parameters. Returns an array of n-uplets, where each n-uplet
contains the
Group jobs by a specific list of parameters.

Returns an array of n-uplets, where each n-uplet contains the
values of the grouping parameters and the number of jobs that match those values.

Body parameters:
Expand All @@ -2617,8 +2630,9 @@ def summary(self, body: _models.SummaryParams, *, content_type: str = "applicati
def summary(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> Any:
"""Summary.

Group jobs by a specific list of parameters. Returns an array of n-uplets, where each n-uplet
contains the
Group jobs by a specific list of parameters.

Returns an array of n-uplets, where each n-uplet contains the
values of the grouping parameters and the number of jobs that match those values.

Body parameters:
Expand All @@ -2641,8 +2655,9 @@ def summary(self, body: IO[bytes], *, content_type: str = "application/json", **
def summary(self, body: Union[_models.SummaryParams, IO[bytes]], **kwargs: Any) -> Any:
"""Summary.

Group jobs by a specific list of parameters. Returns an array of n-uplets, where each n-uplet
contains the
Group jobs by a specific list of parameters.

Returns an array of n-uplets, where each n-uplet contains the
values of the grouping parameters and the number of jobs that match those values.

Body parameters:
Expand Down
20 changes: 11 additions & 9 deletions diracx-core/src/diracx/core/config/sources.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This module implements the logic of the configuration server side.
"""Module to implement the logic of the configuration server side.

This is where all the backend abstraction and the caching logic takes place.
"""
Expand Down Expand Up @@ -44,7 +44,7 @@ def is_running_in_async_context():


def _apply_default_scheme(value: str) -> str:
"""Applies the default git+file:// scheme if not present."""
"""Apply the default git+file:// scheme if not present."""
if isinstance(value, str) and "://" not in value:
value = f"git+file://{value}"
return value
Expand Down Expand Up @@ -88,14 +88,18 @@ def __init__(self, *, backend_url: ConfigSourceUrl) -> None:

@abstractmethod
def latest_revision(self) -> tuple[str, datetime]:
"""Must return:
"""Abstract method.

Must return:
* a unique hash as a string, representing the last version
* a datetime object corresponding to when the version dates.
"""

@abstractmethod
def read_raw(self, hexsha: str, modified: datetime) -> Config:
"""Return the Config object that corresponds to the
"""Abstract method.

Return the Config object that corresponds to the
specific hash
The `modified` parameter is just added as a attribute to the config.
"""
Expand All @@ -114,10 +118,7 @@ def create(cls):
def create_from_url(
cls, *, backend_url: ConfigSourceUrl | Path | str
) -> "ConfigSource":
"""Factory method to produce a concrete instance depending on
the backend URL scheme.

"""
"""Produce a concrete instance depending on the backend URL scheme."""
url = TypeAdapter(ConfigSourceUrl).validate_python(str(backend_url))
return cls.__registry[url.scheme](backend_url=url)

Expand Down Expand Up @@ -234,7 +235,8 @@ def get_git_branch_from_url(self, backend_url: ConfigSourceUrl) -> str:


class LocalGitConfigSource(BaseGitConfigSource):
"""The configuration is stored on a local git repository
"""The configuration is stored on a local git repository.

When running on multiple servers, the filesystem must be shared.
"""

Expand Down
2 changes: 1 addition & 1 deletion diracx-core/src/diracx/core/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def select_from_extension(*, group: str, name: str | None = None) -> list[EntryP
def supports_extending(
group: str, name: str
) -> Callable[[Callable[P, T]], Callable[P, T]]:
"""Decorator to replace a function with an extension implementation.
"""Replace a function with an extension implementation.

This decorator looks for an entry point in the specified group and name,
and if found, replaces the decorated function with the extension's implementation.
Expand Down
6 changes: 3 additions & 3 deletions diracx-core/src/diracx/core/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Models are used to define the data structure of the requests and responses
for the DiracX API. They are shared between the client components (cli, api) and
services components (db, logic, routers).
"""Models used to define the data structure of the requests and responses for the DiracX API.

They are shared between the client components (cli, api) and services components (db, logic, routers).
"""

from __future__ import annotations
Expand Down
Loading
Loading