Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
remi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
RobotLearn
RemI (Remote Inria)
remi
Commits
6cd917d4
Commit
6cd917d4
authored
3 years ago
by
LEPAGE Gaetan
Browse files
Options
Downloads
Patches
Plain Diff
Better colors in CLI
parent
d48f5404
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
remi/utils.py
+5
-3
5 additions, 3 deletions
remi/utils.py
with
5 additions
and
3 deletions
remi/utils.py
+
5
−
3
View file @
6cd917d4
...
@@ -9,6 +9,7 @@ from os.path import join
...
@@ -9,6 +9,7 @@ from os.path import join
from
socket
import
gethostname
from
socket
import
gethostname
from
subprocess
import
Popen
,
DEVNULL
from
subprocess
import
Popen
,
DEVNULL
from
typing
import
Union
from
typing
import
Union
from
termcolor
import
colored
from
.config
import
Config
from
.config
import
Config
from
.user_interaction
import
to_bold
,
print_info
,
print_error
from
.user_interaction
import
to_bold
,
print_info
,
print_error
...
@@ -33,7 +34,7 @@ def run_local_cmd(command: list[str],
...
@@ -33,7 +34,7 @@ def run_local_cmd(command: list[str],
running command. (if background)
running command. (if background)
return_code (int): Else, the return code of the command.
return_code (int): Else, the return code of the command.
"""
"""
print_info
(
to_bold
(
'
Running command locally:
'
)
+
'
'
.
join
(
command
))
print_info
(
to_bold
(
'
Running command locally:
'
)
+
colored
(
'
'
.
join
(
command
)
,
'
blue
'
)
)
if
redirect_output
:
if
redirect_output
:
log_file
:
str
=
join
(
Config
().
output_path
,
'
log.txt
'
)
log_file
:
str
=
join
(
Config
().
output_path
,
'
log.txt
'
)
...
@@ -137,11 +138,12 @@ def run_remote_command(command: list[str],
...
@@ -137,11 +138,12 @@ def run_remote_command(command: list[str],
cmd
+=
command
cmd
+=
command
print_info
(
to_bold
(
'
Running command: `
'
)
+
'
'
.
join
(
command
)
+
'
`
'
)
print_info
(
to_bold
(
'
Running command:
'
)
+
colored
(
'
'
.
join
(
command
),
'
blue
'
))
if
pretty_hostname
is
None
:
if
pretty_hostname
is
None
:
pretty_hostname
=
hostname
[
-
1
]
if
isinstance
(
hostname
,
list
)
else
hostname
pretty_hostname
=
hostname
[
-
1
]
if
isinstance
(
hostname
,
list
)
else
hostname
print_info
(
to_bold
(
'
on remote host:
'
)
+
str
(
pretty_hostname
))
print_info
(
to_bold
(
'
on remote host:
'
)
+
colored
(
str
(
pretty_hostname
)
,
'
magenta
'
)
)
if
redirect_output
:
if
redirect_output
:
log_file
:
str
=
join
(
config
.
output_path
,
'
log.txt
'
)
log_file
:
str
=
join
(
config
.
output_path
,
'
log.txt
'
)
...
...
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