Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pluggable API/Features Limits #16782

Merged
merged 142 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
631a3f7
Limits
harshach May 5, 2024
ff5b4c5
Limits
harshach May 6, 2024
efca50b
- Mismatched Types
mohityadav766 May 6, 2024
31fe69e
Update Limits config response
harshach May 7, 2024
b400f0f
Update Limits feature response
harshach May 8, 2024
3ce92fd
Limits
harshach May 5, 2024
94dd285
Limits
harshach May 6, 2024
debf326
- Mismatched Types
mohityadav766 May 6, 2024
a05ae30
Update Limits config response
harshach May 7, 2024
885114f
Update Limits feature response
harshach May 8, 2024
0e69b91
Limits: add entity resource enforcer
harshach May 11, 2024
70aae14
Merge remote-tracking branch 'origin/limits' into limits
harshach May 11, 2024
2dbc0ec
Limits: fix rebase
harshach May 11, 2024
546b510
update limits enforcement
harshach May 12, 2024
62fd8da
Merge remote-tracking branch 'origin/main' into limits
harshach May 14, 2024
3e36f3d
Merge branch 'main' into limits
chirag-madlani May 14, 2024
12e6beb
Merge remote-tracking branch 'origin/main' into limits
harshach May 19, 2024
7ff5ab3
Add OperationContext to limits
harshach May 20, 2024
de2fed4
Merge remote-tracking branch 'origin/main' into limits
harshach May 20, 2024
3a378b4
chore: Bump versions to `1.4.0`
IceS2 May 10, 2024
23db850
chore: Bump Ingestion Versions to `1.4.0.1` for Release
akash-jain-10 May 22, 2024
8f9d9e4
chore: Bump Ingestion Versions to `1.4.0.1` in Dockerfiles for Release
akash-jain-10 May 22, 2024
11c1542
Remove Retry From Abstract Event Consumer (#16405)
mohityadav766 May 24, 2024
8265627
Fix Migrations: Add postgres migrations (#16403)
ayush-shah May 24, 2024
094383e
Add Null Check for isAdmin (#16407)
mohityadav766 May 24, 2024
688eb57
Merge branch 'main' into limits
chirag-madlani May 25, 2024
59a264f
Fix OpenLineage ingestor (#16416)
dolfinus May 27, 2024
61bb409
Minor: added whats new for 1.4.1 (#16420)
ShaileshParmar11 May 27, 2024
2b536a2
Fix SSL issue (#16412)
ayush-shah May 26, 2024
9d6731a
Merge remote-tracking branch 'origin/main' into limits
harshach May 28, 2024
fafc7c1
chore: Bump Versions for `1.4.1` Release
akash-jain-10 May 28, 2024
9b228de
chore(release): Prepare Branch for `1.4.2`
akash-jain-10 May 29, 2024
131aa84
[MINOR] partition migration issue with redshift servics (#16452)
TeddyCr May 29, 2024
5cbd803
minor(ui): update what's new for 1.4.2 (#16457)
chirag-madlani May 29, 2024
90d1f4e
fix: ingestion for dbt > 1.8.0 resource_type is not an enum (#16415)
aballiet May 28, 2024
7f3c915
Add Cache Query Param for Limits
harshach May 30, 2024
55400a9
Only Parse view query (#16470)
SumanMaharana May 30, 2024
64b1ceb
add limit check during user creation via PUT
harshach May 30, 2024
2dda52d
add limit check during user creation via PUT
harshach May 30, 2024
40ecd60
MINOR: Kafka Setup SSL Arg Fix (#16469)
ayush-shah May 30, 2024
d247700
Fix#16404 - Show Node level lineage by default (#16445)
karanh37 May 29, 2024
f5da0ae
Merge remote-tracking branch 'origin/main' into limits
harshach May 30, 2024
dc9b217
Invalidate count of data asset after hard delete. add limit exception…
harshach May 30, 2024
3230a38
- Remove Change Description from Lineage (#16488)
mohityadav766 May 31, 2024
05b21f7
- Non Indexable fields should be remvoed at the end (#16499)
mohityadav766 Jun 3, 2024
3fd056e
fix announcement not redirect from landing page (#16506)
Ashish8689 Jun 3, 2024
5496597
Fix Schema Field Null Issue (#16510)
mohityadav766 Jun 3, 2024
c6d0617
Merge remote-tracking branch 'origin/main' into limits
harshach Jun 4, 2024
17b5462
feat(ui): limits integration with application (#16206)
chirag-madlani Jun 4, 2024
54aa904
Add token limitations
harshach Jun 4, 2024
74e127d
Add token limitations
harshach Jun 4, 2024
7d54cda
Add appType as part of schema in ingestion pipeline (#16519)
harshach Jun 4, 2024
16b48aa
Merge remote-tracking branch 'origin/main' into limits
harshach Jun 5, 2024
c7f4de2
#16489: fix the redirect issue to new tab for tags and glossary (#16512)
Ashish8689 Jun 5, 2024
eba4cd7
Fix #16229 - Tag and Service filters for test cases (#16484)
TeddyCr Jun 4, 2024
7b0a7c3
fix: None type is not iterable (#16496)
TeddyCr May 31, 2024
5e8677f
Merge remote-tracking branch 'upstream/1.4.2' into 1.4.2
TeddyCr Jun 5, 2024
3bb6758
minor(ui): refresh token for OIDC SSO (#16483)
chirag-madlani May 31, 2024
6af76c5
feat(ui): support tag & tier filter for test case (#16502)
chirag-madlani Jun 4, 2024
14235c8
minor: sanitize activity feed editor content (#16533)
Sachin-chaurasiya Jun 5, 2024
aa0a5ca
Add appType as part of schema in ingestion pipeline (#16519)
harshach Jun 4, 2024
6b88ce6
Merge branch 'main' into limits
chirag-madlani Jun 5, 2024
da4caf8
Fixed quicksight conn (#16537)
OnkarVO7 Jun 5, 2024
e9a31b1
fix: saml auth for new user not created (#16543)
Sachin-chaurasiya Jun 5, 2024
fecc935
Merge branch 'main' into limits
chirag-madlani Jun 5, 2024
24c50f4
Fix#16491 - fix lineage edge description update (#16538)
karanh37 Jun 5, 2024
96df22e
CYPRESS: fix announcement cypress (#16536)
Ashish8689 Jun 5, 2024
36e2599
[MINOR] Fix Test Failure for EventRegistration
mohityadav766 Jun 5, 2024
cd9415a
[MINOR] Fix Test Failure for EventRegistration
mohityadav766 Jun 5, 2024
627cc6c
[MINOR] Fix Test Failure for EventRegistration
mohityadav766 Jun 5, 2024
0f0bd03
Merge remote-tracking branch 'origin/1.4.2' into 1.4.2
mohityadav766 Jun 5, 2024
60ee663
Fix Event Handlers registration Issue (#16544)
mohityadav766 Jun 5, 2024
a198212
[MINOR] Fix Test Failure for EventRegistration
mohityadav766 Jun 5, 2024
bfa08a1
Fix Topic Schema missing messageSchema (#16545)
mohityadav766 Jun 5, 2024
f087a3e
Add limits exception cache in rest client
pmbrull Jun 6, 2024
7f1e1c9
MINOR: Ignore Cluster Information from columns (#16495)
ulixius9 May 31, 2024
1cf3220
minor: improve the block editor initial content history (#16540)
Sachin-chaurasiya Jun 5, 2024
9e851e9
Minor: fixed data quality page type issue (#16556)
ShaileshParmar11 Jun 6, 2024
4fd089a
#16521: fix issue in userProfilePage for roles. teams and displayName…
Ashish8689 Jun 6, 2024
b51455b
Empty quick filters (#16402)
karanh37 May 27, 2024
0d016a9
Fix #16278 : Search to display Draft glossaryTerms on Explore page (#…
sonika-shah May 30, 2024
b9c47b6
[FIX] GlossaryTerm reviewers should be user or team only (#16372)
mohityadav766 Jun 6, 2024
0c7981b
Add testSuite tags, domain field and check for TestCase limits
harshach Jun 7, 2024
f39e2bd
fix owner not showing after refersh in teams page (#16567)
Ashish8689 Jun 7, 2024
384efec
[ISSUE-16503] Fix createUser to use EntityResource (#16549)
mohityadav766 Jun 7, 2024
b0f0c45
what's new for 1.4.2 (#16568)
Ashish8689 Jun 7, 2024
7880ab8
address feedbacks
chirag-madlani Jun 8, 2024
e93f4a8
fix error for bots page
chirag-madlani Jun 8, 2024
808a8e0
update banner text
chirag-madlani Jun 8, 2024
44e0e3c
allow force fetch limit
chirag-madlani Jun 8, 2024
4d16531
fix ingestion schedule
chirag-madlani Jun 8, 2024
8e96520
Merge branch '1.4.2' into limits
chirag-madlani Jun 8, 2024
40a493b
Revert "Merge branch '1.4.2' into limits"
harshach Jun 8, 2024
6c53ee1
Merge 1.4.2 (#16578)
harshach Jun 9, 2024
24108be
fix subheader
chirag-madlani Jun 9, 2024
14522a0
Updating glossary reviewers should propagate reviewers in glossary te…
karanh37 Jun 10, 2024
cead5a3
Update documentation for Search Index apis (#16539)
sonika-shah Jun 5, 2024
1762698
cypress: fixed flakiness and announcment cypress (#16579)
ShaileshParmar11 Jun 9, 2024
cacb6bd
fetch latest limit for create / delete operations
chirag-madlani Jun 10, 2024
e0753a8
Merge branch '1.4.2' into limits
chirag-madlani Jun 10, 2024
df78805
guard datAsset limit got topic, dashboard, mlmodel etc
chirag-madlani Jun 10, 2024
40bec71
Fix: Ensure correct index mapping in Elasticsearch for clusterAlias (…
sonika-shah Jun 10, 2024
d9e4ba8
cypress: fixed cypress AUT for mysql (#16446)
ShaileshParmar11 May 29, 2024
3fe4e7a
skip announcment redirection cypress
ShaileshParmar11 Jun 11, 2024
cfb115a
Minor: Ensure correct index mapping in Elasticsearch for clusterAlias…
sonika-shah Jun 11, 2024
dbc8d4a
Fix Postgres Application listing (#16600)
mohityadav766 Jun 11, 2024
31b879c
Merge branch '1.4.2' into limits
chirag-madlani Jun 11, 2024
8968577
fix limit related issue
chirag-madlani Jun 12, 2024
070a3f6
Fix Automations limits invalidation during the uninstall
harshach Jun 16, 2024
6f2dfa0
cypress: fixed 1.4.2 AUT cypress (#16602)
ShaileshParmar11 Jun 11, 2024
550576d
test: add updateJWTTokenExpiryTime util (#16606)
Sachin-chaurasiya Jun 11, 2024
85d374c
OSS changes for adding automator cypress tests (#16611)
aniketkatkar97 Jun 11, 2024
1a93896
Fix Test Suite Filter (#16615)
mohityadav766 Jun 12, 2024
0ebc6b1
MINOR: Fix Profiler for SSL Enabled Source (#16613)
ulixius9 Jun 12, 2024
046fcec
Add Test Suite SSL (#16619)
ayush-shah Jun 12, 2024
a1b7895
MINOR: Fix ssl connection in usage & lineage (#16625)
ulixius9 Jun 12, 2024
be6d96e
Fix owner notification (#16629)
mohityadav766 Jun 12, 2024
621211b
chore(release): Prepare Branch for `1.4.3`
github-actions[bot] Jun 15, 2024
bd87124
- Fix User Signup (#16667)
mohityadav766 Jun 14, 2024
04d4ade
- Fix User Signup - p2
mohityadav766 Jun 14, 2024
d8a7a02
- Update What's new (#16669)
mohityadav766 Jun 15, 2024
bc529ed
Minor: Fix incorrect alert on signup page (#16666)
aniketkatkar97 Jun 15, 2024
ce9ff2c
Fix Application enforceLimits during install
harshach Jun 16, 2024
95ec463
Wrap the add test button with limits wrapper for column profile tab
aniketkatkar97 Jun 18, 2024
c88069f
Merge main
harshach Jun 24, 2024
e8d25c0
Merge branch 'main' into limits-v2
chirag-madlani Jun 25, 2024
86c21fa
fix errors
chirag-madlani Jun 25, 2024
b140105
fix tests
chirag-madlani Jun 25, 2024
c43c83b
fix pylint
ulixius9 Jun 25, 2024
351357c
fix tests
chirag-madlani Jun 25, 2024
43a2e33
fix limits
chirag-madlani Jun 26, 2024
b49cd9b
pylint
ulixius9 Jun 26, 2024
3e645fc
fix schedule options
chirag-madlani Jun 26, 2024
ff56355
Merge branch 'main' into limits-v2
chirag-madlani Jun 26, 2024
49b9247
fix glossary spec failure
chirag-madlani Jun 27, 2024
4c57e8c
Merge branch 'main' into limits-v2
chirag-madlani Jun 27, 2024
309186c
Merge branch 'main' into limits-v2
chirag-madlani Jun 27, 2024
2d1fc89
Merge branch 'main' into limits-v2
chirag-madlani Jun 27, 2024
d876243
Merge branch 'main' into limits-v2
chirag-madlani Jun 28, 2024
9c4f56f
Merge branch 'main' into limits-v2
chirag-madlani Jun 30, 2024
0e8d089
Add domain & tags to testSuite
harshach Jun 30, 2024
ac5130b
Update airflow-apis-tests-3_9.yml
ayush-shah Jul 1, 2024
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/airflow-apis-tests-3_9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
- name: Start Server and Ingest Sample Data
uses: nick-fields/retry@v2.8.3
env:
INGESTION_DEPENDENCY: "mysql,elasticsearch"
INGESTION_DEPENDENCY: "mysql,elasticsearch,sample-data"
with:
timeout_minutes: 60
max_attempts: 2
Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>platform</artifactId>
<groupId>org.open-metadata</groupId>
<version>1.5.0-SNAPSHOT</version>
<version>1.4.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<properties>
Expand Down
5 changes: 5 additions & 0 deletions conf/openmetadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ email:
password: ${SMTP_SERVER_PWD:-""}
transportationStrategy: ${SMTP_SERVER_STRATEGY:-"SMTP_TLS"}

limits:
enable: ${LIMITS_ENABLED:-false}
className: ${LIMITS_CLASS_NAME:-"org.openmetadata.service.limits.DefaultLimits"}
limitsConfigFile: ${LIMITS_CONFIG_FILE:-""}

web:
uriPath: ${WEB_CONF_URI_PATH:-"/api"}
hsts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ volumes:
services:
ingestion:
container_name: openmetadata_ingestion
image: docker.getcollate.io/openmetadata/ingestion:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/ingestion:1.4.3
environment:
AIRFLOW__API__AUTH_BACKENDS: "airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session"
AIRFLOW__CORE__EXECUTOR: LocalExecutor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
execute-migrate-all:
container_name: execute_migrate_all
command: "./bootstrap/openmetadata-ops.sh migrate"
image: docker.getcollate.io/openmetadata/server:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/server:1.4.3
environment:
OPENMETADATA_CLUSTER_NAME: ${OPENMETADATA_CLUSTER_NAME:-openmetadata}
SERVER_PORT: ${SERVER_PORT:-8585}
Expand Down Expand Up @@ -227,7 +227,7 @@ services:
openmetadata-server:
container_name: openmetadata_server
restart: always
image: docker.getcollate.io/openmetadata/server:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/server:1.4.3
environment:
OPENMETADATA_CLUSTER_NAME: ${OPENMETADATA_CLUSTER_NAME:-openmetadata}
SERVER_PORT: ${SERVER_PORT:-8585}
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose-quickstart/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Build stage
FROM alpine:3.19 AS build
ARG RI_VERSION="1.5.0-SNAPSHOT"
ARG RI_VERSION="1.4.3"
ENV RELEASE_URL="https://github.com/open-metadata/OpenMetadata/releases/download/${RI_VERSION}-release/openmetadata-${RI_VERSION}.tar.gz"

RUN mkdir -p /opt/openmetadata && \
Expand All @@ -21,7 +21,7 @@ RUN mkdir -p /opt/openmetadata && \

# Final stage
FROM alpine:3.19
ARG RI_VERSION="1.5.0-SNAPSHOT"
ARG RI_VERSION="1.4.3"
ARG BUILD_DATE
ARG COMMIT_ID
LABEL maintainer="OpenMetadata"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ volumes:
services:
postgresql:
container_name: openmetadata_postgresql
image: docker.getcollate.io/openmetadata/postgresql:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/postgresql:1.4.3
restart: always
command: "--work_mem=10MB"
environment:
Expand Down Expand Up @@ -61,7 +61,7 @@ services:

execute-migrate-all:
container_name: execute_migrate_all
image: docker.getcollate.io/openmetadata/server:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/server:1.4.3
command: "./bootstrap/openmetadata-ops.sh migrate"
environment:
OPENMETADATA_CLUSTER_NAME: ${OPENMETADATA_CLUSTER_NAME:-openmetadata}
Expand Down Expand Up @@ -275,7 +275,7 @@ services:
openmetadata-server:
container_name: openmetadata_server
restart: always
image: docker.getcollate.io/openmetadata/server:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/server:1.4.3
environment:
OPENMETADATA_CLUSTER_NAME: ${OPENMETADATA_CLUSTER_NAME:-openmetadata}
SERVER_PORT: ${SERVER_PORT:-8585}
Expand Down Expand Up @@ -483,7 +483,7 @@ services:

ingestion:
container_name: openmetadata_ingestion
image: docker.getcollate.io/openmetadata/ingestion:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/ingestion:1.4.3
depends_on:
elasticsearch:
condition: service_started
Expand Down
8 changes: 4 additions & 4 deletions docker/docker-compose-quickstart/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ volumes:
services:
mysql:
container_name: openmetadata_mysql
image: docker.getcollate.io/openmetadata/db:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/db:1.4.3
command: "--sort_buffer_size=10M"
restart: always
environment:
Expand Down Expand Up @@ -59,7 +59,7 @@ services:

execute-migrate-all:
container_name: execute_migrate_all
image: docker.getcollate.io/openmetadata/server:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/server:1.4.3
command: "./bootstrap/openmetadata-ops.sh migrate"
environment:
OPENMETADATA_CLUSTER_NAME: ${OPENMETADATA_CLUSTER_NAME:-openmetadata}
Expand Down Expand Up @@ -273,7 +273,7 @@ services:
openmetadata-server:
container_name: openmetadata_server
restart: always
image: docker.getcollate.io/openmetadata/server:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/server:1.4.3
environment:
OPENMETADATA_CLUSTER_NAME: ${OPENMETADATA_CLUSTER_NAME:-openmetadata}
SERVER_PORT: ${SERVER_PORT:-8585}
Expand Down Expand Up @@ -482,7 +482,7 @@ services:

ingestion:
container_name: openmetadata_ingestion
image: docker.getcollate.io/openmetadata/ingestion:1.5.0-SNAPSHOT
image: docker.getcollate.io/openmetadata/ingestion:1.4.3
depends_on:
elasticsearch:
condition: service_started
Expand Down
1 change: 1 addition & 0 deletions docker/mysql/mysql-script.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ CREATE USER 'airflow_user'@'%' IDENTIFIED BY 'airflow_pass';
GRANT ALL PRIVILEGES ON openmetadata_db.* TO 'openmetadata_user'@'%' WITH GRANT OPTION;
GRANT PROCESS, USAGE ON *.* TO 'openmetadata_user'@'%';
GRANT ALL PRIVILEGES ON airflow_db.* TO 'airflow_user'@'%' WITH GRANT OPTION;
GRANT PROCESS, USAGE ON *.* TO 'openmetadata_user'@'%';
FLUSH PRIVILEGES;
commit;
2 changes: 1 addition & 1 deletion ingestion/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ARG INGESTION_DEPENDENCY="all"
ENV PIP_NO_CACHE_DIR=1
# Make pip silent
ENV PIP_QUIET=1
ARG RI_VERSION="1.5.0.0.dev0"
ARG RI_VERSION="1.4.3.0"
RUN pip install --upgrade pip
RUN pip install "openmetadata-managed-apis~=${RI_VERSION}" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.7.3/constraints-3.10.txt"
RUN pip install "openmetadata-ingestion[${INGESTION_DEPENDENCY}]~=${RI_VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion ingestion/operators/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ENV PIP_QUIET=1
RUN pip install --upgrade pip

ARG INGESTION_DEPENDENCY="all"
ARG RI_VERSION="1.5.0.0.dev0"
ARG RI_VERSION="1.4.3.0"
RUN pip install --upgrade pip
RUN pip install "openmetadata-ingestion[airflow]~=${RI_VERSION}"
RUN pip install "openmetadata-ingestion[${INGESTION_DEPENDENCY}]~=${RI_VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion ingestion/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
# since it helps us organize and isolate version management
[project]
name = "openmetadata-ingestion"
version = "1.5.0.0.dev0"
version = "1.4.3.0"
dynamic = ["readme", "dependencies", "optional-dependencies"]
authors = [
{name = "OpenMetadata Committers"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,19 @@ def get_parameter(test_case: TestCase, key: str, default=None):
@staticmethod
def get_data_diff_url(service_url: str, table_fqn) -> str:
url = urlparse(service_url)
# remove the drivername from the url becuase table-diff doesn't support it
# remove the driver name from the url because table-diff doesn't support it
kwargs = {"scheme": url.scheme.split("+")[0]}
service, database, schema, table = fqn.split( # pylint: disable=unused-variable
table_fqn
)
# pylint: disable=unbalanced-tuple-unpacking
_, database, schema, _ = fqn.split(table_fqn)
# path needs to include the database AND schema in some of the connectors
if kwargs["scheme"] in ["mssql"]:
kwargs["path"] = f"/{database}/{schema}"
return url._replace(**kwargs).geturl()

@staticmethod
def get_data_diff_table_path(table_fqn: str):
service, database, schema, table = fqn.split( # pylint: disable=unused-variable
table_fqn
)
# pylint: disable=unbalanced-tuple-unpacking
_, _, schema, table = fqn.split(table_fqn)
return fqn._build( # pylint: disable=protected-access
"___SERVICE___", "__DATABASE__", schema, table
).replace("___SERVICE___.__DATABASE__.", "")
25 changes: 24 additions & 1 deletion ingestion/src/metadata/ingestion/ometa/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from metadata.config.common import ConfigModel
from metadata.ingestion.ometa.credentials import URL, get_api_version
from metadata.ingestion.ometa.ttl_cache import TTLCache
from metadata.utils.execution_time_tracker import calculate_execution_time
from metadata.utils.logger import ometa_logger

Expand All @@ -33,6 +34,12 @@ class RetryException(Exception):
"""


class LimitsException(Exception):
"""
API Client Feature Limit exception
"""


class APIError(Exception):
"""
Represent API related error.
Expand Down Expand Up @@ -97,7 +104,8 @@ class ClientConfig(ConfigModel):
api_version: Optional[str] = "v1"
retry: Optional[int] = 3
retry_wait: Optional[int] = 30
retry_codes: List[int] = [429, 504]
limit_codes: List[int] = [429]
retry_codes: List[int] = [504]
auth_token: Optional[Callable] = None
access_token: Optional[str] = None
expires_in: Optional[int] = None
Expand All @@ -107,8 +115,10 @@ class ClientConfig(ConfigModel):
allow_redirects: Optional[bool] = False
auth_token_mode: Optional[str] = "Bearer"
verify: Optional[Union[bool, str]] = None
ttl_cache: int = 60


# pylint: disable=too-many-instance-attributes
class REST:
"""
REST client wrapper to manage requests with
Expand All @@ -124,10 +134,13 @@ def __init__(self, config: ClientConfig):
self._retry = self.config.retry
self._retry_wait = self.config.retry_wait
self._retry_codes = self.config.retry_codes
self._limit_codes = self.config.limit_codes
self._auth_token = self.config.auth_token
self._auth_token_mode = self.config.auth_token_mode
self._verify = self.config.verify

self._limits_reached = TTLCache(config.ttl_cache)

def _request( # pylint: disable=too-many-arguments
self,
method,
Expand All @@ -139,6 +152,9 @@ def _request( # pylint: disable=too-many-arguments
headers: dict = None,
):
# pylint: disable=too-many-locals
if path in self._limits_reached:
raise LimitsException(f"Skipping request - limits reached for {path}")

if not headers:
headers = {"Content-type": "application/json"}
base_url = base_url or self._base_url
Expand Down Expand Up @@ -194,6 +210,10 @@ def _request( # pylint: disable=too-many-arguments
while retry >= 0:
try:
return self._one_request(method, url, opts, retry)
except LimitsException as exc:
logger.error(f"Feature limit exceeded for {url}")
self._limits_reached.add(path)
raise exc
except RetryException:
retry_wait = self._retry_wait * (total_retries - retry + 1)
logger.warning(
Expand All @@ -217,6 +237,7 @@ def _one_request(self, method: str, url: URL, opts: dict, retry: int):
Returns the body json in the 200 status.
"""
retry_codes = self._retry_codes
limit_codes = self._limit_codes
try:
resp = self._session.request(method, url, **opts)
resp.raise_for_status()
Expand All @@ -234,6 +255,8 @@ def _one_request(self, method: str, url: URL, opts: dict, retry: int):
# retry if we hit Rate Limit
if resp.status_code in retry_codes and retry > 0:
raise RetryException() from http_error
if resp.status_code in limit_codes:
raise LimitsException() from http_error
if "code" in resp.text:
error = resp.json()
if "code" in error:
Expand Down
47 changes: 47 additions & 0 deletions ingestion/src/metadata/ingestion/ometa/ttl_cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2021 Collate
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Simple dictionary implementation for keys with TTL
"""
from datetime import datetime
from typing import Dict


class TTLCache:
"""
class to handle ttl cache
"""

def __init__(self, ttl: int):
self._ttl = ttl
# The key will be the object, and the value the created time to check the TTL
self._cache: Dict[str, int] = {}

@staticmethod
def _now() -> int:
return int(datetime.now().timestamp())

def __contains__(self, item) -> bool:
if item in self._cache:
created_at = self._cache[item]
if self._now() - created_at > self._ttl:
self.delete(item)
return False
return True
return False

def add(self, value: str):
if value not in self._cache:
self._cache[value] = self._now()

def delete(self, key):
self._cache.pop(key, None)
Loading
Loading