Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
orchestra-v3
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
Alessandro Di Federico
orchestra-v3
Commits
e6464f06
Commit
e6464f06
authored
4 years ago
by
Filippo Cremonese
Browse files
Options
Downloads
Patches
Plain Diff
Improved graphs, signalling if an action can run
parent
09d79c9c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
orchestra/actions/action.py
+6
-1
6 additions, 1 deletion
orchestra/actions/action.py
orchestra/cmds/graph.py
+9
-2
9 additions, 2 deletions
orchestra/cmds/graph.py
with
15 additions
and
3 deletions
orchestra/actions/action.py
+
6
−
1
View file @
e6464f06
from
collections
import
OrderedDict
from
loguru
import
logger
from
typing
import
Set
from
loguru
import
logger
from
.util
import
run_script
...
...
@@ -56,6 +57,10 @@ class Action:
"""
Returns true if the action is satisfied, false if it needs to run.
"""
raise
NotImplementedError
()
def
can_run
(
self
):
"""
Returns true if the action can be run (i.e. all its dependencies are satisfied)
"""
return
all
(
d
.
is_satisfied
()
for
d
in
self
.
dependencies
)
@property
def
environment
(
self
)
->
OrderedDict
:
"""
Returns additional environment variables provided to the script to be run
"""
...
...
This diff is collapsed.
Click to expand it.
orchestra/cmds/graph.py
+
9
−
2
View file @
e6464f06
...
...
@@ -4,7 +4,8 @@ from ..model.configuration import Configuration
def
install_subcommand
(
sub_argparser
):
cmd_parser
=
sub_argparser
.
add_parser
(
"
graph
"
,
handler
=
handle_graph
)
cmd_parser
.
add_argument
(
"
component
"
,
nargs
=
"
?
"
)
cmd_parser
.
add_argument
(
"
--all-builds
"
,
action
=
"
store_true
"
,
help
=
"
Include all builds instead of only the default one.
"
)
cmd_parser
.
add_argument
(
"
--all-builds
"
,
action
=
"
store_true
"
,
help
=
"
Include all builds instead of only the default one.
"
)
def
handle_graph
(
args
,
config
:
Configuration
):
...
...
@@ -32,7 +33,13 @@ def print_dependencies(actions):
if
action
in
already_visited_actions
:
return
color
=
"
green
"
if
action
.
is_satisfied
(
recursively
=
True
)
else
"
red
"
if
action
.
is_satisfied
(
recursively
=
True
):
color
=
"
green
"
elif
action
.
can_run
():
color
=
"
orange
"
else
:
color
=
"
red
"
rows
.
add
(
f
'
"
{
action
.
name_for_graph
}
"
[ shape=box, style=filled, color=
{
color
}
];
'
)
for
d
in
action
.
dependencies
:
rows
.
add
(
f
'
"
{
d
.
name_for_graph
}
"
->
"
{
action
.
name_for_graph
}
"
;
'
)
...
...
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