Skip to content

Commit

Permalink
Merge commit '369685cc715e95af82dfa4dc14d0c58af8bb1ac9'
Browse files Browse the repository at this point in the history
* commit '369685cc715e95af82dfa4dc14d0c58af8bb1ac9':
  chore: replace references to Lyft -> Amundsen (amundsen-io#174)
  feat: Data Owner Implementation of Atlas Proxy (amundsen-io#156)
  chore: fix docker push action (amundsen-io#172)
  chore: add docker publish action and remove travis (amundsen-io#171)
  chore: add pypi publish action (amundsen-io#170)
  fix: removing OidcConfig file and making statsd configurable through envrionment variable (amundsen-io#157)
  ci: add dependabot config (amundsen-io#169)
  Update repo name in travis file (amundsen-io#163)
  feat: Populate is_view property in AtlasProxy (amundsen-io#155)
  fix: Overlapping table name issue in Readers [AtlasProxy]
  feat: Add resource_reports field in Table API ( Atlas proxy) (amundsen-io#149)
  chore: apply license headers to all the source files (amundsen-io#153)
  feat: Add programmatic descriptions parser for [AtlasProxy] (amundsen-io#152)
  feat: Add Frequent Users feature in [AtlasProxy] (amundsen-io#147)
  feat: Implement configurable minimum number of readers for popular tables (amundsen-io#146)
  chore: update the email for the project (amundsen-io#148)

# Conflicts:
#	README.md
#	docs/configurations.md
#	docs/structure.md
#	metadata_service/config.py
#	metadata_service/oidc_config.py
#	metadata_service/proxy/neo4j_proxy.py
#	requirements.txt
#	setup.py
  • Loading branch information
Jerry Zhu committed Aug 20, 2020
2 parents 8f23a12 + 369685c commit a53daca
Show file tree
Hide file tree
Showing 72 changed files with 725 additions and 97 deletions.
5 changes: 5 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 1
update_configs:
- package_manager: "python"
directory: "/"
update_schedule: "monthly"
30 changes: 30 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

on: pull_request
jobs:
pre-commit:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
test-unit:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: ['3.6.x', '3.7.x']
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip3 install -r requirements.txt && pip3 install .[all] && pip3 install codecov
- name: Run python unit tests
run: make test
40 changes: 40 additions & 0 deletions .github/workflows/pypipublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

name: Build and Deploy
on:
push:
branches:
- master
tags:
- '*'
jobs:
build-and-publish-python-module:
name: Build and publish python module to pypi
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Add wheel dependency
run: pip install wheel
- name: Generate dist
run: python setup.py sdist bdist_wheel
- name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
build-and-publish-docker-image:
name: Build and publish docker image
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Login with docker
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Publish to Registry
if: success()
run: make build-push-image
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This project is governed by [Lyft's code of conduct](https://github.com/lyft/code-of-conduct).
This project is governed by [Amundsen's code of conduct](https://github.com/amundsen-io/amundsen/blob/master/CODE_OF_CONDUCT.md).
All contributors and participants agree to abide by its terms.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

Amundsen Metadata service serves Restful API and is responsible for providing and also updating metadata, such as table & column description, and tags. Metadata service can use Neo4j or Apache Atlas as a persistent layer.

For information about Amundsen and our other services, visit the [main repository](https://github.com/lyft/amundsen#amundsen) `README.md`. Please also see our instructions for a [quick start](https://github.com/lyft/amundsen/blob/master/docs/installation.md#bootstrap-a-default-version-of-amundsen-using-docker) setup of Amundsen with dummy data, and an [overview of the architecture](https://github.com/lyft/amundsen/blob/master/docs/architecture.md#architecture).
For information about Amundsen and our other services, visit the [main repository](https://github.com/amundsen-io/amundsen#amundsen) `README.md`. Please also see our instructions for a [quick start](https://github.com/amundsen-io/amundsen/blob/master/docs/installation.md#bootstrap-a-default-version-of-amundsen-using-docker) setup of Amundsen with dummy data, and an [overview of the architecture](https://github.com/amundsen-io/amundsen/blob/master/docs/architecture.md#architecture).

## Requirements
- Python >= 3.7

## Doc
- https://lyft.github.io/amundsen/
- https://www.amundsen.io/amundsen/

## Instructions to start the Metadata service from distribution
```bash
Expand Down
6 changes: 2 additions & 4 deletions docs/configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ Most of the configurations are set through Flask [Config Class](https://github.c

#### USER_DETAIL_METHOD `OPTIONAL`
This is a method that can be used to get the user details from any third-party or custom system.
This custom function takes user_id as a parameter, and returns a tuple consisting user details defined in [UserSchema](https://github.com/kylg/amundsencommon/blob/master/amundsen_common/models/user.py) along with the status code.
This custom function takes user_id as a parameter, and returns a dictionary consisting user details' fields defined in [UserSchema](https://github.com/kylg/amundsencommon/blob/master/amundsen_common/models/user.py).

Example:
```python

def get_user_details(user_id):
from amundsen_common.models.user import UserSchema
from http import HTTPStatus
user_info = {
'email': 'test@email.com',
'user_id': user_id,
'first_name': 'Firstname',
'last_name': 'Lastname',
'full_name': 'Firstname Lastname',
}
return UserSchema().dump(user_info).data, HTTPStatus.OK
return user_info

USER_DETAIL_METHOD = get_user_details
```
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import ast
import importlib
import logging
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from http import HTTPStatus
from typing import Iterable, Union, Mapping, Any, Optional, List
Expand Down
4 changes: 4 additions & 0 deletions metadata_service/api/column.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import json
from http import HTTPStatus
from typing import Iterable, Union
Expand All @@ -14,6 +17,7 @@ class ColumnDescriptionAPI(Resource):
"""
ColumnDescriptionAPI supports PUT and GET operations to upsert column description
"""

def __init__(self) -> None:
self.client = get_proxy_client()
super(ColumnDescriptionAPI, self).__init__()
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/api/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import json
from http import HTTPStatus
from typing import Iterable, Mapping, Optional, Union
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/api/healthcheck.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Tuple
from flasgger import swag_from

Expand Down
4 changes: 4 additions & 0 deletions metadata_service/api/popular_tables.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Iterable, List, Mapping, Union

Expand All @@ -13,6 +16,7 @@ class PopularTablesAPI(Resource):
"""
PopularTables API
"""

def __init__(self) -> None:
self.client = get_proxy_client()

Expand Down
3 changes: 3 additions & 0 deletions metadata_service/api/system.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Iterable, Union, Mapping

Expand Down
4 changes: 4 additions & 0 deletions metadata_service/api/table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import json
from http import HTTPStatus
from typing import Any, Iterable, Mapping, Union, Optional
Expand Down Expand Up @@ -71,6 +74,7 @@ class TableDescriptionAPI(Resource):
"""
TableDescriptionAPI supports PUT and GET operation to upsert table description
"""

def __init__(self) -> None:
self.client = get_proxy_client()
super(TableDescriptionAPI, self).__init__()
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/api/tag.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from http import HTTPStatus
from typing import Iterable, Union, Mapping, Tuple, Any

Expand Down
6 changes: 5 additions & 1 deletion metadata_service/api/user.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import logging
from http import HTTPStatus
from typing import Iterable, Mapping, Optional, Union, Dict, List, Any # noqa: F401
Expand Down Expand Up @@ -31,7 +34,8 @@ def get(self, *, id: Optional[str] = None) -> Iterable[Union[Mapping, int, None]
"""
if app.config['USER_DETAIL_METHOD']:
try:
return app.config['USER_DETAIL_METHOD'](id)
user_data = app.config['USER_DETAIL_METHOD'](id)
return UserSchema().dump(user_data).data, HTTPStatus.OK
except Exception:
LOGGER.exception('UserDetailAPI GET Failed - Using "USER_DETAIL_METHOD" config variable')
return {'message': 'user_id {} fetch failed'.format(id)}, HTTPStatus.NOT_FOUND
Expand Down
13 changes: 13 additions & 0 deletions metadata_service/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import distutils.util
import os
from typing import List, Dict, Optional, Set # noqa: F401
Expand Down Expand Up @@ -61,9 +64,17 @@ class Config:

USER_DETAIL_METHOD = None # type: Optional[function]

RESOURCE_REPORT_CLIENT = None # type: Optional[function]

# On User detail method, these keys will be added into amundsen_common.models.user.User.other_key_values
USER_OTHER_KEYS = {'mode_user_id'} # type: Set[str]

# Number of minimum reader count to qualify for popular table
POPULAR_TABLE_MINIMUM_READER_COUNT = 10 # type: int

# List of regexes which will exclude certain parameters from appearing as Programmatic Descriptions
PROGRAMMATIC_DESCRIPTIONS_EXCLUDE_FILTERS = [] # type: list


class LocalConfig(Config):
DEBUG = True
Expand All @@ -79,6 +90,8 @@ class LocalConfig(Config):

JANUS_GRAPH_URL = None

IS_STATSD_ON = bool(distutils.util.strtobool(os.environ.get(IS_STATSD_ON, 'False')))

SWAGGER_ENABLED = True
SWAGGER_TEMPLATE_PATH = os.path.join('api', 'swagger_doc', 'template.yml')
SWAGGER = {
Expand Down
2 changes: 2 additions & 0 deletions metadata_service/entity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions metadata_service/entity/dashboard_detail.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import List
from typing import Optional

Expand Down
3 changes: 3 additions & 0 deletions metadata_service/entity/dashboard_query.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import Optional

import attr
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/entity/dashboard_summary.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from typing import List

import attr
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/entity/description.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import attr
from marshmallow_annotations.ext.attrs import AttrsSchema

Expand Down
3 changes: 3 additions & 0 deletions metadata_service/entity/resource_type.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from enum import Enum, auto


Expand Down
3 changes: 3 additions & 0 deletions metadata_service/entity/tag_detail.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import attr
from marshmallow_annotations.ext.attrs import AttrsSchema

Expand Down
3 changes: 3 additions & 0 deletions metadata_service/exception.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0


class NotFoundException(Exception):
def __init__(self, message: str) -> None:
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/metadata_wsgi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

import os

from metadata_service import create_app
Expand Down
3 changes: 3 additions & 0 deletions metadata_service/proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0

from threading import Lock

from flask import current_app
Expand Down
Loading

0 comments on commit a53daca

Please sign in to comment.