diff --git a/gateway/sds_gateway/api_methods/utils/profilers.py b/gateway/sds_gateway/api_methods/utils/profilers.py new file mode 100644 index 000000000..f6bb90ec8 --- /dev/null +++ b/gateway/sds_gateway/api_methods/utils/profilers.py @@ -0,0 +1,43 @@ +"""Profiler wrappers to check resource usage. +To use, import the decorator as such: +from sds_gateway.api_methods.utils.profilers import profile_memory +Then annotate functions to profile with @profile_memory""" + +import functools +import threading +import tracemalloc + +from loguru import logger + +_tracemalloc_lock = threading.Lock() + + +def profile_memory(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + with _tracemalloc_lock: + owns_tracing = not tracemalloc.is_tracing() + + if owns_tracing: + tracemalloc.start() + + try: + return func(*args, **kwargs) + finally: + current, peak = tracemalloc.get_traced_memory() + + if owns_tracing and tracemalloc.is_tracing(): + tracemalloc.stop() + + logger.info( + "[Memory Profiler] {} Current: {:.2f} MB", + func.__name__, + current / 10**6, + ) + logger.info( + "[Memory Profiler] {} Peak: {:.2f} MB", + func.__name__, + peak / 10**6, + ) + + return wrapper diff --git a/gateway/sds_gateway/static/css/components.css b/gateway/sds_gateway/static/css/components.css index 973aa8ca3..7680a2139 100644 --- a/gateway/sds_gateway/static/css/components.css +++ b/gateway/sds_gateway/static/css/components.css @@ -378,6 +378,34 @@ textarea.form-control-plaintext { margin-bottom: 1rem; } +.provider-list { + display: grid; + gap: 0.75rem; + width: min(100%, 22rem); + margin: 0; + padding: 0; + list-style: none; +} + +.hero-content .provider-list .social-provider-button { + display: flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + width: 100%; + min-height: 44px; + color: var(--bs-white); + font-weight: 500; + text-decoration: none; +} + +.hero-content .provider-list .social-provider-button:hover, +.hero-content .provider-list .social-provider-button:focus, +.hero-content .provider-list .social-provider-button:active { + color: var(--bs-white); + text-decoration: none; +} + /* Custom Table */ .custom-table { width: 100%; diff --git a/gateway/sds_gateway/templates/allauth/elements/provider.html b/gateway/sds_gateway/templates/allauth/elements/provider.html index fc53724e8..c0c4550e3 100644 --- a/gateway/sds_gateway/templates/allauth/elements/provider.html +++ b/gateway/sds_gateway/templates/allauth/elements/provider.html @@ -1,8 +1,8 @@