Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parse-ci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
s2870355
parse-ci
Commits
ec4f75e4
Commit
ec4f75e4
authored
1 year ago
by
s2870355
Browse files
Options
Downloads
Patches
Plain Diff
embed part into graph
parent
598f4d22
No related branches found
No related tags found
No related merge requests found
Pipeline
#76747
canceled
1 year ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parse-ci.py
+51
-6
51 additions, 6 deletions
parse-ci.py
with
51 additions
and
6 deletions
parse-ci.py
+
51
−
6
View file @
ec4f75e4
...
...
@@ -149,13 +149,58 @@ def get_stages(compile_info : list[job_data]) -> list[str]:
stages
.
append
(
i
.
stage
)
return
sorted
(
stages
)
def
create_dot
(
compile_info
:
list
[
job_data
])
->
None
:
output
=
"
digraph G {rankdir=
\"
LR
\"\n
"
def
add_to_dict
(
job_data
,
xdict
)
->
None
:
location
=
job_data
.
location
parts
=
location
.
split
(
'
/
'
)
current_dict
=
xdict
for
part
in
parts
[
0
:
-
1
]:
if
part
not
in
current_dict
:
current_dict
[
part
]
=
{}
current_dict
=
current_dict
[
part
]
current_dict
[
parts
[
-
1
]]
=
job_data
def
list_to_dict
(
compile_info
:
list
[
job_data
])
->
dict
:
output
=
{}
for
j
in
compile_info
:
output
=
output
+
"
\t
"
+
j
.
location
.
replace
(
'
/
'
,
"
_
"
).
replace
(
'
\\
'
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
).
replace
(
"
.
"
,
"
_
"
)
+
"
[label=
\"
"
+
j
.
location
.
replace
(
'
\\
'
,
'
\\\\
'
)
+
"
\"
]
"
"
;
\n
"
for
d
in
j
.
depends
:
output
=
output
+
"
\t\t
"
+
d
.
replace
(
'
/
'
,
"
_
"
).
replace
(
'
\\
'
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
).
replace
(
"
.
"
,
"
_
"
)
+
"
->
"
+
j
.
location
.
replace
(
os
.
sep
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
).
replace
(
"
.
"
,
"
_
"
)
+
"
;
\n
"
return
output
+
"
}
"
add_to_dict
(
j
,
output
)
return
output
def
dict_to_nodes
(
dictionary
)
->
str
:
if
isinstance
(
dictionary
,
dict
):
output_str
=
""
for
k
in
dictionary
.
keys
():
if
isinstance
(
dictionary
[
k
],
dict
):
output_str
+=
"
\n\t
subgraph cluster_
"
+
k
+
"
{
"
+
"
\n\t\t
label=
\"
"
+
k
+
"
\"
"
output_str
+=
dict_to_nodes
(
dictionary
[
k
]).
replace
(
'
\n
'
,
"
\n\t
"
)
output_str
+=
"
\n\t
}
"
else
:
output_str
+=
"
\n\t
"
+
dictionary
[
k
].
location
.
replace
(
'
/
'
,
"
_
"
).
replace
(
'
\\
'
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
).
replace
(
"
.
"
,
"
_
"
)
+
"
[label=
\"
"
+
dictionary
[
k
].
location
.
split
(
'
/
'
)[
-
1
]
+
"
\"
];
"
return
output_str
return
""
def
dict_to_edges
(
dictionary
)
->
str
:
if
isinstance
(
dictionary
,
dict
):
output
=
""
for
k
in
dictionary
.
keys
():
output
+=
dict_to_edges
(
dictionary
[
k
])
return
output
if
isinstance
(
dictionary
,
job_data
):
job
=
dictionary
location
=
job
.
location
depends
=
job
.
depends
output_str
=
""
for
depend
in
depends
:
d_location
=
depend
output_str
+=
"
\t
"
+
d_location
.
replace
(
'
/
'
,
"
_
"
).
replace
(
'
\\
'
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
).
replace
(
"
.
"
,
"
_
"
)
+
"
->
"
+
location
.
replace
(
'
/
'
,
"
_
"
).
replace
(
'
\\
'
,
"
_
"
).
replace
(
"
-
"
,
"
_
"
).
replace
(
"
.
"
,
"
_
"
)
+
"
;
\n
"
return
output_str
def
create_dot
(
compile_info
:
list
[
job_data
])
->
None
:
dictionary
=
list_to_dict
(
compile_info
)
output
=
"
digraph G {rankdir=
\"
LR
\"
"
output
+=
dict_to_nodes
(
dictionary
)
output
+=
dict_to_edges
(
dictionary
)
output
+=
"
}
"
return
output
def
generate_ci
(
compile_info
:
list
[
job_data
])
->
str
:
output
=
""
...
...
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