Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
85d0f22a
Unverified
Commit
85d0f22a
authored
Aug 09, 2021
by
liuzhe-lz
Committed by
GitHub
Aug 09, 2021
Browse files
lazy import jupyter-related package (#4045)
parent
9cd42f61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
nni/tools/nnictl/nnictl.py
nni/tools/nnictl/nnictl.py
+12
-3
No files found.
nni/tools/nnictl/nnictl.py
View file @
85d0f22a
...
@@ -6,7 +6,6 @@ import logging
...
@@ -6,7 +6,6 @@ import logging
import
os
import
os
import
pkg_resources
import
pkg_resources
from
colorama
import
init
from
colorama
import
init
import
nni.tools.jupyter_extension.management
as
jupyter_management
from
.common_utils
import
print_error
from
.common_utils
import
print_error
from
.launcher
import
create_experiment
,
resume_experiment
,
view_experiment
from
.launcher
import
create_experiment
,
resume_experiment
,
view_experiment
from
.updater
import
update_searchspace
,
update_concurrency
,
update_duration
,
update_trialnum
,
import_data
from
.updater
import
update_searchspace
,
update_concurrency
,
update_duration
,
update_trialnum
,
import_data
...
@@ -283,12 +282,22 @@ def parse_args():
...
@@ -283,12 +282,22 @@ def parse_args():
jupyter_parser
=
subparsers
.
add_parser
(
'jupyter-extension'
,
help
=
'install or uninstall JupyterLab extension (internal preview)'
)
jupyter_parser
=
subparsers
.
add_parser
(
'jupyter-extension'
,
help
=
'install or uninstall JupyterLab extension (internal preview)'
)
jupyter_subparsers
=
jupyter_parser
.
add_subparsers
()
jupyter_subparsers
=
jupyter_parser
.
add_subparsers
()
jupyter_install_parser
=
jupyter_subparsers
.
add_parser
(
'install'
,
help
=
'install JupyterLab extension'
)
jupyter_install_parser
=
jupyter_subparsers
.
add_parser
(
'install'
,
help
=
'install JupyterLab extension'
)
jupyter_install_parser
.
set_defaults
(
func
=
lambda
_args
:
jupyter_management
.
install
())
# TODO: prompt message
jupyter_install_parser
.
set_defaults
(
func
=
_jupyter_install
)
jupyter_uninstall_parser
=
jupyter_subparsers
.
add_parser
(
'uninstall'
,
help
=
'uninstall JupyterLab extension'
)
jupyter_uninstall_parser
=
jupyter_subparsers
.
add_parser
(
'uninstall'
,
help
=
'uninstall JupyterLab extension'
)
jupyter_uninstall_parser
.
set_defaults
(
func
=
lambda
_args
:
jupyter_management
.
uninstall
()
)
jupyter_uninstall_parser
.
set_defaults
(
func
=
_jupyter_
uninstall
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
args
.
func
(
args
)
args
.
func
(
args
)
def
_jupyter_install
(
_args
):
import
nni.tools.jupyter_extension.management
as
jupyter_management
jupyter_management
.
install
()
print
(
'Successfully installed JupyterLab extension'
)
def
_jupyter_uninstall
(
_args
):
import
nni.tools.jupyter_extension.management
as
jupyter_management
jupyter_management
.
uninstall
()
print
(
'Successfully uninstalled JupyterLab extension'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
parse_args
()
parse_args
()
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