Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
af55c7f8
Commit
af55c7f8
authored
Dec 15, 2020
by
Verdan Mahmood
Committed by
Madhan Neethiraj
Dec 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-4080: updated Python client with addition of API to retrieve metrics
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
4fb6c7b4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
8 deletions
+47
-8
README.md
intg/src/main/python/README.md
+1
-1
admin.py
intg/src/main/python/apache_atlas/client/admin.py
+10
-4
base_client.py
intg/src/main/python/apache_atlas/client/base_client.py
+2
-2
admin.py
intg/src/main/python/apache_atlas/model/admin.py
+33
-0
setup.py
intg/src/main/python/setup.py
+1
-1
No files found.
intg/src/main/python/README.md
View file @
af55c7f8
...
...
@@ -16,7 +16,7 @@ Verify if apache-atlas client is installed:
Package Version
------------
---------
apache-atlas 0.0.
2
apache-atlas 0.0.
3
```
## Usage
...
...
intg/src/main/python/apache_atlas/
model/metrics
.py
→
intg/src/main/python/apache_atlas/
client/admin
.py
View file @
af55c7f8
...
...
@@ -17,11 +17,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
apache_atlas.model.admin
import
*
from
apache_atlas.utils
import
*
class
AtlasMetrics
(
AtlasBase
):
def
__init__
(
self
,
attrs
=
{}):
AtlasBase
.
__init__
(
self
,
attrs
)
class
AdminClient
:
BASE_ADMIN_URL
=
BASE_URI
+
"admin/"
self
.
data
=
attrs
.
get
(
'data'
)
GET_METRICS_API
=
API
(
BASE_ADMIN_URL
+
"metrics"
,
HttpMethod
.
GET
,
HTTPStatus
.
OK
)
def
__init__
(
self
,
client
):
self
.
client
=
client
def
get_metrics
(
self
):
return
self
.
client
.
call_api
(
AdminClient
.
GET_METRICS_API
,
AtlasAdminMetrics
)
intg/src/main/python/apache_atlas/client/base_client.py
View file @
af55c7f8
...
...
@@ -28,11 +28,11 @@ from apache_atlas.client.entity import EntityClient
from
apache_atlas.client.glossary
import
GlossaryClient
from
apache_atlas.client.lineage
import
LineageClient
from
apache_atlas.client.relationship
import
RelationshipClient
from
apache_atlas.client.admin
import
AdminClient
from
apache_atlas.client.typedef
import
TypeDefClient
from
apache_atlas.exceptions
import
AtlasServiceException
from
apache_atlas.utils
import
HttpMethod
,
HTTPStatus
,
type_coerce
LOG
=
logging
.
getLogger
(
'apache_atlas'
)
...
...
@@ -50,10 +50,10 @@ class AtlasClient:
self
.
discovery
=
DiscoveryClient
(
self
)
self
.
glossary
=
GlossaryClient
(
self
)
self
.
relationship
=
RelationshipClient
(
self
)
self
.
admin
=
AdminClient
(
self
)
logging
.
getLogger
(
"requests"
)
.
setLevel
(
logging
.
WARNING
)
def
call_api
(
self
,
api
,
response_type
=
None
,
query_params
=
None
,
request_obj
=
None
):
params
=
copy
.
deepcopy
(
self
.
request_params
)
path
=
os
.
path
.
join
(
self
.
host
,
api
.
path
)
...
...
intg/src/main/python/apache_atlas/model/admin.py
0 → 100644
View file @
af55c7f8
#!/usr/bin/env/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
from
apache_atlas.model.instance
import
AtlasBase
class
AtlasAdminMetrics
(
AtlasBase
):
def
__init__
(
self
,
attrs
=
None
):
AtlasBase
.
__init__
(
self
,
attrs
)
attrs
=
attrs
or
{}
_data
=
attrs
.
get
(
'data'
,
{})
self
.
general
=
_data
.
get
(
'general'
,
{})
self
.
tag
=
_data
.
get
(
'tag'
,
{})
self
.
entity
=
_data
.
get
(
'entity'
,
{})
self
.
system
=
_data
.
get
(
'system'
,
{})
intg/src/main/python/setup.py
View file @
af55c7f8
...
...
@@ -28,7 +28,7 @@ with open("README.md", "r") as fh:
setup
(
name
=
'apache-atlas'
,
version
=
'0.0.
2
'
,
version
=
'0.0.
3
'
,
author
=
"Apache Atlas"
,
author_email
=
'dev@atlas.apache.org'
,
description
=
"Apache Atlas Python Client"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment