Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
Read_from_Kairos_Component
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dasharatha.vamshi
Read_from_Kairos_Component
Commits
f0fd658e
Commit
f0fd658e
authored
Feb 15, 2021
by
Akshay G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read config from ENV instead of from config
parent
0e60af8c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
main.py
main.py
+1
-1
scripts/common/config_parser.py
scripts/common/config_parser.py
+10
-3
scripts/common/logsetup.py
scripts/common/logsetup.py
+0
-4
No files found.
main.py
View file @
f0fd658e
...
...
@@ -83,7 +83,7 @@ def get_data(query):
data
=
response
.
json
()[
KariosConstants
.
QUERIES_KEY
][
0
][
KariosConstants
.
RESULTS_KEY
][
0
]
\
[
KariosConstants
.
VALUES_KEY
]
df
=
DataFrame
.
from_dict
(
data
)
logger
.
debug
(
"Dataframe --> {}"
.
format
(
df
.
head
()))
logger
.
info
(
"Dataframe --> {}"
.
format
(
df
.
head
()))
if
len
(
df
)
>
0
:
df
.
columns
=
[
KariosConstants
.
TIMESTAMP_COLUMN_NAME
,
list
(
config
[
KariosConstants
.
TAG_HIERARCHY_KEY
]
.
keys
())
...
...
scripts/common/config_parser.py
View file @
f0fd658e
#!/usr/bin/env python
import
os
import
sys
import
json
import
yaml
import
json
# os.environ['config'] = '{"kairosdb_url": "http://192.168.0.207:8080",' \
# '"metric_name": "ilens.live_data.raw",' \
...
...
@@ -30,8 +30,15 @@ if not os.path.exists(os.path.join(os.getcwd(), 'logs')):
LOG_LEVEL
=
os
.
environ
.
get
(
"LOG_LEVEL"
,
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
"LOG_LEVEL"
,
"INFO"
))
.
upper
()
LOG_HANDLER_NAME
=
_config
.
get
(
'SERVICE_CONFIG'
,
{})
.
get
(
"LOG_HANDLER_NAME"
,
"ReadFromKairos"
)
config
=
json
.
loads
(
os
.
environ
.
get
(
'config'
))
# config = json.loads(os.environ.get('config'))
config
=
{
"shared_volume"
:
os
.
environ
.
get
(
"shared_volume"
),
"end_absolute"
:
os
.
environ
.
get
(
"end_absolute"
),
"start_absolute"
:
os
.
environ
.
get
(
"start_absolute"
),
"tag_hierarchy"
:
json
.
loads
(
os
.
environ
.
get
(
"tag_hierarchy"
)),
"metric_name"
:
os
.
environ
.
get
(
"metric_name"
),
"kairosdb_url"
:
os
.
environ
.
get
(
"kairosdb_url"
)
}
if
not
os
.
path
.
exists
(
config
[
'shared_volume'
]):
sys
.
stderr
.
write
(
"Shared path does not exist!"
)
sys
.
stderr
.
write
(
"Creating path --> {}"
.
format
(
config
[
'shared_volume'
]))
...
...
scripts/common/logsetup.py
View file @
f0fd658e
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os
import
logging
from
logging.handlers
import
RotatingFileHandler
...
...
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