Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
repl_graph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vaclab
repl_graph
Commits
48f6a59b
Commit
48f6a59b
authored
5 years ago
by
Thomas Bock
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
c012fe91
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
repl/__pycache__/utils.cpython-37.pyc
+0
-0
0 additions, 0 deletions
repl/__pycache__/utils.cpython-37.pyc
repl/utils.py
+9
-9
9 additions, 9 deletions
repl/utils.py
server.py
+9
-2
9 additions, 2 deletions
server.py
with
18 additions
and
11 deletions
repl/__pycache__/utils.cpython-37.pyc
+
0
−
0
View file @
48f6a59b
No preview for this file type
This diff is collapsed.
Click to expand it.
repl/utils.py
+
9
−
9
View file @
48f6a59b
...
...
@@ -37,28 +37,28 @@ def gen_count():
yield
i
i
=
i
+
1
def
get_info
(
url
):
def
get_info
(
url
,
srv
):
p
=
urlparse
(
url
)
db
=
p
.
path
.
replace
(
"
/
"
,
""
)
host
=
p
.
hostname
.
split
(
"
.
"
)[
0
]
host
=
p
.
hostname
host
=
host
.
replace
(
"
localhost
"
,
srv
)
host
=
host
.
split
(
"
.
"
)[
0
]
return
db
,
host
def
gen_ext_name
(
d
,
h
):
return
"
{}@{}
"
.
format
(
d
,
h
)
def
get_nodes_and_edges
(
jobs
,
gen
,
hosts
,
dbs
):
nodes
=
[]
edges
=
[]
def
get_nodes_and_edges
(
jobs
,
gen
,
hosts
,
dbs
,
nodes
,
edges
,
srv
):
for
job
in
jobs
:
s
=
job
.
get
(
"
source
"
)
t
=
job
.
get
(
"
target
"
)
if
s
and
t
:
s_db
,
s_host
=
get_info
(
s
)
t_db
,
t_host
=
get_info
(
t
)
s_db
,
s_host
=
get_info
(
s
,
srv
)
t_db
,
t_host
=
get_info
(
t
,
srv
)
s_db_name
=
gen_ext_name
(
s_db
,
s_host
)
t_db_name
=
gen_ext_name
(
t_db
,
t_host
)
...
...
@@ -82,4 +82,4 @@ def get_nodes_and_edges(jobs, gen, hosts, dbs):
edges
.
append
({
"
from
"
:
hosts
[
s_host
]
,
"
to
"
:
dbs
[
s_db_name
],
"
arrow_type
"
:
"
box
"
})
edges
.
append
({
"
from
"
:
hosts
[
t_host
]
,
"
to
"
:
dbs
[
t_db_name
],
"
arrow_type
"
:
"
box
"
})
return
nodes
,
edges
\ No newline at end of file
return
nodes
,
edges
This diff is collapsed.
Click to expand it.
server.py
+
9
−
2
View file @
48f6a59b
...
...
@@ -12,9 +12,16 @@ CORS(app)
@app.route
(
'
/repl/all.html
'
,
methods
=
[
'
GET
'
])
def
repl_all
():
jobs
=
utils
.
get_jobs
(
config
[
"
db
"
][
"
host
"
],
config
[
"
db
"
][
"
port
"
])
gen
=
utils
.
gen_count
()
nodes
,
edges
=
utils
.
get_nodes_and_edges
(
jobs
,
gen
,
{},
{})
hosts
=
{}
dbs
=
{}
nodes
=
[]
edges
=
[]
for
srv
in
(
"
a73434
"
,
"
a73435
"
,
"
i75422
"
,
"
i75464
"
,
"
e75455
"
,
"
i75415
"
):
jobs
=
utils
.
get_jobs
(
srv
,
5984
)
nodes
,
edges
=
utils
.
get_nodes_and_edges
(
jobs
,
gen
,
hosts
,
dbs
,
nodes
,
edges
,
srv
)
template
=
utils
.
path_file
(
path
=
config
[
'
templates
'
][
'
html
'
],
file
=
'
all.html
'
)
return
render_template
(
template
,
nodes
=
nodes
,
edges
=
edges
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment